private void GuiButtonPause_OnClick(object sender, RoutedEventArgs e) { GuiPauseAddTimeMenuPopup.IsOpen = false; Button btn = sender as Button; if (btn == null) { return; } string strPauseTimeSec = btn.Tag as string; if (string.IsNullOrEmpty(strPauseTimeSec)) { strPauseTimeSec = "0"; } if (double.TryParse(strPauseTimeSec, out var pauseSec) == false) { return; } if (pauseSec < 1) { if (TimeIntervalDialog.ShowInputTimeIntervalDialog(out pauseSec, App.Current.MainWindow) == false) { return; } ViewModel.MainViewModel.SetPauseTime(pauseSec); return; } ViewModel.MainViewModel.AddPauseTime(pauseSec); }
public static bool ShowInputTimeIntervalDialog(out double retIntervalSeconds, Window owner = null, string descriptionText = null) { retIntervalSeconds = 0; var dlg = new TimeIntervalDialog(); if (string.IsNullOrEmpty(descriptionText) == false) { dlg.GuiTextBlockTextDescription.Text = descriptionText; } if (owner != null) { dlg.Owner = owner; } if (dlg.ShowDialog() == true) { retIntervalSeconds = dlg.__ResultInSeconds; return(true); } return(false); }