using InABox.Wpf; using System; using System.Windows; namespace InABox.WPF { /// /// Interaction logic for DateEdit.xaml /// public partial class TimeEdit : ThemableWindow { public TimeEdit(string title, TimeSpan value) { InitializeComponent(); Title = title; Value = value; } public TimeSpan Value { get => Editor.Value.HasValue ? Editor.Value.Value.TimeOfDay : new TimeSpan(); set => Editor.Value = DateTime.MinValue.Add(value); } private void OK_Click(object sender, RoutedEventArgs e) { DialogResult = true; Close(); } private void Cancel_Click(object sender, RoutedEventArgs e) { DialogResult = false; Close(); } public static bool Execute(string title, ref TimeSpan value) { var edit = new TimeEdit(title, value); if (edit.ShowDialog() == true) { value = edit.Value; return true; } return false; } } }