private void EditAppointment() { customeEditor.DataContext = null; customeEditor.DataContext = AddDataContext; customeEditor.Visibility = Visibility.Visible; SelectedAppointment = AddDataContext.Appointment as AppointmentWinRT; customeEditor.AddAppType.Visibility = Visibility.Collapsed; customeEditor.AddReminder.Visibility = Visibility.Collapsed; customeEditor.AppType.Visibility = Visibility.Visible; customeEditor.Reminder.Visibility = Visibility.Visible; customeEditor.AddEndTimeMonth.Visibility = Visibility.Collapsed; customeEditor.AddEndTimeTime.Visibility = Visibility.Collapsed; customeEditor.AddStartTimeMonth.Visibility = Visibility.Collapsed; customeEditor.AddStartTimeTime.Visibility = Visibility.Collapsed; customeEditor.EditStartTimeMonth.Visibility = Visibility.Visible; customeEditor.EditStartTimeTime.Visibility = Visibility.Visible; customeEditor.EditEndTimeMonth.Visibility = Visibility.Visible; customeEditor.EditEndTimeTime.Visibility = Visibility.Visible; customeEditor.Delete.Visibility = Visibility.Visible; if (AddDataContext.Appointment != null) { customeEditor.EditStartTimeMonth.Value = (AddDataContext.Appointment as AppointmentWinRT).StartTime; customeEditor.EditStartTimeTime.Value = (AddDataContext.Appointment as AppointmentWinRT).StartTime; customeEditor.EditEndTimeMonth.Value = (AddDataContext.Appointment as AppointmentWinRT).EndTime; customeEditor.EditEndTimeTime.Value = (AddDataContext.Appointment as AppointmentWinRT).EndTime; } customeEditor.Subject.Text = SelectedAppointment.Subject; customeEditor.Notes.Text = SelectedAppointment.Notes; customeEditor.Location.Text = SelectedAppointment.Location; }
void Save_Click(object sender, RoutedEventArgs e) { Visibility = Visibility.Collapsed; AppointmentWinRT app; if (editorPage.SelectedAppointment == null) { app = new AppointmentWinRT(); DateTime date = (DateTime)AddStartTimeTime.Value; app.StartTime = ((DateTime)AddStartTimeMonth.Value).Date.Add(new TimeSpan(date.Hour, date.Minute, date.Second)); app.AppointmentTime = app.StartTime.ToString("hh:mm tt"); DateTime date1 = (DateTime)AddEndTimeTime.Value; app.ReminderTime = (ReminderTimeType)AddReminder.SelectedItem; app.AppointmentType = (AppointmentWinRT.AppointmentTypesWinRT)AddAppType.SelectedItem; app.EndTime = ((DateTime)AddEndTimeMonth.Value).Date.Add(new TimeSpan(date1.Hour, date1.Minute, date1.Second)); app.AppointmentBackground = new SolidColorBrush(Color.FromArgb(0xFF, 0xA2, 0xC1, 0x39)); } else { app = editorPage.SelectedAppointment; DateTime date = (DateTime)EditStartTimeTime.Value; app.ReminderTime = (ReminderTimeType)Reminder.SelectedItem; app.AppointmentType = (AppointmentWinRT.AppointmentTypesWinRT)AppType.SelectedItem; app.StartTime = ((DateTime)EditStartTimeMonth.Value).Date.Add(new TimeSpan(date.Hour, date.Minute, date.Second)); DateTime date1 = (DateTime)EditEndTimeTime.Value; app.EndTime = ((DateTime)EditEndTimeMonth.Value).Date.Add(new TimeSpan(date1.Hour, date1.Minute, date1.Second)); app.AppointmentBackground = new SolidColorBrush(Color.FromArgb(0xFF, 0xA2, 0xC1, 0x39)); app.AppointmentTime = app.StartTime.ToString("hh:mm tt"); } app.Subject = Subject.Text; app.Notes = Notes.Text; app.Location = Location.Text; if (AppType.SelectedItem != null) { app.AppointmentType = (AppointmentWinRT.AppointmentTypesWinRT)AppType.SelectedItem; } else { app.AppointmentType = AppointmentWinRT.AppointmentTypesWinRT.Family; } if (editorPage.SelectedAppointment == null) { editorPage.schedule.Appointments.Add(app); } }
void schedule_ScheduleTapped(object sender, ScheduleTappedEventArgs e) { if (selapp != null) { selapp.AppointmentSelectionBrush = new SolidColorBrush(Colors.Transparent); } if (e.Appointment != null) { (e.Appointment as AppointmentWinRT).AppointmentSelectionBrush = new SolidColorBrush(Colors.Black); selapp = (AppointmentWinRT)e.Appointment; } else { foreach (AppointmentWinRT app in AppointmentCollection) { app.AppointmentSelectionBrush = new SolidColorBrush(Colors.Transparent); } } }
//private void Button_Click_1(object sender, RoutedEventArgs e) //{ // ApplicationLanguages.PrimaryLanguageOverride = "en-US"; // NavigationService.GoBack(); //} void pasteButton_Click(object sender, RoutedEventArgs e) { RadialPopup.IsOpen = false; if (this.copiedAppointment != null) { AppointmentWinRT app = this.copiedAppointment; TimeSpan appTimeDiff = app.EndTime - app.StartTime; AppointmentWinRT appointment = new AppointmentWinRT(); appointment.Subject = app.Subject; appointment.Notes = app.Notes; appointment.Location = app.Location; appointment.ReadOnly = app.ReadOnly; appointment.AppointmentBackground = app.AppointmentBackground; appointment.AppointmentTime = this.CurrentSelectedDate.ToString("hh:mm tt"); appointment.AppointmentType = app.AppointmentType; appointment.StartTime = (DateTime)this.CurrentSelectedDate; appointment.EndTime = ((DateTime)this.CurrentSelectedDate).Add(appTimeDiff); Schedule.Appointments.Add(appointment); } }
private void AddAppointment() { customeEditor.DataContext = null; customeEditor.DataContext = AddDataContext; customeEditor.Visibility = Visibility.Visible; SelectedAppointment = null; customeEditor.AppType.SelectedIndex = 0; customeEditor.AddReminder.SelectedIndex = 0; customeEditor.AddEndTimeMonth.Visibility = Visibility.Visible; customeEditor.AddEndTimeTime.Visibility = Visibility.Visible; customeEditor.AddStartTimeMonth.Visibility = Visibility.Visible; customeEditor.AddStartTimeTime.Visibility = Visibility.Visible; if (AddDataContext.CurrentSelectedDate != null) { customeEditor.AddStartTimeMonth.Value = customeEditor.AddStartTimeTime.Value = AddDataContext.CurrentSelectedDate.Value; customeEditor.AddEndTimeMonth.Value = customeEditor.AddEndTimeTime.Value = AddDataContext.CurrentSelectedDate.Value.AddHours(1); } else if (AddDataContext.Appointment != null) { customeEditor.AddStartTimeMonth.Value = customeEditor.AddEndTimeMonth.Value = ((AddDataContext as BindingClassWinRT).Appointment as AppointmentWinRT).StartTime; customeEditor.AddStartTimeTime.Value = customeEditor.AddEndTimeTime.Value = ((AddDataContext as BindingClassWinRT).Appointment as AppointmentWinRT).StartTime.AddHours(1); } customeEditor.AppType.Visibility = Visibility.Visible; customeEditor.AddReminder.Visibility = Visibility.Visible; customeEditor.AddAppType.Visibility = Visibility.Collapsed; customeEditor.Reminder.Visibility = Visibility.Collapsed; customeEditor.EditStartTimeMonth.Visibility = Visibility.Collapsed; customeEditor.EditStartTimeTime.Visibility = Visibility.Collapsed; customeEditor.EditEndTimeMonth.Visibility = Visibility.Collapsed; customeEditor.EditEndTimeTime.Visibility = Visibility.Collapsed; customeEditor.Delete.Visibility = Visibility.Collapsed; customeEditor.Subject.Text = string.Empty; customeEditor.Notes.Text = string.Empty; customeEditor.Location.Text = string.Empty; }
void copyButton_Click(object sender, RoutedEventArgs e) { RadialPopup.IsOpen = false; copiedAppointment = (AppointmentWinRT)Schedule.SelectedAppointment; }