private ConfigureHotkeysView(ConfigureHotkeysViewModel model, Combination defaultCombination) { _model = model ?? throw new ArgumentNullException(nameof(model)); _defaultCombination = defaultCombination ?? throw new ArgumentNullException(nameof(defaultCombination)); InitializeComponent(); this.DataContext = _model; ResetToDefaultCombination(); }
/// <summary> /// Build and displays a window prompt with the supplied parameters. Returns the selected key combination. /// </summary> /// <param name="promptTitle">The title of the window.</param> /// <param name="promptText">The text that is displayed in the prompt.</param> /// <param name="defaultCombination">The default key combination</param> /// <returns>Returns the selected key combination.</returns> public static Combination Prompt(string promptTitle, string promptText, Combination defaultCombination) { var model = new ConfigureHotkeysViewModel() { Title = promptTitle, PromptText = promptText, KeyCombinationString = defaultCombination.ToString() }; var view = new ConfigureHotkeysView(model, defaultCombination); view.ShowDialog(); // Return the selected combination. return(view.GetSelectedCombination()); }