예제 #1
0
파일: Form1.cs 프로젝트: devvcat/moonlight
        private void RegisterHotkey(string hotkey)
        {
            try
            {
                // Format <modifier> + <key>
                var keys = hotkey.Split(new[] { '+' }, StringSplitOptions.RemoveEmptyEntries);

                var modifier = Hotkey.GetKey(keys[0]);
                var key      = Hotkey.GetKey(keys[1]);

                if (!RegisterHotkey(modifier, key))
                {
                    throw new Exception(
                              string.Format("Fail to register hotkey {0}", hotkey));
                }
            }
            catch (Exception ex)
            {
                // TODO: log the error
            }
        }