/// <summary> /// Inherited code: Requires comment. /// </summary> /// <param name="cal">Inherited code: Requires comment 1.</param> /// <param name="value">Inherited code: Requires comment 2.</param> /// <returns>Inherited code: Requires comment 3.</returns> private static bool IsValidKeyboardSelection(GlobalCalendar cal, object value) { if (value == null) { return true; } else { if (cal.BlackoutDates.Contains((DateTime)value)) { return false; } else { return cal.Info.Compare((DateTime)value, cal.DisplayDateRangeStart) >= 0 && cal.Info.Compare((DateTime)value, cal.DisplayDateRangeEnd) <= 0; } } }
/// <summary> /// Inherited code: Requires comment. /// </summary> /// <param name="cal">Inherited code: Requires comment 1.</param> /// <param name="value">Inherited code: Requires comment 2.</param> /// <returns>Inherited code: Requires comment 3.</returns> internal static bool IsValidDateSelection(GlobalCalendar cal, object value) { if (value == null) { return true; } else if (cal.BlackoutDates.Contains((DateTime)value)) { return false; } else if (cal.Info.Compare((DateTime)value, cal.DisplayDateRangeStart) < 0) { cal.SetValueNoCallback(GlobalCalendar.DisplayDateStartProperty, value); } else if (cal.Info.Compare((DateTime)value, cal.DisplayDateRangeEnd) > 0) { cal.SetValueNoCallback(GlobalCalendar.DisplayDateEndProperty, value); } return true; }
/// <summary> /// Raise an automation peer event for the selection of a day button. /// </summary> /// <param name="calendar"> /// The GlobalCalendar associated with this automation peer. /// </param> /// <param name="date">The selected date.</param> /// <param name="eventToRaise">The selection event to raise.</param> private static void RaiseDayButtonSelectionEvent(GlobalCalendar calendar, DateTime date, AutomationEvents eventToRaise) { GlobalCalendarDayButton button = calendar.FindDayButtonFromDay(date); if (button != null) { AutomationPeer peer = FrameworkElementAutomationPeer.FromElement(button); if (peer != null) { peer.RaiseAutomationEvent(eventToRaise); } } }
/// <summary> /// Inherited code: Requires comment. /// </summary> /// <param name="cal">Inherited code: Requires comment 1.</param> /// <returns>Inherited code: Requires comment 2.</returns> private static DateTime? SelectedDateMax(GlobalCalendar cal) { DateTime selectedDateMax; if (cal.SelectedDates.Count > 0) { selectedDateMax = cal.SelectedDates[0]; Debug.Assert(cal.Info.Compare(cal.SelectedDate.Value, selectedDateMax) == 0, "The SelectedDate should be the maximum SelectedDate!"); } else { return null; } foreach (DateTime selectedDate in cal.SelectedDates) { if (cal.Info.Compare(selectedDate, selectedDateMax) > 0) { selectedDateMax = selectedDate; } } return selectedDateMax; }
/// <summary> /// Initializes a new instance of the /// <see cref="T:System.Windows.Automation.Peers.GlobalCalendarAutomationPeer" /> /// class. /// </summary> /// <param name="owner"> /// The <see cref="T:System.Windows.Controls.GlobalCalendar" /> instance to /// associate with the /// <see cref="T:System.Windows.Automation.Peers.GlobalCalendarAutomationPeer" />. /// </param> public GlobalCalendarAutomationPeer(GlobalCalendar owner) : base(owner) { }