Example #1
0
        public void UpdateShortcuts(AppSettings settings)
        {
            // ================ WINDOW ================
            InputBindings.Clear();
            foreach (var sc in settings.Shortcuts.Where(s => s.Value.Scope == AlephShortcutScope.Window))
            {
                var sckey = sc.Key;
                var cmd   = new RelayCommand(() => ShortcutManager.Execute(this, sckey));
                var ges   = new KeyGesture((Key)sc.Value.Key, (ModifierKeys)sc.Value.Modifiers);
                InputBindings.Add(new InputBinding(cmd, ges));
            }

            // ================ NOTESLIST ================
            NotesViewControl.SetShortcuts(this, settings.Shortcuts.ToList());             // via InputBindings

            // ================ GLOBAL ================
            _scManager.Clear();
            foreach (var sc in settings.Shortcuts.Where(s => s.Value.Scope == AlephShortcutScope.Global))
            {
                _scManager.Register(sc.Value.Modifiers, sc.Value.Key, sc.Key);
            }
        }