Exemple #1
0
        private void BtnStopConfigure_Click(object sender, RoutedEventArgs e)
        {
            _service.Unsubscribe();

            // Prompt user to configure the hotkeys.
            _stopRecordingCombination = ConfigureHotkeysView.Prompt("Configure Stop Recording Hotkeys", PROMPT_CONFIGURE_STOP_RECORDING_HOTKEYS, _stopRecordingCombination);

            // Re-register the start/stop key combinations so they can be listened for.
            RegisterHotKeys();
        }
        /// <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());
        }