public EditHotKey(
            IApplicationWindow applicationWindow,
            IHotKeySettings settings,
            IEventAggregator eventAggregator)
        {
            this.applicationWindow = applicationWindow;
            this.settings          = settings;
            this.eventAggregator   = eventAggregator;

            this.Id      = 104;
            this.Header  = "Edit Shortcuts";
            this.Command = new DelegateCommand(this.OnEdit);
        }
Exemplo n.º 2
0
        private void SetUpHotKeyService(
            IApplicationWindow applicationWindow,
            HotKeyService service,
            IHotKeySettings settings)
        {
            var isEnabled = settings.GetIsHotKeyEnabled();
            var modifiers = settings.GetModifier();
            var keys      = settings.GetKeys();

            service.Add(BringToFocusEventName, modifiers, keys, () => this.BringToFocus(applicationWindow));
            if (isEnabled)
            {
                service.Start();
            }
        }
        public HotKeyConfigurationViewModel(
            IHotKeySettings settings,
            IEventAggregator eventAggregator)
        {
            this.settings        = settings;
            this.eventAggregator = eventAggregator;

            var modifiers = new List <ModifierKeys>();

            modifiers.Add(ModifierKeys.Control);
            modifiers.Add(ModifierKeys.Alt);
            modifiers.Add(ModifierKeys.Control | ModifierKeys.Shift);
            modifiers.Add(ModifierKeys.Alt | ModifierKeys.Shift);
            modifiers.Add(ModifierKeys.Control | ModifierKeys.Alt);

            this.Modifiers = CollectionViewSource.GetDefaultView(modifiers);

            this.CancelCommand = new DelegateCommand(this.OnRequestClose);
            this.SaveCommand   = new DelegateCommand(this.OnSave);
        }