Пример #1
0
        private void importButton_Button_Pressed(object sender, EventArgs e)
        {
            DialogResult firstResult = MessageBox.Show("Would you like to save your current settings before importing new settings?   ", "Save current settings first?", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);

            if (firstResult == DialogResult.Cancel)
            {
                return;
            }
            if (firstResult == DialogResult.Yes)
            {
                saveFileDialog1.FileName = "currentsettings" + DateTime.Now.Year + DateTime.Now.Month.ToString().PadLeft(2, '0') + DateTime.Now.Day.ToString().PadLeft(2, '0') + ".config";
                DialogResult resultSave = saveFileDialog1.ShowDialog();
                if (resultSave == DialogResult.OK)
                {
                    MetaTemplate_UserSettings.Export_Settings(saveFileDialog1.FileName);
                }
                else
                {
                    return;
                }
            }

            // Now open the settings
            DialogResult result = openFileDialog1.ShowDialog();

            if (result == DialogResult.OK)
            {
                MetaTemplate_UserSettings.Import_Settings(openFileDialog1.FileName);
            }
        }
Пример #2
0
        private void exportButton_Button_Pressed(object sender, EventArgs e)
        {
            saveFileDialog1.FileName = "currentsettings" + DateTime.Now.Year + DateTime.Now.Month.ToString().PadLeft(2, '0') + DateTime.Now.Day.ToString().PadLeft(2, '0') + ".config";
            DialogResult result = saveFileDialog1.ShowDialog();

            if (result == DialogResult.OK)
            {
                MetaTemplate_UserSettings.Export_Settings(saveFileDialog1.FileName);
            }
        }