private static Signature GetSignature(DateTime signatureDate) { // Try to get name and email try { return(new Signature(Preferences.GitName, Preferences.GitEmail, signatureDate)); } catch (IndexOutOfRangeException) { Application.Current.Dispatcher.Invoke(() => { OptionsWindow optionsWindow = new OptionsWindow(); // Show user input dialog to set name and email MessageBox.Show("Please enter a name and email in the next dialog.", "Name and email required", MessageBoxButton.OK, MessageBoxImage.Information); optionsWindow.ShowDialog(); }); return(GetSignature(signatureDate)); } catch (ArgumentException) { Application.Current.Dispatcher.Invoke(() => { OptionsWindow optionsWindow = new OptionsWindow(); // Show user input dialog to set name and email MessageBox.Show("Please enter a name and email in the next dialog.", "Name and email required", MessageBoxButton.OK, MessageBoxImage.Information); optionsWindow.ShowDialog(); }); return(GetSignature(signatureDate)); } }
private void MenuItem_Click_1(object sender, RoutedEventArgs e) { OptionsWindow optionsWindow = new OptionsWindow(); optionsWindow.ShowDialog(); }