public static void New(this ViewModel viewModel) { var dialog = new ShortcutProperties(); dialog.ShowDialog(); if (string.IsNullOrWhiteSpace(dialog.NewShortcut?.Name) && string.IsNullOrWhiteSpace(dialog.NewShortcut?.ProcessFile.Path)) { return; } if (!File.Exists(dialog.NewShortcut.ProcessFile.Path) && !Directory.Exists(dialog.NewShortcut.ProcessFile.Path) && !LinkHelper.IsHyperlink(dialog.NewShortcut.ProcessFile.Path)) { if (Popup.Show( $"Couldn't find \"{dialog.NewShortcut.ProcessFile.Path}\".\n\n" + "Do you want to add this shortcut anyway?", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.Yes) == MessageBoxResult.No) { return; } } viewModel.Add(dialog.NewShortcut); }
public static void OpenProperties(this ViewModel viewModel, Shortcut shortcut) { var dialog = new ShortcutProperties(shortcut); dialog.ShowDialog(); if (dialog.NewShortcut == null) { return; } viewModel.Settings.Shortcuts[viewModel.Settings.Shortcuts.IndexOf(shortcut)] = dialog.NewShortcut; viewModel.ReloadShortcutHotKey(dialog.NewShortcut); }
public static void New(this ViewModel viewModel) { var dialog = new ShortcutProperties(); dialog.ShowDialog(); if (string.IsNullOrWhiteSpace(dialog.NewShortcut?.Name) && string.IsNullOrWhiteSpace(dialog.NewShortcut?.ProcessFile.Path)) return; if (!File.Exists(dialog.NewShortcut.ProcessFile.Path) && !Directory.Exists(dialog.NewShortcut.ProcessFile.Path) && !LinkHelper.IsHyperlink(dialog.NewShortcut.ProcessFile.Path)) if (Popup.Show( "That path does not exist. Do you want to add this shortcut anyway?", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.Yes) == MessageBoxResult.No) return; viewModel.Add(dialog.NewShortcut); }
public static void OpenProperties(this ViewModel viewModel, Shortcut shortcut) { var dialog = new ShortcutProperties(shortcut); dialog.ShowDialog(); if (dialog.NewShortcut == null) return; viewModel.Settings.Shortcuts[viewModel.Settings.Shortcuts.IndexOf(shortcut)] = dialog.NewShortcut; viewModel.ReloadShortcutHotKey(dialog.NewShortcut); }