/// <summary> /// Backup /// </summary> private void ToolStripMenuItemBackup_Click(object sender, EventArgs e) { if (DialogResult.OK == saveFileDialogBackup.ShowDialog()) { FormWorkerThreadTask.Execute(new Pic.DAL.TPTBackup(saveFileDialogBackup.FileName)); } }
private void bnUpdateLocalisationFile_Click(object sender, EventArgs e) { try { // process all components and collect parameter descriptions FormWorkerThreadTask.Execute(new TPTCollectPluginParameterNames()); // open localisation file ProcessStartInfo startInfo = new ProcessStartInfo(); startInfo.UseShellExecute = true; startInfo.Verb = "Open"; startInfo.CreateNoWindow = false; startInfo.WindowStyle = ProcessWindowStyle.Normal; startInfo.FileName = LocalizerImpl.Instance.LocalisationFileName; using (Process p = new Process()) { p.StartInfo = startInfo; p.Start(); } } catch (Exception ex) { _log.Error(ex.ToString()); } }
/// <summary> /// Merge /// </summary> private void OnMerge(object sender, EventArgs e) { if (DialogResult.OK == openFileDialogRestore.ShowDialog()) { FormWorkerThreadTask.Execute(new Pic.DAL.TPTMerge(openFileDialogRestore.FileName)); // refresh tree treeView.RefreshTree(); // back to default cursor Cursor.Current = Cursors.Default; } }
/// <summary> /// Merge /// </summary> private void ToolStripMenuItemMerge_Click(object sender, EventArgs e) { if (DialogResult.OK == openFileDialogRestore.ShowDialog()) { FormWorkerThreadTask.Execute(new Pic.DAL.TPTMerge(openFileDialogRestore.FileName)); /* * // refresh tree * _treeViewCtrl.RefreshTree(); */ // back to default cursor Cursor.Current = Cursors.Default; } }
/// <summary> /// Clear /// </summary> private void OnClearDatabase(object sender, EventArgs e) { try { // form if (DialogResult.Yes == MessageBox.Show(Resources.ID_CLEARDATABASEWARNING, ProductName, MessageBoxButtons.YesNo)) { // answered 'Yes' // start thread FormWorkerThreadTask.Execute(new Pic.DAL.TPTClearDatabase()); // refresh tree treeView.RefreshTree(); } } catch (Exception ex) { MessageBox.Show(string.Format(ex.Message)); } }
/// <summary> /// Restore /// </summary> private void OnRestore(object sender, EventArgs e) { // warning if (MessageBox.Show(Resources.ID_RESTOREWARNING , ProductName , MessageBoxButtons.OKCancel , MessageBoxIcon.Warning ) == DialogResult.Cancel) { return; } if (DialogResult.OK == openFileDialogRestore.ShowDialog()) { FormWorkerThreadTask.Execute(new Pic.DAL.TPTRestore(openFileDialogRestore.FileName)); // refresh tree treeView.RefreshTree(); // expand all so that modifications can be visualized if (treeView.Nodes.Count > 0) { treeView.Nodes[0].ExpandAll(); } } }
/// <summary> /// Restore /// </summary> private void ToolStripMenuItemRestore_Click(object sender, EventArgs e) { // warning if (MessageBox.Show(PicParam.Properties.Resources.ID_RESTOREWARNING , ProductName , MessageBoxButtons.OKCancel , MessageBoxIcon.Warning ) == DialogResult.Cancel) { return; } if (DialogResult.OK == openFileDialogRestore.ShowDialog()) { FormWorkerThreadTask.Execute(new Pic.DAL.TPTRestore(openFileDialogRestore.FileName)); /* * // refresh tree * _treeViewCtrl.RefreshTree(); * // expand all so that modifications can be visualized * if (_treeViewCtrl.Nodes.Count > 0) * _treeViewCtrl.Nodes[0].ExpandAll(); */ } }
/// <summary> /// Use this method to process any task /// </summary> public static void Execute(TreeProcessingTask task) { FormWorkerThreadTask form = new FormWorkerThreadTask(task); form.ShowDialog(); }