Exemplo n.º 1
0
        /* === 初始化 === */
        private void InitializeHotKey()
        {
            var actions = new Dictionary <string, Action>
            {
                { "StartPlay", TogglePlay },
                { "StopPlay", () => StopPlay(true) },
            };

            try
            {
                foreach (var item in config.HotkeyBindings)
                {
                    Hotkey.Add(item.Key, item.Value, actions[item.Key]);
                }
            }
            catch (Exception)
            {
                MessageBox.Show("快捷键注册失败!");
            }
        }