Exemplo n.º 1
0
        public void UpdateHotHeyBindings()
        {
            //  Clear the hotkey bindings.
            HotKeyBindings.Clear();

            //  Add each hotkey binding.
            foreach (var hotKeyBinding in FireKeysApplication.Instance.HotKeyBindings)
            {
                var vm = new HotKeyBindingViewModel();
                vm.FromModel(hotKeyBinding);
                HotKeyBindings.Add(vm);
            }
        }
Exemplo n.º 2
0
        public void ShowSuggestionsWindow(Window parentWindow = null)
        {
            //  Create a suggestions window.
            var suggestionsWindow = new Suggestions.SuggestionsWindow
            {
                Owner = parentWindow
            };

            //  Provide the full set of suggestions...
            suggestionsWindow.Suggestions = this.Suggestions;

            //  Show the window - if not OKd then return.
            if (suggestionsWindow.ShowDialog() != true)
            {
                return;
            }

            //  Otherwise, create a binding for each suggestions.
            foreach (var suggestion in suggestionsWindow.AcceptedSuggestions)
            {
                //  Add each suggestion.
                var binding = new HotKeyBinding
                {
                    DisplayName = suggestion.DisplayName,
                    HotKey      = suggestion.HotKey,
                    IsEnabled   = true,
                    Action      = new ExecuteProgramAction
                    {
                        Program = suggestion.FindValidSuggestionPath()
                    }
                };
                HotKeyBindings.Add(binding);
            }

            SaveSettings();
        }