示例#1
0
        private void LoadShortcutsFromFile(string filePath)
        {
            if (filePath != null && System.IO.File.Exists(filePath))
            {
                KeyboardShortcuts_Settings shortCuts = KeyboardShortcuts_Settings.GetKeyboardShortcuts_SettingsFromFile(filePath);
                List <string> descriptions           = new List <string>();
                descriptions.AddRange(m_Form.KeyboardShortcuts.KeyboardShortcutsDescription.Keys);

                foreach (string desc in descriptions)
                {
                    if (shortCuts.KeyboardShortcutsDescription.ContainsKey(desc))
                    {
                        m_Form.KeyboardShortcuts.KeyboardShortcutsDescription[desc].Value = shortCuts.KeyboardShortcutsDescription[desc].Value;
                    }
                }
                descriptions.Clear();
                descriptions.AddRange(m_Form.KeyboardShortcuts.MenuNameDictionary.Keys);

                foreach (string desc in descriptions)
                {
                    if (shortCuts.MenuNameDictionary.ContainsKey(desc))
                    {
                        m_Form.KeyboardShortcuts.MenuNameDictionary[desc].Value = shortCuts.MenuNameDictionary[desc].Value;
                    }
                }
                m_Form.KeyboardShortcuts.SaveSettings();
                m_Form.InitializeKeyboardShortcuts(false);

                m_Form.KeyboardShortcuts.SettingsName = System.IO.Path.GetFileNameWithoutExtension(filePath);
            }
        }