public frm_main(bool minimode) { InitializeComponent(); mini = new miniNotice(); if (minimode) { minimize(); } if (System.IO.File.Exists(Application.StartupPath + "/config.xml")) { System.Xml.Serialization.XmlSerializer xser = new System.Xml.Serialization.XmlSerializer(typeof(xConfig)); System.Xml.XmlReader xrea = System.Xml.XmlReader.Create(Application.StartupPath + "/config.xml"); xConfig c = (xConfig)xser.Deserialize(xrea); xrea.Close(); c.ToRealConfig(); } else if (System.IO.File.Exists(Application.UserAppDataPath + "/config.xml")) { System.Xml.Serialization.XmlSerializer xser = new System.Xml.Serialization.XmlSerializer(typeof(xConfig)); System.Xml.XmlReader xrea = System.Xml.XmlReader.Create(Application.UserAppDataPath + "/config.xml"); xConfig c = (xConfig)xser.Deserialize(xrea); xrea.Close(); c.ToRealConfig(); } UpdateSyncList(); }
private void frm_main_FormClosing(object sender, FormClosingEventArgs e) { if (e.CloseReason == CloseReason.UserClosing && !minimized && !forceclose) { minimize(); e.Cancel = true; } xConfig c = new xConfig(); System.Xml.Serialization.XmlSerializer xser = new System.Xml.Serialization.XmlSerializer(typeof(xConfig)); System.Xml.XmlWriter xwri = System.Xml.XmlWriter.Create(Application.StartupPath + "\\config.xml"); xser.Serialize(xwri, c); xwri.Close(); }