private void buttonOptions_Click(object sender, EventArgs e) { try { FormOptions dialog = new FormOptions(); if (DialogResult.OK == dialog.ShowDialog(this)) { ApplyConfiguration(); } } catch (Exception exception) { FormError.Show(this, null, exception.Message, exception); } }
private void FormBase_FormClosed(object sender, FormClosedEventArgs e) { foreach (ITutorial item in _listTutorials) { try { item.Disconnect(); } catch (Exception exception) { Console.WriteLine("ITutorial Disconnect Exception:" + exception.Message); } } FormOptions.SaveConfigurationToXMLFile(); }
/// <summary> /// Load config file or display options dialog if config file not exists /// </summary> /// <param name="owner">modal owner for dialog</param> public static void LoadConfigurationFromXMLFile(IWin32Window owner) { if (File.Exists(_fullConfigFilePath)) { XmlDocument configDocument = new XmlDocument(); configDocument.Load(_fullConfigFilePath); _lcid = Convert.ToInt32(configDocument.FirstChild.ChildNodes[0].InnerText); _connectToDocumentation = Convert.ToBoolean(configDocument.FirstChild.ChildNodes[1].InnerText); _saveSettings = Convert.ToBoolean(configDocument.FirstChild.ChildNodes[2].InnerText); } else { FormOptions dialog = new FormOptions(); dialog.ShowDialog(owner); } }
public static void LoadConfigurationFromXMLFile(IWin32Window owner) { if (File.Exists(_fullConfigFilePath)) { XmlDocument configDocument = new XmlDocument(); configDocument.Load(_fullConfigFilePath); _lcid = Convert.ToInt32(configDocument.FirstChild.ChildNodes[0].InnerText); _connectToDocumentation = Convert.ToBoolean(configDocument.FirstChild.ChildNodes[1].InnerText); _saveSettings = Convert.ToBoolean(configDocument.FirstChild.ChildNodes[2].InnerText); } else { FormOptions dialog = new FormOptions(); dialog.ShowDialog(owner); } }
public FormBase() { InitializeComponent(); FormOptions.LoadConfigurationFromXMLFile(this); ApplyConfiguration(); }
private void buttonOptions_Click(object sender, EventArgs e) { try { FormOptions dialog = new FormOptions(); if (DialogResult.OK == dialog.ShowDialog(this)) ApplyConfiguration(); } catch(Exception exception) { FormError.Show(this, null, exception.Message, exception); } }