private void RemovePalette_Click(object sender, RoutedEventArgs e) { if (ConfirmationWindow.Confirm("Are you sure you would like to remove this palette?") == System.Windows.Forms.DialogResult.Yes) { _palettesService.RemovePalette(_editingPalette); } }
public static System.Windows.Forms.DialogResult Confirm(string text) { ConfirmationWindow window = new ConfirmationWindow(); window.DisplayText.Text = text; window.Owner = GlobalPanels.MainWindow; window.WindowStartupLocation = WindowStartupLocation.CenterOwner; window.ShowDialog(); return(window.Result); }
private void DeleteButton_Click(object sender, RoutedEventArgs e) { IInfo iInfo = (IInfo)((TreeViewItem)WorldTree.SelectedItem).DataContext; if (ConfirmationWindow.Confirm($"Are you sure you want to remove the level {iInfo.Name}?") == System.Windows.Forms.DialogResult.Yes) { if (iInfo is LevelInfo) { _levelService.RemoveLevel((LevelInfo)iInfo); } } }
private void Window_Loaded(object sender, RoutedEventArgs e) { if (_levelService == null) { return; } IEnumerable <FileInfo> residualTempFiles = _levelService.FindTemps(); foreach (FileInfo fileInfo in residualTempFiles) { if (ConfirmationWindow.Confirm($"Unsaved level data {fileInfo.Name}, would you like to swap this out?") == System.Windows.Forms.DialogResult.Yes) { _levelService.SwapTemp(fileInfo); } } _levelService.CleanUpTemps(); }
private void CloseButton_Clicked(object sender, RoutedEventArgs e) { TabItem tabItem = (TabItem)((Button)sender).DataContext; if (TabsOpen.Items.Count > 1) { if (((string)(tabItem.Header)).EndsWith("*")) { if (ConfirmationWindow.Confirm("You have unsaved changes, are you sure you want to close this tab?") == System.Windows.Forms.DialogResult.Yes) { CloseTab(tabItem); } } else { CloseTab(tabItem); } } }