Exemplo n.º 1
0
        public void KeyPressed(object sender, KeyboardHook.KeyPressedEventArgs args)
        {
            if (args.Key == Keys.NumPad8)
            {
                Close();
                return;
            }

            ToggleVisibility();
            FocusInput();
        }
Exemplo n.º 2
0
        public QCmdHostForm(QcmdConfig config)
        {
            _config = config;

            InitializeComponent();

            _hook = new KeyboardHook();
            _hook.KeyPressed += KeyPressed;

            _hook.RegisterHotKey(KeyboardHook.ModifierKeys.Win, Keys.Q);
            _hook.RegisterHotKey(KeyboardHook.ModifierKeys.Control | KeyboardHook.ModifierKeys.Alt, Keys.NumPad8);

            _browser = new BrowserWrapper(config.StartPage);
            _browser.HideCallback = ThreadedHide;
            Controls.Add(_browser.Control);

            Closed += (o, s) => CefSharp.Cef.Shutdown();

            CenterToScreen();
            Location = new Point(Location.X, 0);
        }