Beispiel #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);
            }
        }
Beispiel #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();
        }
Beispiel #3
0
        public MainViewModel()
        {
            CloseCommand = new Command(DoCloseCommand);
            NewCommand   = new Command(DoNewCommand);
            DeleteHotKeyBindingCommand = new Command(DoDeleteHotKeyBindingCommand);
            ShowSuggestionsCommand     = new Command(DoShowSuggestionsCommand);
            EditHotKeyBindingCommand   = new Command(DoEditCommand);

            UpdateHotHeyBindings();

            //  When the bindings change in the model, update them in the vm.
            FireKeysApplication.Instance.HotKeyBindings.CollectionChanged += (sender, args) => UpdateHotHeyBindings();

            HotKeyBindings.CollectionChanged += (sender, args) => { IsHotKeyBindingsCollectionEmpty = !HotKeyBindings.Any(); };

            IsHotKeyBindingsCollectionEmpty = HotKeyBindings.Count == 0;
        }