private void tsbExport_Click(object sender, EventArgs e) { // Browse folder if (folderBrowserDialog1.ShowDialog(this) == System.Windows.Forms.DialogResult.Cancel) return; // Disable main form EnableMainForm(false); SelectedPath = folderBrowserDialog1.SelectedPath; OperationMode = "EXPORT"; // begin the export CurrentObjects = (ArrayList) appListView.SelectedObjects; // Build form ProgressForm = new ProgressDialogForm(); ProgressForm.Show(); ProgressForm.pbImage.Image = (Image) tsbExport.Image.Clone(); ProgressForm.label1.Text = "Exporting..."; // Launch thread appWorker.RunWorkerAsync(CurrentObjects); }
// Begin importing some files private void tsbImport_Click(object sender, EventArgs e) { // File selection if (openFileDialog1.ShowDialog(this) == System.Windows.Forms.DialogResult.Cancel) return; OperationMode = "IMPORT"; // Build form ProgressForm = new ProgressDialogForm(); ProgressForm.Show(); ProgressForm.pbImage.Image = (Image)tsbImport.Image.Clone(); ProgressForm.label1.Text = "Importing..."; CurrentObjects = new ArrayList(); // For each file... foreach (string filename in openFileDialog1.FileNames) { CurrentObjects.Add(filename); } appWorker.RunWorkerAsync(CurrentObjects); }
private void mainForm_Shown(object sender, EventArgs e) { // An update of the app database is required if (UpdateWanted) { UpdateWanted = false; tsbUpdate_Click(sender, e); } // Are we importing a package from command-line? if (Program.FileImportWanted != null) { // We need a confirmation dialog in case the file was double clicked by mistake... if (MessageBox.Show("Are you sure you want to import this package?\n\""+Program.FileImportWanted+"\"\n\nSettings for this application will be replaced by the ones contained in this package.","Confirm",MessageBoxButtons.OKCancel,MessageBoxIcon.Question) != DialogResult.OK) { Program.FileImportWanted = null; return; } OperationMode = "IMPORT"; CurrentObjects = new ArrayList(); // For each file... CurrentObjects.Add(Program.FileImportWanted); Program.FileImportWanted = null; // Build form ProgressForm = new ProgressDialogForm(); ProgressForm.Show(); ProgressForm.pbImage.Image = (Image)tsbImport.Image.Clone(); ProgressForm.label1.Text = "Importing..."; // Run worker appWorker.RunWorkerAsync(CurrentObjects); } }