public void SetCommandInConfig(ref CodeTalkConfig config)
        {
            config.GetFunctionsCommandKeyConfig = new CommandKeyConfig(GetFunctionsKeyCombobox.SelectedItem.ToString(),
                                                                       GetFunctionsModifierKeyCombobox.SelectedItem.ToString());

            config.GetSummaryCommandKeyConfig = new CommandKeyConfig(GetSummaryKeyCombobox.SelectedItem.ToString(),
                                                                     GetSummaryModifierKeyCombobox.SelectedItem.ToString());

            config.GetErrorsCommandKeyConfig = new CommandKeyConfig(GetErrorsKeyCombobox.SelectedItem.ToString(),
                                                                    GetErrorsModifierKeyCombobox.SelectedItem.ToString());

            config.SkipCommentCommandKeyConfig = new CommandKeyConfig(SkipCommentKeyCombobox.SelectedItem.ToString(),
                                                                      SkipCommentModifierKeyCombobox.SelectedItem.ToString());

            config.GetContextCommandKeyConfig = new CommandKeyConfig(GetContextKeyCombobox.SelectedItem.ToString(),
                                                                     GetContextModifierKeyCombobox.SelectedItem.ToString());

            config.MoveToContextCommandKeyConfig = new CommandKeyConfig(MoveToContextKeyCombobox.SelectedItem.ToString(),
                                                                        MoveToContextModifierKeyCombobox.SelectedItem.ToString());

            config.CreateBreakpointCommandKeyConfig = new CommandKeyConfig(CreateBreakpointKeyCombobox.SelectedItem.ToString(),
                                                                           CreateBreakpointModifierKeyCombobox.SelectedItem.ToString());

            config.SetProfilepointsCommandKeyConfig = new CommandKeyConfig(SetProfilepointsKeyCombobox.SelectedItem.ToString(),
                                                                           SetProfilepointsModifierKeyCombobox.SelectedItem.ToString());
        }
        private void SubmitButton_Click(object sender, RoutedEventArgs e)
        {
            var config = new CodeTalkConfig();

            config.CodeTalkKey         = CommandConstants.KeyNamesReverseMap[CodeTalkKeyComboBox.SelectedItem.ToString()];
            config.CodeTalkModifierKey = (ModifierKeys)Enum.Parse(typeof(ModifierKeys), CodeTalkModifierKeyComboBox.SelectedItem.ToString());

            SetCommandInConfig(ref config);

            TalkCodePackage.SaveCodeTalkConfig(config);

            CloseFrame();
        }
Ejemplo n.º 3
0
        public static CodeTalkConfig LoadFromXml(string filePath)
        {
            filePath = Path.GetFullPath(filePath);
            CodeTalkConfig config = null;

            using (var fileStream = new FileStream(filePath, FileMode.Open))
            {
                var serializer = new XmlSerializer(typeof(CodeTalkConfig));
                config = serializer.Deserialize(fileStream) as CodeTalkConfig;
                fileStream.Close();
            }
            config.ProcessAndValidate();
            return(config);
        }
Ejemplo n.º 4
0
 public static void SaveCodeTalkConfig(CodeTalkConfig config)
 {
     try
     {
         config.SaveAsXml(CodeTalkConfigPath);
         TalkCodePackage.currentCodeTalkConfig = config;
     }
     catch (Exception ex)    //We have to catch the exception here, or the IDE can crash
     {
         MessageBox.Show($"General exception '{ex.Message}' occurred while saving configuration to file {CodeTalkConfigPath}. Your customizations might be lost.",
                         "Config save failed",
                         MessageBoxButtons.OK);
     }
 }
Ejemplo n.º 5
0
 public void LoadCodeTalkConfig()
 {
     if (File.Exists(CodeTalkConfigPath))
     {
         try
         {
             currentCodeTalkConfig = CodeTalkConfig.LoadFromXml(CodeTalkConfigPath);
         }
         catch (Exception ex)    //We have to catch the exception here, or the IDE can crash
         {
             MessageBox.Show($"Exception '{ex.Message}' occurred while opening file {CodeTalkConfigPath}. Using defaults.", "Config load failed", MessageBoxButtons.OK);
             LoadDefaultCodeTalkConfig();
         }
     }
     else
     {
         SaveDefaultConfig();
         LoadDefaultCodeTalkConfig();
     }
 }
Ejemplo n.º 6
0
 void LoadDefaultCodeTalkConfig()
 {
     currentCodeTalkConfig = CommandConstants.DefualtCodeTalkConfig;            //CodeTalkConfig.LoadFromXml(@".\DefaultCodeTalkConfig.config");
     currentCodeTalkConfig.ProcessAndValidate();
 }