Exemplo n.º 1
0
        private void сохранитьКакToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SaveFileDialog saveFileDialog1 = new SaveFileDialog();

            saveFileDialog1.InitialDirectory = AppConf.conf.LastSavedConfFile;
            saveFileDialog1.Filter           = "Conf files (*.cnf)|*.cnf| All files (*.*)|*.*";
            saveFileDialog1.FilterIndex      = 1;
            saveFileDialog1.RestoreDirectory = true;

            if (saveFileDialog1.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    AppConf.conf.LastSavedConfFile = saveFileDialog1.FileName;
                    SaveConfClass TempSave = new SaveConfClass(AppConf.conf.LastSavedConfFile);
                    TempSave.conf.CurrentParam = AppConf.conf.CurrentConf;
                    TempSave.Save();
                    this.FormName = "Синхронизация и копирование";
                }
                catch (Exception ex)
                {
                    ErrorWorkProc.ErrorProcess(ex);
                }
            }
            ;
        }
Exemplo n.º 2
0
        private void ToolStripMenuItemNewConf_Click(object sender, EventArgs e)
        {
            SaveConfClass xx = new SaveConfClass("");

            xx.SetDefaultConfiguration();
            AppConf.conf.CurrentConf       = xx.conf.CurrentParam;
            AppConf.conf.LastSavedConfFile = "";
            AppConf.Save();
            InitializeForm();
        }
Exemplo n.º 3
0
        private void открытьToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog1 = new OpenFileDialog();

            openFileDialog1.Filter           = "Conf files (*.cnf)|*.cnf| All files (*.*)|*.*";
            openFileDialog1.FilterIndex      = 1;
            openFileDialog1.CheckFileExists  = true;
            openFileDialog1.CheckPathExists  = true;
            openFileDialog1.RestoreDirectory = true;
            openFileDialog1.InitialDirectory = AppConf.conf.LastSavedConfFile;

            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                if (File.Exists(openFileDialog1.FileName))
                {
                    try
                    {
                        SaveConfClass TempSave;
                        // сохраняем текущий файл конфигурации
                        if (File.Exists(AppConf.conf.LastSavedConfFile))
                        {
                            TempSave = new SaveConfClass(AppConf.conf.LastSavedConfFile);
                            // присваиваем сохраняемой конфигурации новые параметры
                            TempSave.conf.CurrentParam = AppConf.conf.CurrentConf;
                            TempSave.Save();
                        }

                        //теперь открываем новую конфигурацию
                        AppConf.conf.LastSavedConfFile = openFileDialog1.FileName;
                        TempSave = new SaveConfClass(AppConf.conf.LastSavedConfFile);
                        AppConf.conf.CurrentConf = TempSave.conf.CurrentParam;
                        InitializeForm();
                    }
                    catch (Exception ex)
                    {
                        ErrorWorkProc.ErrorProcess(ex);
                    }
                }
            }
            ;
        }
Exemplo n.º 4
0
 private void сохранитьToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (File.Exists(AppConf.conf.LastSavedConfFile))
     {
         try
         {
             SaveConfClass TempSave = new SaveConfClass(AppConf.conf.LastSavedConfFile);
             // присваиваем сохраняемой конфигурации новые параметры
             TempSave.conf.CurrentParam = AppConf.conf.CurrentConf;
             TempSave.Save();
             this.FormName = "Синхронизация и копирование";
         }
         catch (Exception ex)
         {
             ErrorWorkProc.ErrorProcess(ex);
         }
     }
     else
     {
         сохранитьКакToolStripMenuItem_Click(null, null);
     }
 }