/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void toolsPresetsEditorToolStripMenuItem_Click(object sender, EventArgs e) { frmPresetsEditor nform = new frmPresetsEditor(this.presetdata); nform.StartPosition = FormStartPosition.CenterParent; DialogResult res = nform.ShowDialog(); try { if (res == DialogResult.OK) { // Save Presetfile. if (Config.Settings.MakeBackupsXMLFiles) { Functions.CreateBackupFile(Config.Settings.LastUsedPresetFile); } Functions.SerializePresetsData( Config.Settings.LastUsedPresetFile, this.presetdata); } } finally { // Save commandline descriptions... nform.SaveDescriptionSettings(Config.Settings.LastUsedCommandDescriptionFile); nform.Dispose(); } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void mediafilesSelectPresetListToolStripMenuItem_Click(object sender, EventArgs e) { if (listViewFiles.SelectedItems.Count > 0) { frmPresetsEditor nform = new frmPresetsEditor(this.presetdata); nform.StartPosition = FormStartPosition.CenterParent; DialogResult res = nform.ShowDialog(); try { if (res == DialogResult.OK) { if (nform.CurrentPreset != null) { foreach (ListViewItem i in this.listViewFiles.SelectedItems) { i.SubItems[SUBCOL_PRESETNAME].Text = nform.CurrentPreset.Name; nform.CurrentPreset.LastUsed = DateTime.Now; nform.CurrentPreset.UsedCount += 1; } } // Save Presetfile. if (Config.Settings.MakeBackupsXMLFiles) { Functions.CreateBackupFile(Config.Settings.LastUsedPresetFile); } Functions.SerializePresetsData(Config.Settings.LastUsedPresetFile, this.presetdata); } } finally { // Save commandline descriptions... nform.SaveDescriptionSettings( Config.Settings.LastUsedCommandDescriptionFile); nform.Dispose(); } } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void mediafilesSelectPresetListToolStripMenuItem_Click(object sender, EventArgs e) { if (listViewFiles.SelectedItems.Count > 0) { frmPresetsEditor nform = new frmPresetsEditor(this.presetdata); nform.StartPosition = FormStartPosition.CenterParent; DialogResult res = nform.ShowDialog(); try { if (res == DialogResult.OK) { if (nform.CurrentPreset != null) { foreach (ListViewItem i in this.listViewFiles.SelectedItems) { i.SubItems[Functions.SUBCOL_PRESETNAME].Text = nform.CurrentPreset.Name; nform.CurrentPreset.LastUsed = DateTime.Now; nform.CurrentPreset.UsedCount += 1; } } if (Config.Settings.MakeBackupsXMLFiles) { Functions.CreateBackupFile(Config.Settings.LastUsedPresetFile); } // only save the presets but do not reload the presetdata object, // as the user may wants to finish this session first. Functions.SerializePresetsData(Config.Settings.LastUsedPresetFile, this.presetdata); } } finally { // Save commandline descriptions... nform.SaveDescriptionSettings( Config.Settings.LastUsedCommandDescriptionFile); nform.Dispose(); } } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void toolsPresetsEditorToolStripMenuItem_Click(object sender, EventArgs e) { frmPresetsEditor nform = new frmPresetsEditor(this.presetdata); nform.StartPosition = FormStartPosition.CenterParent; DialogResult res = nform.ShowDialog(); try { if (res == DialogResult.OK) { // Save Presetfile. if (Config.Settings.MakeBackupsXMLFiles) { Functions.CreateBackupFile(Config.Settings.LastUsedPresetFile); } bool b = Functions.SerializePresetsData( Config.Settings.LastUsedPresetFile, this.presetdata); if (b == false && Config.Settings.MakeBackupsXMLFiles) { // I could throw it but... DialogResult a = MessageBox.Show("Do you want your stuff restored?", "Convendro", MessageBoxButtons.YesNo, MessageBoxIcon.Error); if (a == DialogResult.Yes) { // if backup file was loaded... if (Functions.RestoreBackupFile(Config.Settings.LastUsedPresetFile)) { this.presetdata = Functions.DeserializePresetsData( Config.Settings.LastUsedPresetFile); } } } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Convendro", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { // Save commandline descriptions... nform.SaveDescriptionSettings(Config.Settings.LastUsedCommandDescriptionFile); nform.Dispose(); } }