private void Form1_Load(object sender, System.EventArgs e) { if (System.IO.File.Exists(Application.StartupPath + @"\settings.xml")) { //FormSerialisor.Deserialise(this, Application.StartupPath + @"\settings.xml"); XDocument doc = XDocument.Load(Application.StartupPath + @"\settings.xml"); foreach (var elem in doc.Descendants("Root").Elements()) { if (elem.Name == "Group") { buttonControl btn = addButtonControl(elem.Element("btnName").Value); foreach (var output in elem.Element("outputs").Elements()) { btn.addOutput(output.Element("fileLocation").Value, output.Element("fileContents").Value); } } else if (elem.Name == "alwaysOnTop") { if (elem.Value == "true") { this.TopMost = true; checkBox1.Checked = true; } else { this.TopMost = false; checkBox1.Checked = false; } } else if (elem.Name == "size") { this.Size = new Size(Int32.Parse(elem.Element("width").Value), Int32.Parse(elem.Element("height").Value)); } } } }
private void button1_Click(object sender, EventArgs e) { buttonControl btn = addButtonControl(); btn.addOutput(); }