Esempio n. 1
0
        /// <summary>
        /// Handler to save WinLIRC.NET XML formatted configuration file
        /// </summary>
        /// <param name="sender">Object which raised the event</param>
        /// <param name="e">Event arguments</param>
        private void Save(object sender, EventArgs e)
        {
            try
            {
                SaveFileDialog d = new SaveFileDialog();
                d.AddExtension     = true;
                d.CheckFileExists  = false;
                d.CheckPathExists  = true;
                d.RestoreDirectory = true;
                d.Title            = "Select XML WinLIRC configuration file to save";
                d.ValidateNames    = true;
                d.Filter           = "XML Files|*.xml";
                d.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);

                if (d.ShowDialog() == DialogResult.OK)
                {
                    Invalidate();

                    if (_file != null && _config != null)
                    {
                        _file.Write(new FileInfo(d.FileName), _config);

                        MessageBox.Show("Operation successfully completed!");
                    }
                }
            }
            catch (Exception err)
            {
                Program.HandleException(err);
            }
        }
Esempio n. 2
0
 public void Save()
 {
     ConfigurationSource.Write(this);
 }