/// <summary> /// set change in form /// </summary> private Ini.CWhatIsChange SetChange() { try { Ini.CWhatIsChange change = new Ini.CWhatIsChange(); change.Configuration = listBoxConf.SelectedItem.ToString(); change.FullFileName = listBoxFiles.SelectedItem.ToString(); change.Section = GetRealSectionFromForm(); change.Key = listViewInI.SelectedItems[0].SubItems[1].Text; change.Value = listViewInI.SelectedItems[0].SubItems[2].Text; change.Description = listViewInI.SelectedItems[0].SubItems[3].Text; change.RunExeName = textBoxRunExeName.Text; change.ModifiedSection = textBoxSection.Text; change.ModifiedKey = textBoxKey.Text; change.ModifiedValue = textBoxValue.Text; change.ModifiedDescription = textBoxDescription.Text; return(change); } catch (Exception) { return(null); } }
private void buttonSaveCurrent_Click(object sender, EventArgs e) { Ini.CWhatIsChange change = SetChange(); if (change != null) { int conf, fil, str; conf = listBoxConf.SelectedIndex; fil = listBoxFiles.SelectedIndex; str = listViewInI.SelectedItems[0].Index; try { AllConfigurations = Ini.ChangeInConfigurations(change, AllConfigurations); Ini.SeaveConfigurationsToXml(AllConfigurations, ConfigPath); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } SaveDataToFile(); UpdateForm(ConfigPath, conf, fil, str); } else { MessageBox.Show("Error search changes"); } }