/// <summary> /// This is called by the build process thread to update the main window with information about its /// progress. /// </summary> /// <param name="sender">The sender of the event</param> /// <param name="e">The event arguments</param> private void buildProcess_BuildProgress(object sender, BuildProgressEventArgs e) { if (this.InvokeRequired) { try { // Ignore it if we've already shut down if (!this.IsDisposed) { this.Invoke(new EventHandler <BuildProgressEventArgs>(buildProcess_BuildProgress), new object[] { sender, e }); } } catch (Exception) { // Ignore these as we still get one occasionally due to the object being disposed or the // handle not being valid even though we do check for it first. } } else { if (e.BuildStep == BuildStep.Failed) { MessageBox.Show("Unable to build project to obtain API information. Please perform a " + "normal build to identify and correct the problem.", Constants.AppName, MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
//===================================================================== /// <summary> /// This is used to report build progress /// </summary> /// <param name="e">The event arguments</param> private void buildProcess_ReportProgress(BuildProgressEventArgs e) { if (e.StepChanged) { lblProgress.Text = e.BuildStep.ToString(); } }
/// <summary> /// This is called by the build process thread to update the /// task with information about progress. /// </summary> /// <param name="sender">The sender of the event</param> /// <param name="e">The event arguments</param> private void buildProcess_BuildProgress(object sender, BuildProgressEventArgs e) { Match m = reParseMessage.Match(e.Message); // Always log errors and warnings if (m.Success) { if (String.Compare(m.Groups[3].Value, "warning", StringComparison.OrdinalIgnoreCase) == 0) { Log.LogWarning(null, m.Groups[4].Value, m.Groups[4].Value, m.Groups[1].Value, 0, 0, 0, 0, m.Groups[5].Value.Trim()); } else if (String.Compare(m.Groups[3].Value, "error", StringComparison.OrdinalIgnoreCase) == 0) { Log.LogError(null, m.Groups[4].Value, m.Groups[4].Value, m.Groups[1].Value, 0, 0, 0, 0, m.Groups[5].Value.Trim()); } else { Log.LogMessage(e.Message); } } else if (verbose) { Log.LogMessage(e.Message); } }
/// <summary> /// This is called by the build process thread to update the main /// window with information about its progress. /// </summary> /// <param name="sender">The sender of the event</param> /// <param name="e">The event arguments</param> private void buildProcess_BuildProgress(object sender, BuildProgressEventArgs e) { if (this.InvokeRequired) { // Ignore it if we've already shut down if (!this.IsDisposed) { this.Invoke(new EventHandler <BuildProgressEventArgs>( buildProcess_BuildProgress), new object[] { sender, e }); } } else { if (e.BuildStep == BuildStep.Failed) { MessageBox.Show("Unable to build project to obtain " + "API information. Please perform a normal build " + "to identify and correct the problem.", Constants.AppName, MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
/// <summary> /// This is called by the build process thread to update the main /// window with information about its progress. /// </summary> /// <param name="sender">The sender of the event</param> /// <param name="e">The event arguments</param> private void buildProcess_BuildProgress(object sender, BuildProgressEventArgs e) { if (this.InvokeRequired) { // Ignore it if we've already shut down if (!this.IsDisposed) { this.Invoke(new EventHandler <BuildProgressEventArgs>( buildProcess_BuildProgress), new object[] { sender, e }); } } else { if (e.BuildStep < BuildStep.Completed) { StatusBarTextProvider.UpdateProgress((int)e.BuildStep); } if (Settings.Default.VerboseLogging || e.BuildStep == BuildStep.Failed) { txtOutput.AppendText(e.Message); txtOutput.AppendText("\r\n"); } } }
/// <summary> /// This is called by the build process thread to update the main /// window with the current build step. /// </summary> /// <param name="sender">The sender of the event</param> /// <param name="e">The event arguments</param> private void buildProcess_BuildStepChanged(object sender, BuildProgressEventArgs e) { if (this.InvokeRequired) { // Ignore it if we've already shut down or it hasn't // completed yet. if (!this.IsDisposed) { this.Invoke(new EventHandler <BuildProgressEventArgs>(buildProcess_BuildStepChanged), new object[] { sender, e }); } } else { lblLoading.Text = e.BuildStep.ToString(); if (e.HasCompleted) { // Restore the current project's base path Directory.SetCurrentDirectory(Path.GetDirectoryName(currentProject.Filename)); lastBuildStep = e.BuildStep; } } }
/// <summary> /// This is called by the build process thread to update the /// application with information about progress. /// </summary> /// <param name="sender">The sender of the event</param> /// <param name="e">The event arguments</param> private static void buildProcess_BuildProgress(object sender, BuildProgressEventArgs e) { if (verbose || e.BuildStep == BuildStep.Failed) { Console.WriteLine(e.Message); } }
/// <summary> /// This is called by the build process thread to update the /// application with the current build step. /// </summary> /// <param name="sender">The sender of the event</param> /// <param name="e">The event arguments</param> private void buildProcess_BuildStepChanged(object sender, BuildProgressEventArgs e) { string outputPath; if (!verbose) { Log.LogMessage(e.BuildStep.ToString()); } if (e.HasCompleted) { // If successful, report the location of the help file/website if (e.BuildStep == BuildStep.Completed) { outputPath = buildProcess.OutputFolder + sandcastleProject.HtmlHelpName; switch (sandcastleProject.HelpFileFormat) { case HelpFileFormat.HtmlHelp1: outputPath += ".chm"; break; case HelpFileFormat.MSHelp2: outputPath += ".hxs"; break; case HelpFileFormat.MSHelpViewer: outputPath += ".mshc"; break; default: break; } // Report single file or multi-format output location if (File.Exists(outputPath)) { Log.LogMessage("The help file is located at: {0}", outputPath); } else { Log.LogMessage("The help output is located at: {0}", buildProcess.OutputFolder); } } if (File.Exists(buildProcess.LogFilename)) { Log.LogMessage("Build details can be found in {0}", buildProcess.LogFilename); } } lastBuildStep = e.BuildStep; }
/// <summary> /// This is called by the build process thread to update the /// application with the current build step. /// </summary> /// <param name="sender">The sender of the event</param> /// <param name="e">The event arguments</param> private static void buildProcess_BuildStepChanged(object sender, BuildProgressEventArgs e) { string outputPath; if (!verbose) { Console.WriteLine(e.BuildStep.ToString()); } if (e.HasCompleted) { // If successful, report the location of the help file/website if (e.BuildStep == BuildStep.Completed) { outputPath = buildProcess.OutputFolder + currentProject.HtmlHelpName; if (currentProject.HelpFileFormat == HelpFileFormat.HtmlHelp1x) { outputPath += ".chm"; } else if (currentProject.HelpFileFormat == HelpFileFormat.HtmlHelp2x) { outputPath += ".hxs"; } // Report single file or multi-format output location if (File.Exists(outputPath)) { Console.WriteLine("The help file is located at: {0}", outputPath); } else { Console.WriteLine("The help output is located at: {0}", buildProcess.OutputFolder); } } if (File.Exists(buildProcess.LogFilename)) { Console.WriteLine("Build details can be found in {0}", buildProcess.LogFilename); } } lastBuildStep = e.BuildStep; }
//===================================================================== /// <summary> /// This is called by the build process thread to update the main window with the current build step /// </summary> /// <param name="sender">The sender of the event</param> /// <param name="e">The event arguments</param> private void buildProcess_BuildStepChanged(object sender, BuildProgressEventArgs e) { if (this.InvokeRequired) { try { // Ignore it if we've already shut down or it hasn't completed yet if (!this.IsDisposed) { this.Invoke(new EventHandler <BuildProgressEventArgs>(buildProcess_BuildStepChanged), new object[] { sender, e }); } } catch (Exception) { // Ignore these as we still get one occasionally due to the object being disposed or the // handle not being valid even though we do check for it first. } } else { lblProgress.Text = e.BuildStep.ToString(); if (e.HasCompleted) { // Switch back to the current project's folder Directory.SetCurrentDirectory(Path.GetDirectoryName(nsColl.Project.Filename)); // If successful, load the namespace nodes, and enable the UI if (e.BuildStep == BuildStep.Completed) { this.LoadNamespaces(buildProcess.ReflectionInfoFilename); cboAssembly.Enabled = txtSearchText.Enabled = btnApplyFilter.Enabled = btnAll.Enabled = btnNone.Enabled = true; } pbWait.Visible = lblProgress.Visible = false; lbNamespaces.Focus(); buildThread = null; buildProcess = null; } } }
private void OnProgressUpdated(object sender, BuildProgressEventArgs args) { this.synchronizationContext.Post((args) => { var eventArgs = args as BuildProgressEventArgs; this.StatusText.Text = eventArgs.Message; this.BuildProgressBar.Value = eventArgs.GetPercent(); if (eventArgs.BuildStatus == BuildStatus.Failed) { this.BuildProgressBar.Foreground = Brushes.Red; } if (eventArgs.BuildStatus == BuildStatus.Success) { if (!Engine.App.Config.Get <bool>("site.debug")) { this.OutputBox.Clear(); // 防止内存占用不断增大 } } }, args); }
/// <summary> /// This is called by the build process thread to update the task with information about progress /// </summary> /// <param name="sender">The sender of the event</param> /// <param name="e">The event arguments</param> private void buildProcess_BuildProgress(object sender, BuildProgressEventArgs e) { Match m = reParseMessage.Match(e.Message); // Always log errors and warnings if (m.Success) { if (String.Compare(m.Groups[3].Value, "warning", StringComparison.OrdinalIgnoreCase) == 0) { Log.LogWarning(null, m.Groups[4].Value, m.Groups[4].Value, m.Groups[1].Value, 0, 0, 0, 0, m.Groups[5].Value.Trim()); } else if (String.Compare(m.Groups[3].Value, "error", StringComparison.OrdinalIgnoreCase) == 0) { Log.LogError(null, m.Groups[4].Value, m.Groups[4].Value, m.Groups[1].Value, 0, 0, 0, 0, m.Groups[5].Value.Trim()); } else { Log.LogMessage(MessageImportance.High, e.Message); } } else if (this.Verbose) { Log.LogMessage(MessageImportance.High, e.Message); } else { // If not doing verbose logging, show warnings and let MSBuild filter them out if not // wanted. Errors will kill the build so we don't have to deal with them here. if (reWarning.IsMatch(e.Message)) { Log.LogWarning(e.Message); } } }
/// <summary> /// This is called by the build process thread to update the application with the current build step /// </summary> /// <param name="sender">The sender of the event</param> /// <param name="e">The event arguments</param> private void buildProcess_BuildStepChanged(object sender, BuildProgressEventArgs e) { builder.ReportProgress(e.BuildStep.ToString()); lastBuildStep = e.BuildStep; }
/// <summary> /// This is called by the build process thread to update the main /// window with the current build step. /// </summary> /// <param name="sender">The sender of the event</param> /// <param name="e">The event arguments</param> private void buildProcess_BuildStepChanged(object sender, BuildProgressEventArgs e) { string outputPath; if (this.InvokeRequired) { // Ignore it if we've already shut down or it hasn't // completed yet. if (!this.IsDisposed) { this.Invoke(new EventHandler <BuildProgressEventArgs>( buildProcess_BuildStepChanged), new object[] { sender, e }); } } else { if (!Settings.Default.VerboseLogging) { txtOutput.AppendText(e.BuildStep.ToString()); txtOutput.AppendText("\r\n"); } if (e.HasCompleted) { StatusBarTextProvider.ResetProgressBar(); this.SetUIEnabledState(true); // Save the output log filename and help filename on // completion if possible outputPath = buildProcess.OutputFolder; if (Directory.Exists(outputPath)) { lastOutputLog = buildProcess.LogFilename; } else { lastOutputLog = null; } // Store the help file filename so that it can be viewed // if it exists. if (e.BuildStep == BuildStep.Completed) { switch (project.HelpFileFormat) { case HelpFileFormat.HtmlHelp1x: case HelpFileFormat.Help1xAndHelp2x: outputPath += project.HtmlHelpName + ".chm"; break; case HelpFileFormat.HtmlHelp2x: outputPath += project.HtmlHelpName + ".hxs"; break; default: outputPath += "Index.html"; break; } if (File.Exists(outputPath)) { lastBuiltHelpFile = outputPath; } } buildThread = null; buildProcess = null; } } }