Skip to content

Commit

Permalink
(MahAppsGH-3746) Remove unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
punker76 committed May 3, 2020
1 parent c47d1b2 commit 4771714
Showing 1 changed file with 1 addition and 49 deletions.
50 changes: 1 addition & 49 deletions src/MahApps.Metro/Controls/TimePicker/DateTimePicker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ public class DateTimePicker : TimePickerBase
{
private const string ElementCalendar = "PART_Calendar";
private Calendar _calendar;
private bool _deactivateWriteValueToTextBox;

public static readonly DependencyProperty DisplayDateEndProperty = DatePicker.DisplayDateEndProperty.AddOwner(typeof(DateTimePicker));

Expand Down Expand Up @@ -286,14 +285,6 @@ protected override void OnTextBoxLostFocus(object sender, RoutedEventArgs e)
}
}

protected override void WriteValueToTextBox()
{
if (!_deactivateWriteValueToTextBox)
{
base.WriteValueToTextBox();
}
}

private static object CoerceOrientation(DependencyObject d, object basevalue)
{
if (((DateTimePicker)d).IsClockVisible)
Expand Down Expand Up @@ -331,30 +322,6 @@ private void CalendarSelectedDateChanged(object sender, SelectionChangedEventArg
}
}
}

/*
var dateTimePicker = (DateTimePicker)((Calendar)sender).TemplatedParent;
// Without deactivating changing SelectedTime would callbase.OnSelectedTimeChanged.
// This would write too and this would result in duplicate writing.
// More problematic would be instead that a short amount of time SelectedTime would be as value in TextBox
dateTimePicker._deactivateWriteValueToTextBox = true;
var dt = e.AddedItems.Count > 0 ? (DateTime?)e.AddedItems[0] : default;
if (dt.HasValue)
{
dateTimePicker.SetCurrentValue(SelectedDateTimeProperty, dt.Value.Date + dateTimePicker.GetSelectedTimeFromGUI());
}
else
{
dateTimePicker.SetDefaultTimeOfDayValues();
}
dateTimePicker._deactivateWriteValueToTextBox = false;
dateTimePicker.WriteValueToTextBox();
*/
}

protected override void ClockSelectedTimeChanged(object sender, SelectionChangedEventArgs e)
Expand All @@ -363,8 +330,6 @@ protected override void ClockSelectedTimeChanged(object sender, SelectionChanged
var date = SelectedDateTime ?? DateTime.Today;

this.SetCurrentValue(SelectedDateTimeProperty, date.Date + time);

//SetDatePartValues();
}

protected override void OnSelectedDateTimeChanged(DateTime? oldValue, DateTime? newValue)
Expand All @@ -386,18 +351,5 @@ protected override void OnSelectedDateTimeChanged(DateTime? oldValue, DateTime?

return null;
}

private void SetDatePartValues()
{
var dateTime = GetSelectedDateTimeFromGUI();
if (dateTime != null)
{
this.SetCurrentValue(DisplayDateProperty, dateTime.Value > DateTime.MinValue && dateTime.Value < DateTime.MaxValue ? dateTime.Value : DateTime.Today);
if ((SelectedDateTime != DisplayDate && SelectedDateTime != DateTime.MinValue) || (this._popUp != null && this._popUp.IsOpen))
{
this.SetCurrentValue(SelectedDateTimeProperty, DisplayDate);
}
}
}
}
}
}

0 comments on commit 4771714

Please sign in to comment.