Esempio n. 1
0
        private void PopulatePresets()
        {
            try
            {
                P = Presets.LoadFromXml();

                this.comboSelectPreset.DataSource    = null;
                this.comboSelectPreset.DataSource    = P;
                this.comboSelectPreset.DisplayMember = "Name";
                this.comboSelectPreset.ValueMember   = "Position";
            }
            catch
            {
            }
        }
Esempio n. 2
0
        public void SaveToXml()
        {
            try
            {
                Presets.CheckFilePaths();

                XmlSerializer serializer = new XmlSerializer(typeof(Presets));

                TextWriter writer = new StreamWriter(xmlLocation);
                serializer.Serialize(writer, this);
                writer.Close();
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.ToString());
            }
        }
Esempio n. 3
0
        public static Presets LoadFromXml()
        {
            try
            {
                Presets.CheckFilePaths();

                TextReader reader = new StreamReader(xmlLocation);

                XmlSerializer serializer = new XmlSerializer(typeof(Presets));

                Presets p = (Presets)serializer.Deserialize(reader);

                reader.Close();

                return(p);
            }
            catch
            {
                return(new Presets());
            }
        }