private void monthView_OnOpenDetailsEvent(object sender, EventArgs e) { if (calendarDisplayMode != CalendarMode.Day) { calendarDisplayMode = CalendarMode.Day; dayButton.IsChecked = true; UpdateRibbon(); MonthDay _sender = (MonthDay)sender; CreateDayView(); dayView.Month = _sender.Date.Month; dayView.Year = _sender.Date.Year; dayView.Day = _sender.Date.Day; dayView.UpdateDisplay(); if (Settings.AnimationsEnabled) { AnimationHelpers.ZoomDisplay anim = new AnimationHelpers.ZoomDisplay(monthView, dayView); anim.SwitchViews(AnimationHelpers.ZoomDirection.In); } else { dayView.Visibility = Visibility.Visible; monthView.Visibility = Visibility.Hidden; } } }
private void DayGoToDate(DateTime date) { if (calendarDisplayMode != CalendarMode.Day) { CreateDayView(); if (calendarDisplayMode == CalendarMode.Month) { calendarDisplayMode = CalendarMode.Day; UpdateRibbon(); monthView.SaveAndClose(); dayView.Month = date.Month; dayView.Year = date.Year; dayView.Day = date.Day; dayView.UpdateDisplay(); if (Settings.AnimationsEnabled) { AnimationHelpers.ZoomDisplay anim = new AnimationHelpers.ZoomDisplay(monthView, dayView); anim.OnAnimationCompletedEvent += monthViewUnloadAnimation_Completed; anim.SwitchViews(AnimationHelpers.ZoomDirection.In); } else { dayView.Visibility = Visibility.Visible; monthView.Visibility = Visibility.Collapsed; } } else if (calendarDisplayMode == CalendarMode.Week) { calendarDisplayMode = CalendarMode.Day; UpdateRibbon(); weekView.EndEdit(); dayView.Month = date.Month; dayView.Year = date.Year; dayView.Day = date.Day; dayView.UpdateDisplay(); if (Settings.AnimationsEnabled) { AnimationHelpers.ZoomDisplay anim = new AnimationHelpers.ZoomDisplay(weekView, dayView); anim.OnAnimationCompletedEvent += weekViewUnloadAnimation_Completed; anim.SwitchViews(AnimationHelpers.ZoomDirection.In); } else { dayView.Visibility = Visibility.Visible; weekView.Visibility = Visibility.Collapsed; } } } else { dayView.GoTo(date); } }
private void weekButton_Checked(object sender, RoutedEventArgs e) { if (calendarDisplayMode != CalendarMode.Week) { CreateWeekView(); if (calendarDisplayMode == CalendarMode.Month) { calendarDisplayMode = CalendarMode.Week; UpdateRibbon(); monthView.SaveAndClose(); weekView.Month = monthView.Selected.Date.Month; weekView.Day = monthView.Selected.Date.Day; weekView.Year = monthView.Selected.Date.Year; weekView.UpdateDisplay(false); weekView.HighlightDay(monthView.Selected.Date); if (Settings.AnimationsEnabled) { AnimationHelpers.ZoomDisplay anim = new AnimationHelpers.ZoomDisplay(monthView, weekView); anim.OnAnimationCompletedEvent += monthViewUnloadAnimation_Completed; anim.SwitchViews(AnimationHelpers.ZoomDirection.In); } else { weekView.Visibility = Visibility.Visible; monthView.Visibility = Visibility.Collapsed; } } else if (calendarDisplayMode == CalendarMode.Day) { calendarDisplayMode = CalendarMode.Week; UpdateRibbon(); dayView.EndEdit(); weekView.Month = dayView.Month; weekView.Day = dayView.Day; weekView.Year = dayView.Year; weekView.UpdateDisplay(false); weekView.HighlightDay(new DateTime(dayView.Year, dayView.Month, dayView.Day)); if (Settings.AnimationsEnabled) { AnimationHelpers.ZoomDisplay anim = new AnimationHelpers.ZoomDisplay(dayView, weekView); anim.OnAnimationCompletedEvent += dayViewUnloadAnimation_Completed; anim.SwitchViews(AnimationHelpers.ZoomDirection.Out); } else { weekView.Visibility = Visibility.Visible; dayView.Visibility = Visibility.Collapsed; } } } }
private void next7Days_Click(object sender, RoutedEventArgs e) { CalendarMode _d = calendarDisplayMode; calendarDisplayMode = CalendarMode.Week; weekButton.IsChecked = true; CreateWeekView(); UpdateRibbon(); DateTime nextWeek = DateTime.Now.AddDays(7); weekView.GoTo(nextWeek); if (_d == CalendarMode.Month) { monthView.SaveAndClose(); if (Settings.AnimationsEnabled) { AnimationHelpers.ZoomDisplay anim = new AnimationHelpers.ZoomDisplay(monthView, weekView); anim.SwitchViews(AnimationHelpers.ZoomDirection.In); } else { weekView.Visibility = Visibility.Visible; monthView.Visibility = Visibility.Hidden; } } else if (_d == CalendarMode.Day) { dayView.EndEdit(); if (Settings.AnimationsEnabled) { AnimationHelpers.ZoomDisplay anim = new AnimationHelpers.ZoomDisplay(dayView, weekView); anim.SwitchViews(AnimationHelpers.ZoomDirection.Out); } else { weekView.Visibility = Visibility.Visible; dayView.Visibility = Visibility.Hidden; } } }
private void AppointmentEditor_Loaded(object sender, RoutedEventArgs e) { if (Settings.AnimationsEnabled) { AnimationHelpers.ZoomDisplay zoom = new AnimationHelpers.ZoomDisplay(_crossZoom, this); zoom.OnAnimationCompletedEvent += (obj, args) => { editSubject.Focus(); }; zoom.SwitchViews(AnimationHelpers.ZoomDirection.In); } else { Visibility = Visibility.Visible; _crossZoom.Visibility = Visibility.Collapsed; UpdateLayout(); editSubject.Focus(); } new ContextTextFormatter(editDetails); }
public void Delete() { if (closeButton.IsEnabled == false) { return; } closeButton.IsEnabled = false; if (Settings.AnimationsEnabled) { AnimationHelpers.ZoomDisplay zoomDelete = new AnimationHelpers.ZoomDisplay(this, _crossZoom); zoomDelete.OnAnimationCompletedEvent += zoomDelete_OnAnimationCompletedEvent; zoomDelete.SwitchViews(AnimationHelpers.ZoomDirection.Out); } else { _crossZoom.Visibility = Visibility.Visible; Visibility = Visibility.Collapsed; AppointmentDatabase.Delete(_appointment); ReminderQueue.RemoveItem(_appointment.ID, _appointment.IsRepeating ? _appointment.RepresentingDate.Add(_appointment.StartDate.TimeOfDay) : _appointment.StartDate, ReminderType.Appointment); CancelEditEvent(EventArgs.Empty); } }
public void CancelEdit() { if (closeButton.IsEnabled == false) { return; } _appointment = new Appointment(_uneditedAppointment); closeButton.IsEnabled = false; if (Settings.AnimationsEnabled) { AnimationHelpers.ZoomDisplay zoomCancel = new AnimationHelpers.ZoomDisplay(this, _crossZoom); zoomCancel.OnAnimationCompletedEvent += zoomCancel_OnAnimationCompletedEvent; zoomCancel.SwitchViews(AnimationHelpers.ZoomDirection.Out); } else { _crossZoom.Visibility = Visibility.Visible; Visibility = Visibility.Collapsed; CancelEditEvent(EventArgs.Empty); } }
public async Task EndEdit(bool animate) { if (closeButton.IsEnabled == false) { return; } if (!IsRecurrenceRangeValid()) { new TaskDialog(Window.GetWindow(this), "Validation Check Failed", "The duration of the appointment must be shorter than the recurrence frequency.", MessageType.Error, false).ShowDialog(); return; } closeButton.IsEnabled = false; if (editStartDate.IsKeyboardFocusWithin) { DateTime start; if (DateTime.TryParse(editStartDate.Text, out start)) { editStartDate.SelectedDate = start; } } if (editEndDate.IsKeyboardFocusWithin) { DateTime end; if (DateTime.TryParse(editEndDate.Text, out end)) { editEndDate.SelectedDate = end; } } if (calendarSelector.SelectedIndex > 0) { PersistentGoogleCalendar gCal = (PersistentGoogleCalendar)((FrameworkElement)calendarSelector.SelectedItem).Tag; _appointment.CalendarUrl = gCal.Url; _appointment.Owner = gCal.Owner; _appointment.Sync = true; } else { _appointment.CalendarUrl = _appointment.Owner = ""; //if (calendarSelector.SelectedIndex == 0) _appointment.Sync = false; } _appointment.Subject = editSubject.Text; _appointment.Location = editLocation.Text; _appointment.StartDate = editStartDate.SelectedDate.Value.Add(TimeSpan.Parse(editStartTime.TextDisplay)); DateTime endDate = editEndDate.SelectedDate.Value.Add(TimeSpan.Parse(editEndTime.TextDisplay)); if (allDayEvent.IsChecked == true) { endDate = endDate.AddDays(1); } _appointment.EndDate = endDate; _appointment.AllDay = (bool)allDayEvent.IsChecked; TimeSpan?reminder = editReminder.SelectedTime; _appointment.Reminder = reminder.HasValue ? reminder.Value : TimeSpan.FromSeconds(-1); if (editDetails.HasContentChanged) { await _appointment.SetDetailsDocumentAsync(editDetails.Document); } _appointment.LastModified = DateTime.UtcNow; Appointment exception = AppointmentDatabase.UpdateAppointment(_appointment); if (exception != null) { _appointment.CopyFrom(exception); } ReminderQueue.Populate(); if (animate && Settings.AnimationsEnabled) { AnimationHelpers.ZoomDisplay zoomEnd = new AnimationHelpers.ZoomDisplay(this, _crossZoom); zoomEnd.OnAnimationCompletedEvent += zoomEnd_OnAnimationCompletedEvent; zoomEnd.SwitchViews(AnimationHelpers.ZoomDirection.Out); } else { _crossZoom.Visibility = Visibility.Visible; Visibility = Visibility.Collapsed; EndEditEvent(EventArgs.Empty); } }
private void monthButton_Checked(object sender, RoutedEventArgs e) { if (calendarDisplayMode != CalendarMode.Month) { CreateMonthView(); if (calendarDisplayMode == CalendarMode.Day) { calendarDisplayMode = CalendarMode.Month; UpdateRibbon(); dayView.EndEdit(); monthView.Month = dayView.Month; monthView.Year = dayView.Year; if (!monthView.IsLoaded) { monthView.Loaded += (obj, args) => { monthView.UpdateDisplay(false); monthView.HighlightDay(dayView.Day); }; } else { monthView.UpdateDisplay(false); monthView.HighlightDay(dayView.Day); } if (Settings.AnimationsEnabled) { AnimationHelpers.ZoomDisplay anim = new AnimationHelpers.ZoomDisplay(dayView, monthView); anim.OnAnimationCompletedEvent += dayViewUnloadAnimation_Completed; anim.SwitchViews(AnimationHelpers.ZoomDirection.Out); } else { monthView.Visibility = Visibility.Visible; dayView.Visibility = Visibility.Collapsed; } } else if (calendarDisplayMode == CalendarMode.Week) { calendarDisplayMode = CalendarMode.Month; UpdateRibbon(); weekView.EndEdit(); DateTime weekViewChecked = weekView.CheckedDate; monthView.Month = weekViewChecked.Month; monthView.Year = weekViewChecked.Year; if (!monthView.IsLoaded) { monthView.Loaded += (obj, args) => { monthView.UpdateDisplay(false); monthView.HighlightDay(weekViewChecked.Day); }; } else { monthView.UpdateDisplay(false); monthView.HighlightDay(weekViewChecked.Day); } if (Settings.AnimationsEnabled) { AnimationHelpers.ZoomDisplay anim = new AnimationHelpers.ZoomDisplay(weekView, monthView); anim.OnAnimationCompletedEvent += weekViewUnloadAnimation_Completed; anim.SwitchViews(AnimationHelpers.ZoomDirection.Out); } else { monthView.Visibility = Visibility.Visible; weekView.Visibility = Visibility.Collapsed; } } } }