private void Unregister()
 {
     if (hotKeyValue != 0)
     {
         HotKeyUtils.UnregisterKey(this, hotKeyValue);
         HotKeyUtils.GlobalDeleteAtom(hotKeyValue);
     }
 }
        private bool Register(string key)
        {
            Unregister();
            if (string.IsNullOrEmpty(key))
            {
                Trace.WriteLine("Could not register empty hotkey.");
                return(false);
            }

            int hotKeyValue = HotKeyUtils.GlobalAddAtom("RE:" + key.ToString());

            if (hotKeyValue == 0)
            {
                Trace.WriteLine("Could not register atom for hotkey " + key);
                return(false);
            }

            return(HotKeyUtils.RegisterKey(this, hotKeyValue, key));
        }