public Period RemoveAbs(Period abs) { if (this < Period.Zero) { return (this.Abs() - abs) * -1; } else { return this - abs; } }
public PeriodItem(PeriodFormat format, Period time) { Display = time.ToString(format); Time = time; }
public bool Equals(Period period) { return period.Hours == this.Hours; }
protected virtual void OnValueChanged(Period? oldValue, Period? newValue) { //TODO: refactor this if (newValue.HasValue && _timeListBox != null) { var items = _timeListBox.ItemsSource; foreach (PeriodItem item in items) { if (item.Time == newValue.Value) { int index = _timeListBox.Items.IndexOf(item); if (_timeListBox.SelectedIndex != index) _timeListBox.SelectedIndex = index; break; } } } RoutedPropertyChangedEventArgs<object> args = new RoutedPropertyChangedEventArgs<object>(oldValue, newValue); args.RoutedEvent = ValueChangedEvent; RaiseEvent(args); }
protected virtual void OnTimeIntervalChanged(Period oldValue, Period newValue) { // TODO: Add your property changed side-effects. Descendants can override as well. UpdateItemsSource(); }
protected new void OnStartTimeChanged(Period oldValue, Period newValue) { // TODO: Add your property changed side-effects. Descendants can override as well. UpdateItemsSource(); }
protected Period OnCoerceStartTime(Period value) { // TODO: Keep the proposed value within the desired range. return value; }