public void ExportSingle(string fileEntry) { DialogBoxResult dialog = new DialogBoxResult("Convert Single File", "This action converts '" + fileEntry + "' with specified settings to the output directory."); dialog.StartPosition = FormStartPosition.CenterParent; dialog.ShowDialog(this); if (dialog.ok == true) { Converter.InitConverter(); bool success = Converter.Convert(fileEntry); if (success) { DialogBoxMessage message = new DialogBoxMessage("Success", "Conversion successful!"); message.StartPosition = FormStartPosition.CenterParent; message.ShowDialog(this); } else { DialogBoxMessage message = new DialogBoxMessage("Error", "Error: " + Converter.errorMsg); message.StartPosition = FormStartPosition.CenterParent; message.ShowDialog(this); } } }
private void btnExportAll_Click(object sender, EventArgs e) { if (workerThread.IsBusy != true) { DialogBoxResult dialog = new DialogBoxResult("Confirmation", "This action will overwrite any existing files with the same name in the output directory." + "\n\nDo you want to continue?"); dialog.StartPosition = FormStartPosition.CenterParent; dialog.ShowDialog(this); if (dialog.ok == true) { btnExportAll.FlatAppearance.MouseOverBackColor = Color.FromArgb(255, 100, 100); btnExportAll.Text = "Stop"; listErrors.Items.Clear(); //bubble the event up to the parent if (this.OnExportAll != null) { this.OnExportAll(this, e); } } } else { btnExportAll.FlatAppearance.MouseOverBackColor = Color.LimeGreen; btnExportAll.Text = "Export All"; // Cancel the asynchronous operation. workerThread.CancelAsync(); } }
protected void btnClear_Click(object sender, EventArgs e) { DialogBoxResult dialog = new DialogBoxResult("Confirmation", "This action will clear the list. Do you want to continue?"); dialog.StartPosition = FormStartPosition.CenterParent; dialog.ShowDialog(this); if (dialog.ok == true) { //bubble the event up to the parent if (this.OnClearList != null) { this.OnClearList(this, e); } listFileEntries.Items.Clear(); lblItems.Text = "Items: " + listFileEntries.Items.Count; } }