MovablePython.Hotkey.GetCanRegister C# (CSharp) Method

GetCanRegister() public method

public GetCanRegister ( Control windowControl ) : bool
windowControl Control
return bool
        public bool GetCanRegister(Control windowControl)
        {
            // Handle any exceptions: they mean "no, you can't register" :)
            try
            {
                // Attempt to register
                if (!this.Register(windowControl))
                { return false; }

                // Unregister and say we managed it
                this.Unregister();
                return true;
            }
            catch (Win32Exception)
            { return false; }
            catch (NotSupportedException)
            { return false; }
        }

Usage Example

Esempio n. 1
0
        internal SUApplicationContext()
        {
            // только создаем форму, она все равно нужна
            // чтобы слушать хоткеи
            form = new Form();

            // создаем и регистрируем глобайльный хоткей
            hk = new Hotkey(Keys.A, false, false, false, true);
            hk.Pressed += delegate { SendSwitchCommand(); };
            if (hk.GetCanRegister(form))
            hk.Register(form);

            // Вешаем событие на выход
            Application.ApplicationExit += Application_ApplicationExit;
        }
All Usage Examples Of MovablePython.Hotkey::GetCanRegister