Example #1
0
        public static bool RegisterHotkey(LauncherHotkey hotkey, Key key, bool alt, bool ctrl)
        {
            ModifierKeys modifierKey = ModifierKeys.None;

            if (alt)
            {
                modifierKey = modifierKey == ModifierKeys.None ? ModifierKeys.Alt : modifierKey | ModifierKeys.Alt;
            }

            if (ctrl)
            {
                modifierKey = modifierKey == ModifierKeys.None ? ModifierKeys.Control : modifierKey | ModifierKeys.Control;
            }

            return(hotkey.Register(modifierKey, key));
        }
        public MainWindow()
        {
            InitializeComponent();

            SettingWindow = new SettingWindow(this)
            {
                Visibility = Visibility.Hidden
            };

            Hotkey = new LauncherHotkey(this);

            RegisterHotkey();

            Keyword.Focus();

            ReservedKey = new ReservedKey(this);
        }