Example #1
0
File: MyXml.cs Project: VicBoss/KR
        public static void saveSettings(Settings settings, String fileName)
        {
            XmlDocument xmlDoc = new XmlDocument();
            XmlElement optionsXmlEl = xmlDoc.CreateElement("settings");
            
            XmlElement childXmlEl = xmlDoc.CreateElement("windowSize");

            xmlDoc.AppendChild(optionsXmlEl);
            optionsXmlEl.AppendChild(childXmlEl);
            childXmlEl.SetAttribute("width", settings.windowSize.Width.
                ToString());
            childXmlEl.SetAttribute("height", settings.windowSize.Height.
                ToString());

            childXmlEl = xmlDoc.CreateElement("windowLocation");
            optionsXmlEl.AppendChild(childXmlEl);
            childXmlEl.SetAttribute("x", settings.windowLocation.X.
                ToString());
            childXmlEl.SetAttribute("y", settings.windowLocation.Y.
                ToString());

            childXmlEl = xmlDoc.CreateElement("treeViewSettings");
            optionsXmlEl.AppendChild(childXmlEl);
            childXmlEl.SetAttribute("idColumnWidth", 
                settings.idColumnWidth.ToString());
            childXmlEl.SetAttribute("linkColumnWidth", 
                settings.linkColumnWidth.ToString());

            xmlDoc.Save(fileName);
        }
Example #2
0
File: GUI.cs Project: VicBoss/KR
        private void GUI_FormClosing(object sender, FormClosingEventArgs e)
        {
            Settings settings = new Settings(idColumn.Width, linkColumn.Width,
                this.Size, this.Location);

            if (this.WindowState == FormWindowState.Minimized)
            {
                settings.windowSize = this.RestoreBounds.Size;
                settings.windowLocation = this.RestoreBounds.Location;
            }
            MyXml.saveSettings(settings, "settings.xml");
        }