-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMainPage.xaml.cs
60 lines (48 loc) · 2.01 KB
/
MainPage.xaml.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
using DevExpress.Maui.Scheduler;
using System.ComponentModel;
namespace SchedulerExample
{
public partial class MainPage : ContentPage
{
public MainPage()
{
BindingContext = new ReceptionDeskViewModel();
InitializeComponent();
}
private void WorkWeekView_Tap(object sender, SchedulerGestureEventArgs e) {
if (e.AppointmentInfo == null) {
ShowNewAppointmentEditPage(e.IntervalInfo);
return;
}
AppointmentItem appointment = e.AppointmentInfo.Appointment;
ShowAppointmentEditPage(appointment);
}
private void ShowAppointmentEditPage(AppointmentItem appointment) {
AppointmentEditPage appEditPage = new AppointmentEditPage(appointment, this.storage);
Navigation.PushAsync(appEditPage);
}
private void ShowNewAppointmentEditPage(IntervalInfo info) {
AppointmentEditPage appEditPage = new AppointmentEditPage(info.Start, info.End,
info.AllDay, this.storage);
Navigation.PushAsync(appEditPage);
}
public class ReceptionDeskViewModel : INotifyPropertyChanged
{
readonly ReceptionDeskData data;
public event PropertyChangedEventHandler PropertyChanged;
public DateTime StartDate { get { return ReceptionDeskData.BaseDate; } }
public IReadOnlyList<MedicalAppointment> MedicalAppointments
{ get => data.MedicalAppointments; }
public IReadOnlyList<MedicalAppointmentType> AppointmentTypes { get => data.Labels; }
public ReceptionDeskViewModel()
{
data = new ReceptionDeskData();
}
protected void RaisePropertyChanged(string name)
{
if (PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs(name));
}
}
}
}