예제 #1
0
        public void RegisterHotkey()
        {
            if (HotKeyWindow == null)
            {
                HotKeyWindow = new HotKeyNativeWindow(this);
            }

            try
            {
                if (Key != Keys.None)
                {
                    HotKeyWindow.RegisterHotkey();
                }
                else
                {
                    if (HotKeyWindow.Handle != IntPtr.Zero)
                    {
                        HotKeyWindow.DestroyHandle();
                    }
                    HotKeyWindow = null;
                }
            }
            catch
            {
                if (HotKeyWindow.Handle != IntPtr.Zero)
                {
                    HotKeyWindow.DestroyHandle();
                }
                HotKeyWindow = null;
                throw;
            }

            IsRegistered = true;
        }
예제 #2
0
        public bool RegisterHotkey()
        {
            if (HotKeyWindow == null)
            {
                HotKeyWindow = new HotKeyNativeWindow(this);
            }

            try
            {
                if (Key != Keys.None)
                {
                    HotKeyWindow.RegisterHotkey();
                }
                else
                {
                    if (HotKeyWindow.Handle != IntPtr.Zero)
                    {
                        HotKeyWindow.DestroyHandle();
                    }
                    HotKeyWindow = null;
                }

                IsRegistered = true;
            }
            catch
            {
                if (HotKeyWindow.Handle != IntPtr.Zero)
                {
                    HotKeyWindow.DestroyHandle();
                }
                HotKeyWindow = null;

                IsRegistered = false;
            }

            return(IsRegistered);
        }
예제 #3
0
 /// <summary>
 ///   Initializes a new instance of the <see cref="HotKey"/> component.
 /// </summary>
 ///
 public HotKey()
 {
     window = new HotKeyNativeWindow(this);
 }
예제 #4
0
        public void RegisterHotkey()
        {
            if (HotKeyWindow == null)
                HotKeyWindow = new HotKeyNativeWindow(this);

            try
            {
                if (Key != Keys.None)
                {
                    HotKeyWindow.RegisterHotkey();
                }
                else
                {
                    if (HotKeyWindow.Handle != IntPtr.Zero)
                        HotKeyWindow.DestroyHandle();
                    HotKeyWindow = null;
                }
            }
            catch
            {
                if (HotKeyWindow.Handle != IntPtr.Zero)
                    HotKeyWindow.DestroyHandle();
                HotKeyWindow = null;
                throw;
            }

            IsRegistered = true;
        }
예제 #5
0
 /// <summary>
 ///   Initializes a new instance of the <see cref="HotKey"/> component.
 /// </summary>
 /// 
 public HotKey()
 {
     window = new HotKeyNativeWindow(this);
 }
예제 #6
0
        public bool RegisterHotkey()
        {
            if (HotKeyWindow == null)
                HotKeyWindow = new HotKeyNativeWindow(this);

            try
            {
                if (Key != Keys.None)
                {
                    HotKeyWindow.RegisterHotkey();
                }
                else
                {
                    if (HotKeyWindow.Handle != IntPtr.Zero)
                        HotKeyWindow.DestroyHandle();
                    HotKeyWindow = null;
                }

                IsRegistered = true;
            }
            catch
            {
                if (HotKeyWindow.Handle != IntPtr.Zero)
                    HotKeyWindow.DestroyHandle();
                HotKeyWindow = null;

                IsRegistered = false;
            }

            return IsRegistered;
        }