private void saveToolStripMenuItem_Click(object sender, EventArgs e) { saveFileDialog1.Title = "Save settings"; saveFileDialog1.Filter = "XML|*.xml"; saveFileDialog1.InitialDirectory = @"C:\billtmp\"; saveFileDialog1.ShowDialog(); if (saveFileDialog1.FileName != "") { Settings setting = new Settings(); setting.FolderDestination = _folderDestination; setting.FolderSource = _folderSource; setting.IgnoreBin = chkIgnoreBin.Checked; setting.IgnoreGit = chkIgnoreGit.Checked; setting.IgnoreObj = chkIgnoreObj.Checked; setting.IgnoreListValues = txtFsIgnore.Text; setting.Label = txtBackupLabel.Text; setting.QualificationDateTime = _dateTimeCutOff; setting.Save(saveFileDialog1.FileName); } updateFormTitle(saveFileDialog1.FileName); }
private void loadFromSettingFile(bool loadDate) { openFileDialog1.ShowDialog(); openFileDialog1.Filter = "XML|*.xml"; openFileDialog1.InitialDirectory = @"C:\billtmp\"; if (openFileDialog1.FileName != "") { Settings setting = new Settings(); setting.Load(openFileDialog1.FileName); txtSourceFolder.Text = setting.FolderSource; _folderSource = setting.FolderSource; txtDestinationFolder.Text = setting.FolderDestination; _folderDestination = setting.FolderDestination; if (loadDate) { if (setting.QualificationDateTime > DateTime.Parse("1/1/1970")) { dtpQualDate.Value = setting.QualificationDateTime; dtpQualTime.Value = setting.QualificationDateTime; _dateTimeCutOff = setting.QualificationDateTime; } } txtBackupLabel.Text = setting.Label; lblBackupLabel.Text = createBackupLabel(setting.Label); chkIgnoreObj.Checked = setting.IgnoreObj; chkIgnoreGit.Checked = setting.IgnoreGit; chkIgnoreBin.Checked = setting.IgnoreBin; txtFsIgnore.Text = setting.IgnoreListValues; if (setting.IgnoreListValues != "") { chkIgnoreOther.Checked = true; } updateFormTitle(openFileDialog1.FileName); } }