using System; using System.ComponentModel; using System.IO; using System.Threading.Tasks; using System.Windows.Forms; using Serilog; namespace DatEmAll_GUI { /// /// The DatEmAll GUI Class which interacts with the Main Program Class. /// public partial class FrmDatEmAll : Form { #region Constructors DatEmAll.DatEmAll DEA = new DatEmAll.DatEmAll(); /// /// Constructor /// public FrmDatEmAll() { // Initialize the form. InitializeComponent(); // Print the version. DEA.PrintVersion(); // Load the default options passed from the default options file. DEA.LoadOptionsFromFile(); // Load the default options passed from the command line arguments. DEA.LoadOptionsFromCLI(Environment.GetCommandLineArgs()); // Add data bindings. chkIncludeCRC32Hash.DataBindings.Add("Checked", DEA, "IncludeCRC32Hash"); chkIncludeMD5Hash.DataBindings.Add("Checked", DEA, "IncludeMD5Hash"); chkIncludeSHA1Hash.DataBindings.Add("Checked", DEA, "IncludeSHA1Hash"); chkIncludeFileSize.DataBindings.Add("Checked", DEA, "IncludeFileSize"); chkAppendGameCountToFilename.DataBindings.Add("Checked", DEA, "AppendGameCountToFilename"); chkAppendGameCountToDescription.DataBindings.Add("Checked", DEA, "AppendGameCountToDescription"); chkAppendVersionToFilename.DataBindings.Add("Checked", DEA, "AppendVersionToFilename"); chkAppendVersionToDescription.DataBindings.Add("Checked", DEA, "AppendVersionToDescription"); chkIncludeROMDirRootFiles.DataBindings.Add("Checked", DEA, "IncludeROMDirRootFiles"); txtDatFilename.DataBindings.Add("Text", DEA, "DatFilename"); cbXMLEncoding.DataBindings.Add("SelectedItem", DEA, "XMLEncoding"); cbXMLDOCTYPE.DataBindings.Add("SelectedItem", DEA, "XMLDOCTYPE"); chkIncludeDefaultHeaderName.DataBindings.Add("Checked", DEA, "IncludeDefaultHeaderName"); chkIncludeDefaultHeaderDescription.DataBindings.Add("Checked", DEA, "IncludeDefaultHeaderDescription"); chkIncludeDefaultHeaderVersion.DataBindings.Add("Checked", DEA, "IncludeDefaultHeaderVersion"); chkIncludeDefaultHeaderDate.DataBindings.Add("Checked", DEA, "IncludeDefaultHeaderDate"); chkIncludeDefaultHeaderAuthor.DataBindings.Add("Checked", DEA, "IncludeDefaultHeaderAuthor"); chkIncludeDefaultHeaderEmail.DataBindings.Add("Checked", DEA, "IncludeDefaultHeaderEmail"); chkIncludeDefaultHeaderHomepage.DataBindings.Add("Checked", DEA, "IncludeDefaultHeaderHomepage"); chkIncludeDefaultHeaderURL.DataBindings.Add("Checked", DEA, "IncludeDefaultHeaderURL"); chkIncludeDefaultHeaderComment.DataBindings.Add("Checked", DEA, "IncludeDefaultHeaderComment"); chkIncludeDefaultHeaderCategory.DataBindings.Add("Checked", DEA, "IncludeDefaultHeaderCategory"); chkIncludeDefaultHeaderCMPForceUnzip.DataBindings.Add("Checked", DEA, "IncludeDefaultHeaderCMPForceUnzip"); txtOverrideHeaderName.DataBindings.Add("Text", DEA, "OverrideHeaderName"); txtOverrideHeaderDescription.DataBindings.Add("Text", DEA, "OverrideHeaderDescription"); txtOverrideHeaderVersion.DataBindings.Add("Text", DEA, "OverrideHeaderVersion"); txtOverrideHeaderDate.DataBindings.Add("Text", DEA, "OverrideHeaderDate"); txtOverrideHeaderAuthor.DataBindings.Add("Text", DEA, "OverrideHeaderAuthor"); txtOverrideHeaderEmail.DataBindings.Add("Text", DEA, "OverrideHeaderEmail"); txtOverrideHeaderHomepage.DataBindings.Add("Text", DEA, "OverrideHeaderHomepage"); txtOverrideHeaderURL.DataBindings.Add("Text", DEA, "OverrideHeaderURL"); txtOverrideHeaderComment.DataBindings.Add("Text", DEA, "OverrideHeaderComment"); txtOverrideHeaderCategory.DataBindings.Add("Text", DEA, "OverrideHeaderCategory"); chkCheckForLatestVersion.DataBindings.Add("Checked", DEA, "CheckForLatestVersion"); chkCheckSSLCertificates.DataBindings.Add("Checked", DEA, "CheckSSLCertificates"); chkSendErrorReports.DataBindings.Add("Checked", DEA, "SendErrorReports"); cbLanguageLocality.DataBindings.Add("SelectedItem", DEA, "LanguageLocality"); cbLogLevel.DataBindings.Add("SelectedItem", DEA, "LogLevel"); txtPathDatsDir.DataBindings.Add("Text", DEA, "PathDatsDir"); txtPathROMsDir.DataBindings.Add("Text", DEA, "PathROMsDir"); txtRegisterAppUsername.DataBindings.Add("Text", DEA, "RegisterAppUsername"); txtRegisterAppEmailAddress.DataBindings.Add("Text", DEA, "RegisterAppEmailAddress"); txtRegisterAppPassword.DataBindings.Add("Text", DEA, "RegisterAppPassword"); // Hide some tabs. tcMain.TabPages.Remove(tabHelp); tcMain.TabPages.Remove(tabLicense); tcMain.TabPages.Remove(tabDonations); tcMain.TabPages.Remove(tabRegistration); // Set the title. UpdateTitle(); // Load the GUI RichTextBoxes from resources. rtbHelp.Text = DatEmAll.Properties.Resources.DatEmAll_HELP; rtbLicense.Text = DatEmAll.Properties.Resources.DatEmAll_LICENSE; rtbDonations.Text = DatEmAll.Properties.Resources.DatEmAll_DONATIONS; } #endregion #region Getters/Setters Public Accessors /// LogLines public string[] LogLines { get { return rtblLog.Lines; } set { rtblLog.Lines = value; } } #endregion #region Log /// /// Saves the log to a text file. /// /// /// public bool SaveLogToFile(string strPath = null) { try { if (strPath != null) { DEA.PathLogFile = strPath; } // Determine if the user selected a log filename. if (DEA.PathLogFile.Length == 0) { // Return a bool value. return false; } else { // Print to screen Log.Information("Saving log file ..."); // Create log file directory if it doesn't exist. if (Directory.Exists(Path.GetDirectoryName(DEA.PathLogFile)) == false) Directory.CreateDirectory(Path.GetDirectoryName(DEA.PathLogFile)); // Save the contents of the log to a text file. File.WriteAllLines(DEA.PathLogFile, LogLines); // Print to screen Log.Information("Log file saved (" + DEA.PathLogFile + ")"); // Return a bool value. return true; } } catch (Exception ex) { // Print to screen Log.Error("Saving log file failed"); Log.Error(ex.Message); // Return a bool value. return false; } } #endregion #region Startup Tasks /// /// /// /// /// private void StartupTasks_DoWork(object sender, DoWorkEventArgs e) { // Run startup tasks. DEA.StartupTasks(); } /// /// /// /// /// private void StartupTasks_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { if (e.Cancelled) { // Print to screen Log.Information("Startup tasks canceled"); } else if (e.Error != null) { // Print to screen Log.Error("Startup tasks failed"); Log.Error(e.Error.Message); } else { // } // Print to screen Log.Information("Ready"); // Update the status message label. UpdateStatusMessageLabel("Ready"); // Enable all of the buttons. Invoke(new EnableAllButtonsDelegate(EnableAllButtons)); } #endregion #region GUI Methods /// /// Cancels the current backgroundworker. /// /// /// private void Cancel_Click(object sender, EventArgs e) { if (bgwBuildDat.WorkerSupportsCancellation == true) { // Print to screen Log.Information("Cancellation pending after current operation ..."); // Disable the cancel button. tssbCancel.Enabled = false; // Cancel the asynchronous operation. bgwBuildDat.CancelAsync(); // Update the status message label. UpdateStatusMessageLabel("Cancellation Pending ..."); } } /// /// Updates/Sets the application title. /// /// /// public bool UpdateTitle(string strTitle = "") { try { if (this.InvokeRequired && !this.IsDisposed) { Invoke(new MethodInvoker(delegate () { // Update the application title. this.Text = DEA.AppName + " v" + DEA.AppVersion + strTitle; })); } else if (!this.IsDisposed) { // Update the application title. this.Text = DEA.AppName + " v" + DEA.AppVersion + strTitle; } return true; } catch (Exception) { return false; } } /// /// Updates the progress status message label. /// /// private void UpdateStatusMessageLabel(string strMsg) { // Update the progress status message label. tsslStatusMessage.Text = strMsg; } /// /// After the form is shown, run the startup tasks. /// /// /// private void Form_Shown(object sender, EventArgs e) { // Perform the application startup tasks. bgwStartupTasks.RunWorkerAsync(); } /// /// Exits the WinForm app. /// /// /// private void ExitApp_Click(object sender, EventArgs e) { Application.Exit(); } /// /// Exits the Forms application. /// /// /// private void Form_FormClosing(object sender, FormClosingEventArgs e) { if (bgwBuildDat.IsBusy == true) { if (MessageBox.Show("The dat builder is currently running. Are you sure you want to exit now? Exiting now may cause corrupt or incomplete files!", "Confirm Exit", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK) { e.Cancel = true; } } } /// /// Changes the path to the Dats directory. /// /// /// private void PathDatsDir_Click(object sender, EventArgs e) { // Disable all buttons. DisableAllButtons(); if (txtPathDatsDir.Text == "") { txtPathDatsDir.Text = "Dats"; } // Create and initialize a FolderBrowserDialog for the Dats directory. FolderBrowserDialog fbdSelectDir = new FolderBrowserDialog { ShowNewFolderButton = true, Description = "Please enter a path to the Dats directory: ", SelectedPath = Path.GetFullPath(Path.Combine(txtPathDatsDir.Text)) }; // Determine if the user selected OK from the FolderBrowserDialog. if (fbdSelectDir.ShowDialog() == DialogResult.OK) { // Set both variables for compatibility for Windows .Net and Mono. this.DEA.PathDatsDir = fbdSelectDir.SelectedPath; txtPathDatsDir.Text = fbdSelectDir.SelectedPath; } // Enable all buttons. EnableAllButtons(); } /// /// Changes the path to the ROMs directory. /// /// /// private void PathROMsDir_Click(object sender, EventArgs e) { // Disable all buttons. DisableAllButtons(); if (txtPathROMsDir.Text == "") { txtPathROMsDir.Text = "ROMs"; } // Create and initialize a FolderBrowserDialog for the ROMs directory. FolderBrowserDialog fbdSelectDir = new FolderBrowserDialog { ShowNewFolderButton = true, Description = "Please enter a path to the ROMs directory: ", SelectedPath = Path.GetFullPath(Path.Combine(txtPathROMsDir.Text)) }; // Determine if the user selected OK from the FolderBrowserDialog. if (fbdSelectDir.ShowDialog() == DialogResult.OK) { // Set both variables for compatibility for Windows .NET and Mono. this.DEA.PathROMsDir = fbdSelectDir.SelectedPath; txtPathROMsDir.Text = fbdSelectDir.SelectedPath; } // Enable all buttons. EnableAllButtons(); } /// /// Builds a dat. /// /// /// private void BuildDat_Click(object sender, EventArgs e) { // Select the Log tab. if (tcMain.TabPages.Contains(tabLog)) { tcMain.SelectTab(tabLog); } // Disable all buttons. DisableAllButtons(); // Enable the cancel button. tssbCancel.Enabled = true; // Update the status message label. UpdateStatusMessageLabel("Building Dat ..."); // Update the DateTimeFormatted variable. DEA.DateTimeFormatted = DateTime.Now.ToString("yyyyMMdd_HHmmss"); // Build a dat. bgwBuildDat.RunWorkerAsync(); } /// /// Loads an options file. /// /// /// private void LoadOptions_Click(object sender, EventArgs e) { // Disable all buttons. DisableAllButtons(); // Create and initialize an OpenFileDialog for the options file. OpenFileDialog ofdOptions = new OpenFileDialog { DefaultExt = "*.xml", Filter = "XML Files|*.xml", Title = "Please enter a path to the options file: ", InitialDirectory = Path.Combine(Application.StartupPath, "Options") }; // Determine if the user selected a file name from the OpenFileDialog. if (ofdOptions.ShowDialog() == DialogResult.OK && ofdOptions.FileName.Length > 0) { // Set the options file path. DEA.PathOptionsFile = ofdOptions.FileName; // Select the Log tab. if (tcMain.TabPages.Contains(tabLog)) { tcMain.SelectTab(tabLog); } // Load the options. DEA.LoadOptionsFromFile(); // Print to screen Log.Information("Ready"); } // Dispose of the OpenFileDialog. ofdOptions.Dispose(); // Enable all buttons. EnableAllButtons(); } /// /// Saves an options file. /// /// /// private void SaveOptions_Click(object sender, EventArgs e) { // Disable all buttons. DisableAllButtons(); // Create and initialize a SaveFileDialog for the options file. SaveFileDialog sfdOptions = new SaveFileDialog { DefaultExt = "*.xml", Filter = "XML Files|*.xml", FileName = "DatEmAll-Options.xml", Title = "Please enter a path to the options file: ", InitialDirectory = Path.Combine(Application.StartupPath, "Options") }; // Determine if the user selected a file name from the SaveFileDialog. if (sfdOptions.ShowDialog() == DialogResult.OK && sfdOptions.FileName.Length > 0) { // Set the options file path. DEA.PathOptionsFile = sfdOptions.FileName; // Select the Log tab. if (tcMain.TabPages.Contains(tabLog)) { tcMain.SelectTab(tabLog); } // Save the options. DEA.SaveOptionsToFile(); // Print to screen Log.Information("Ready"); } // Dispose of the SaveFileDialog. sfdOptions.Dispose(); // Enable all buttons. EnableAllButtons(); } /// /// Saves the log to a text file. /// /// /// private void SaveLog_Click(object sender, EventArgs e) { // Disable all buttons. DisableAllButtons(); // Create and initialize a SaveFileDialog for the log file. SaveFileDialog sfdLog = new SaveFileDialog { DefaultExt = "*.txt", Filter = "TXT Files|*.txt", FileName = "DatEmAll-Log-" + DateTime.Now.ToString("yyyyMMdd_HHmmss") + ".txt", Title = "Please enter a path to the log file: ", InitialDirectory = Path.Combine(Application.StartupPath, "Logs") }; // Determine if the user selected a log filename. if (sfdLog.ShowDialog() == DialogResult.OK && sfdLog.FileName.Length > 0) { // Set the log file path. DEA.PathLogFile = sfdLog.FileName; // Select the Log tab. if (tcMain.TabPages.Contains(tabLog)) { tcMain.SelectTab(tabLog); } // Save the log. SaveLogToFile(DEA.PathLogFile); // Print to screen Log.Information("Ready"); } // Dispose of the SaveFileDialog. sfdLog.Dispose(); // Enable all buttons. EnableAllButtons(); } /// /// Toggles the visibility of the log. /// private void ViewLog_Click(object sender, EventArgs e) { if (tsmiLog.Checked) { tsmiLog.Checked = false; tsmiLog.CheckState = CheckState.Unchecked; tcMain.TabPages.Remove(tabLog); } else { tsmiLog.Checked = true; tsmiLog.CheckState = CheckState.Checked; tcMain.TabPages.Add(tabLog); tcMain.SelectTab(tabLog); } } /// /// Toggles the visibility of the options. /// private void ViewOptions_Click(object sender, EventArgs e) { if (tsmiOptions.Checked) { tsmiOptions.Checked = false; tsmiOptions.CheckState = CheckState.Unchecked; tcMain.TabPages.Remove(tabOptions); } else { tsmiOptions.Checked = true; tsmiOptions.CheckState = CheckState.Checked; tcMain.TabPages.Add(tabOptions); tcMain.SelectTab(tabOptions); } } /// /// Toggles the visibility of the help. /// private void ViewHelp_Click(object sender, EventArgs e) { if (tsmiHelp.Checked) { tsmiHelp.Checked = false; tsmiHelp.CheckState = CheckState.Unchecked; tcMain.TabPages.Remove(tabHelp); } else { tsmiHelp.Checked = true; tsmiHelp.CheckState = CheckState.Checked; tcMain.TabPages.Add(tabHelp); tcMain.SelectTab(tabHelp); } } /// /// Toggles the visibility of the license. /// private void ViewLicense_Click(object sender, EventArgs e) { if (tsmiLicense.Checked) { tsmiLicense.Checked = false; tsmiLicense.CheckState = CheckState.Unchecked; tcMain.TabPages.Remove(tabLicense); } else { tsmiLicense.Checked = true; tsmiLicense.CheckState = CheckState.Checked; tcMain.TabPages.Add(tabLicense); tcMain.SelectTab(tabLicense); } } /// /// Toggles the visibility of the registration. /// private void ViewRegistration_Click(object sender, EventArgs e) { if (tsmiRegistration.Checked) { tsmiRegistration.Checked = false; tsmiRegistration.CheckState = CheckState.Unchecked; tcMain.TabPages.Remove(tabRegistration); } else { tsmiRegistration.Checked = true; tsmiRegistration.CheckState = CheckState.Checked; tcMain.TabPages.Add(tabRegistration); tcMain.SelectTab(tabRegistration); } } /// /// Toggles the visibility of the Donations. /// private void ViewDonations_Click(object sender, EventArgs e) { if (tsmiDonations.Checked) { tsmiDonations.Checked = false; tsmiDonations.CheckState = CheckState.Unchecked; tcMain.TabPages.Remove(tabDonations); } else { tsmiDonations.Checked = true; tsmiDonations.CheckState = CheckState.Checked; tcMain.TabPages.Add(tabDonations); tcMain.SelectTab(tabDonations); } } /// /// Toggles the visibility of the toolbar. /// private void ViewToolbar_Click(object sender, EventArgs e) { if (tsMain.Visible) { tsMain.Visible = false; tsmiToolbar.Checked = false; tsmiToolbar.CheckState = CheckState.Unchecked; } else { tsMain.Visible = true; tsmiToolbar.Checked = true; tsmiToolbar.CheckState = CheckState.Checked; } } private delegate void EnableAllButtonsDelegate(); /// /// Enables all of the buttons. /// private void EnableAllButtons() { // Enable all Menu Item buttons. tsmiCommands.Enabled = true; tsmiBuildDat.Enabled = true; tsmiLoadOptions.Enabled = true; tsmiSaveOptions.Enabled = true; tsmiSaveLog.Enabled = true; tsmiExit.Enabled = true; // Enable all Toolbar buttons. tsbBuildDat.Enabled = true; tsbLoadOptions.Enabled = true; tsbSaveOptions.Enabled = true; tsbSaveLog.Enabled = true; // Enable all Options checkboxes and textboxes and comboboxes. chkIncludeCRC32Hash.Enabled = true; chkIncludeFileSize.Enabled = true; chkIncludeMD5Hash.Enabled = true; chkIncludeSHA1Hash.Enabled = true; chkIncludeFileSize.Enabled = true; chkAppendGameCountToFilename.Enabled = true; chkAppendGameCountToDescription.Enabled = true; chkAppendVersionToFilename.Enabled = true; chkAppendVersionToDescription.Enabled = true; chkIncludeROMDirRootFiles.Enabled = true; txtDatFilename.Enabled = true; cbXMLEncoding.Enabled = true; cbXMLDOCTYPE.Enabled = true; chkIncludeDefaultHeaderName.Enabled = true; chkIncludeDefaultHeaderDescription.Enabled = true; chkIncludeDefaultHeaderVersion.Enabled = true; chkIncludeDefaultHeaderDate.Enabled = true; chkIncludeDefaultHeaderAuthor.Enabled = true; chkIncludeDefaultHeaderEmail.Enabled = true; chkIncludeDefaultHeaderHomepage.Enabled = true; chkIncludeDefaultHeaderURL.Enabled = true; chkIncludeDefaultHeaderComment.Enabled = true; chkIncludeDefaultHeaderCategory.Enabled = true; chkIncludeDefaultHeaderCMPForceUnzip.Enabled = true; txtOverrideHeaderName.Enabled = true; txtOverrideHeaderDescription.Enabled = true; txtOverrideHeaderVersion.Enabled = true; txtOverrideHeaderDate.Enabled = true; txtOverrideHeaderAuthor.Enabled = true; txtOverrideHeaderEmail.Enabled = true; txtOverrideHeaderHomepage.Enabled = true; txtOverrideHeaderURL.Enabled = true; txtOverrideHeaderComment.Enabled = true; txtOverrideHeaderCategory.Enabled = true; txtDownloadEmAllUsername.Enabled = true; txtDownloadEmAllPassword.Enabled = true; txtPathDatsDir.Enabled = true; txtPathROMsDir.Enabled = true; chkCheckForLatestVersion.Enabled = true; chkCheckSSLCertificates.Enabled = true; chkSendErrorReports.Enabled = true; cbLanguageLocality.Enabled = true; cbLogLevel.Enabled = true; } private delegate void DisableAllButtonsDelegate(); /// /// Disables all of the buttons. /// private void DisableAllButtons() { // Disable all Menu Item buttons. tsmiCommands.Enabled = false; tsmiBuildDat.Enabled = false; tsmiLoadOptions.Enabled = false; tsmiSaveOptions.Enabled = false; tsmiSaveLog.Enabled = false; tsmiExit.Enabled = false; // Disable all Toolbar buttons. tsbBuildDat.Enabled = false; tsbLoadOptions.Enabled = false; tsbSaveOptions.Enabled = false; tsbSaveLog.Enabled = false; // Disable all Options checkboxes and textboxes and comboboxes. chkIncludeCRC32Hash.Enabled = false; chkIncludeFileSize.Enabled = false; chkIncludeMD5Hash.Enabled = false; chkIncludeSHA1Hash.Enabled = false; chkIncludeFileSize.Enabled = false; chkAppendGameCountToFilename.Enabled = false; chkAppendGameCountToDescription.Enabled = false; chkAppendVersionToFilename.Enabled = false; chkAppendVersionToDescription.Enabled = false; chkIncludeROMDirRootFiles.Enabled = false; txtDatFilename.Enabled = false; cbXMLEncoding.Enabled = false; cbXMLDOCTYPE.Enabled = false; chkIncludeDefaultHeaderName.Enabled = false; chkIncludeDefaultHeaderDescription.Enabled = false; chkIncludeDefaultHeaderVersion.Enabled = false; chkIncludeDefaultHeaderDate.Enabled = false; chkIncludeDefaultHeaderAuthor.Enabled = false; chkIncludeDefaultHeaderEmail.Enabled = false; chkIncludeDefaultHeaderHomepage.Enabled = false; chkIncludeDefaultHeaderURL.Enabled = false; chkIncludeDefaultHeaderComment.Enabled = false; chkIncludeDefaultHeaderCategory.Enabled = false; chkIncludeDefaultHeaderCMPForceUnzip.Enabled = false; txtOverrideHeaderName.Enabled = false; txtOverrideHeaderDescription.Enabled = false; txtOverrideHeaderVersion.Enabled = false; txtOverrideHeaderDate.Enabled = false; txtOverrideHeaderAuthor.Enabled = false; txtOverrideHeaderEmail.Enabled = false; txtOverrideHeaderHomepage.Enabled = false; txtOverrideHeaderURL.Enabled = false; txtOverrideHeaderComment.Enabled = false; txtOverrideHeaderCategory.Enabled = false; txtDownloadEmAllUsername.Enabled = false; txtDownloadEmAllPassword.Enabled = false; txtPathDatsDir.Enabled = false; txtPathROMsDir.Enabled = false; chkCheckForLatestVersion.Enabled = false; chkCheckSSLCertificates.Enabled = false; chkSendErrorReports.Enabled = false; cbLanguageLocality.Enabled = false; cbLogLevel.Enabled = false; } #endregion #region Builders /// /// /// /// /// private void BuildDat_DoWork(object sender, DoWorkEventArgs e) { // Run dat builder. DEA.BuildADat(sender, e); } /// /// /// /// /// private void BuildDat_ProgressChanged(object sender, ProgressChangedEventArgs e) { // Display the changed progress status. // UpdateStatusBuildProgress(e.ProgressPercentage); } /// /// /// /// /// private void BuildDat_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { if (e.Cancelled) { // Print to screen Log.Information("Dat builder canceled"); } else if (e.Error != null) { // Print to screen Log.Error("Dat builder failed"); Log.Error(e.Error.Message); } else { // } // Reset the progress status. // UpdateStatusBuildProgress(0); // Disable the cancel button. tssbCancel.Enabled = false; // Print to screen Log.Information("Ready"); // Update the status message label. UpdateStatusMessageLabel("Ready"); // Enable all buttons. Invoke(new EnableAllButtonsDelegate(EnableAllButtons)); } #endregion } }