示例#1
0
        private void OnAddNewApoitmentCommandExecuted(object obj)
        {
            if (this.AppointmentUIContent == MultiDayViewAppointmentsCRUDViewModel.DefaultEditText)
            {
                this.currentTappedAppointment.Subject     = this.Subject;
                this.currentTappedAppointment.Description = this.Description;
                this.currentTappedAppointment.IsAllDay    = this.IsAllDay;
                this.currentTappedAppointment.StartDate   = this.StartDate.Value;
                this.currentTappedAppointment.EndDate     = this.EndDate.Value;
            }
            else
            {
                DateTimeAppointment newAppointment = new DateTimeAppointment(this.StartDate.Value, this.EndDate.Value);
                newAppointment.Subject     = this.Subject;
                newAppointment.Description = this.Description;
                newAppointment.IsAllDay    = this.IsAllDay;
                newAppointment.Color       = this.AppointmentBrushes[rnd.Next(0, 2)];

                this.Appointments.AllAppointments.Add(newAppointment);
            }

            this.Subject     = string.Empty;
            this.Description = string.Empty;
            this.IsAllDay    = false;

            DateTime today = DateTime.Now.Date;

            this.StartDate = today;
            this.EndDate   = today;

            this.IsOpen = false;
        }
示例#2
0
        private void ChangeAppointmentSourceClicked(object sender, RoutedEventArgs e)
        {
            CustomAppointmentSource newSource = new CustomAppointmentSource();
            DateTime today = DateTime.Now.Date;
            int      step  = 5;
            Random   rnd   = new Random();

            Byte[] b = new Byte[3];
            for (int i = 0; i < 100; i++)
            {
                rnd.NextBytes(b);
                DateTimeAppointment app = new DateTimeAppointment(today.AddHours(step + i), today.AddHours(step + step / 2 + i))
                {
                    Color   = new SolidColorBrush(Color.FromArgb(255, b[0], b[1], b[2])),
                    Subject = "App " + i
                };

                if (i % 10 == 0)
                {
                    step++;
                    app.IsAllDay = true;
                }

                newSource.appointments.Add(app);
            }

            this.calendar.AppointmentSource = newSource;
        }
示例#3
0
        private void AddNewAppClicked(object sender, RoutedEventArgs e)
        {
            DateTime            today = DateTime.Now.Date;
            DateTimeAppointment app   = new DateTimeAppointment(today.AddHours(1), today.AddHours(4))
            {
                Color = new SolidColorBrush(Colors.Pink), Subject = "App 0"
            };

            this.vm.Appointments.AllAppointments.Add(app);
        }
示例#4
0
        private void ChangeAppPropertyClicked(object sender, RoutedEventArgs e)
        {
            DateTimeAppointment app = (DateTimeAppointment)this.vm.Appointments.AllAppointments[0];

            app.Color     = new SolidColorBrush(Colors.Wheat);
            app.Subject   = "Changed subject";
            app.StartDate = app.StartDate.AddDays(1);

            app           = (DateTimeAppointment)this.vm.Appointments.AllAppointments[2];
            app.Color     = new SolidColorBrush(Colors.Brown);
            app.Subject   = "Changed subject 2";
            app.StartDate = app.StartDate.AddDays(-1);
        }
示例#5
0
        private void OnAppointmentTapCommandExecuted(object obj)
        {
            this.currentTappedAppointment = (DateTimeAppointment)obj;
            if (this.shouldDeleteTappedAppointment)
            {
                this.Appointments.AllAppointments.Remove(this.currentTappedAppointment);
                this.shouldDeleteTappedAppointment = false;
            }
            else
            {
                this.Subject     = this.currentTappedAppointment.Subject;
                this.Description = this.currentTappedAppointment.Description;
                this.IsAllDay    = this.currentTappedAppointment.IsAllDay;
                this.StartDate   = this.currentTappedAppointment.StartDate;
                this.EndDate     = this.currentTappedAppointment.EndDate;

                this.AppointmentUIContent = MultiDayViewAppointmentsCRUDViewModel.DefaultEditText;
                this.IsOpen = true;
            }
        }