Exemple #1
0
 public ReadAppointmentViewModel(CustomAppointment appointment, ICollection <CustomAppointment> appointments)
 {
     this.Appointment   = appointment;
     this.appointments  = appointments;
     this.CancelCommand = new Command(this.GoBack);
     this.EditCommand   = new Command(this.Edit);
     this.DeleteCommand = new Command(this.Delete);
 }
        public void NavigateToReadAppointmentPage(CustomAppointment appointment)
        {
            var readAppointmentViewModel = new ReadAppointmentViewModel(appointment, this.Appointments);
            var contentPage = new ContentPage()
            {
                Content = new ReadAppointmentView()
                {
                    BindingContext = readAppointmentViewModel
                }
            };

            NavigationPage.SetHasNavigationBar(contentPage, false);
            Application.Current.MainPage.Navigation.PushAsync(contentPage);
        }
Exemple #3
0
        private void Add()
        {
            if (string.IsNullOrWhiteSpace(this.AppointmentTitle))
            {
                return;
            }

            var newAppointment = new CustomAppointment
            {
                StartDate = this.StartDate,
                EndDate   = this.EndDate,
                Title     = this.AppointmentTitle,
                Color     = this.Color,
                IsAllDay  = this.IsAllDay
            };

            this.appointments.Add(newAppointment);
            this.GoBack();
        }
        public EditAppointmentViewModel(CustomAppointment appointment, ICollection <CustomAppointment> appointments)
        {
            this.appointments = appointments;

            this.AppointmentTitle = appointment.Title;
            this.EndDate          = appointment.EndDate;
            this.StartDate        = appointment.StartDate;
            this.EndTime          = appointment.EndDate.TimeOfDay;
            this.StartTime        = appointment.StartDate.TimeOfDay;
            this.Color            = appointment.Color;
            this.IsAllDay         = appointment.IsAllDay;
            this.appointmentId    = appointment.Id;

            this.AppointmentColors = AppointmentsGenerator.AppointmentColors;
            this.CancelCommand     = new Command(this.GoBack);
            this.EditCommand       = new Command(this.Edit);

            this.PropertyChanged += HandlePropertyChanged;
        }