Example #1
0
        private void SaveSettings()
        {
            XmlSerializer xmlSer = new XmlSerializer(typeof(XmlMainSettings));

            using (FileStream fs = new FileStream("MainSettings.xml", FileMode.Truncate))
            {
                XmlMainSettings xms = new XmlMainSettings(Density, Viscosity, VapourPressure, Diameter,
                                                          LengthPipeline, Thickness, Roughness, MaxPressure, EndPressure,
                                                          EndHighMark, ZXMarks, Stations);
                xmlSer.Serialize(fs, xms);
            }
        }
Example #2
0
        private void LoadSettings()
        {
            XmlSerializer xmlSer = new XmlSerializer(typeof(XmlMainSettings));

            using (FileStream fs = new FileStream("MainSettings.xml", FileMode.OpenOrCreate))
            {
                XmlMainSettings XmlMainSettings = (XmlMainSettings)xmlSer.Deserialize(fs);
                txtBoxDens.Text        = XmlMainSettings.Density.ToString();
                txtBoxViscos.Text      = XmlMainSettings.Viscosity.ToString();
                txtBoxVapourPres.Text  = XmlMainSettings.VapourPressure.ToString();
                txtBoxDiameter.Text    = XmlMainSettings.Diameter.ToString();
                txtBoxLength.Text      = XmlMainSettings.Length.ToString();
                txtBoxThickness.Text   = XmlMainSettings.Thickness.ToString();
                txtBoxRoughness.Text   = XmlMainSettings.Roughness.ToString();
                txtBoxMaxPressure.Text = XmlMainSettings.MaxPressure.ToString();
                txtBoxEndPressure.Text = XmlMainSettings.EndPressure.ToString();
                txtBoxEndHigh.Text     = XmlMainSettings.EndHigh.ToString();
                ZXMarks  = XmlMainSettings.ListMarks;
                Stations = XmlMainSettings.ListStations;
            }
        }