source: BMXNET_RPMS_dotNET_UTILITIES-BMX/branch/BMX41000/IHS BMX Framework/IndianHealthService.BMXNet.Doc/BuildProcess.cs@ 1435

Last change on this file since 1435 was 1146, checked in by Sam Habiel, 14 years ago

Initial Import of BMX4

File size: 4.0 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Text;
4using DaveSexton.DocProject;
5using DaveSexton.DocProject.Engine;
6
7namespace IndianHealthService.BMXNet.Doc
8{
9 /// <summary>
10 /// Hooks into the DocProject build process for the project in which it's defined.
11 /// </summary>
12 /// <remarks>
13 /// <para>
14 /// This class must be registered with the DocProject in the <em>Active Projects</em>
15 /// tools options page in order for DocProject to instantiate it during a help build.
16 /// </para>
17 /// <para>
18 /// To cancel the build at any time call the <see cref="BuildContext.Cancel" />
19 /// method. The build process will end after the current step is executed,
20 /// unless the step is being executed in the background. In that case, it may
21 /// end immediately.
22 /// </para>
23 /// <para>
24 /// Note: Do not cache instances of the <see cref="BuildContext" /> class. A new
25 /// <see cref="BuildContext" /> is created each time the project is built.
26 /// </para>
27 /// </remarks>
28 public class BuildProcess : BuildProcessComponent
29 {
30 DateTime buildStart, stepStart;
31
32 /// <summary>
33 /// Called before the project's help build starts.
34 /// </summary>
35 /// <param name="context">Provides information about the build process.</param>
36 public override void BuildStarting(BuildContext context)
37 {
38 // Uncomment the following line to break into the debugger:
39 // System.Diagnostics.Debugger.Break();
40
41 buildStart = DateTime.Now;
42 }
43
44 /// <summary>
45 /// Called before a <paramref name="step" /> is executed during a help build.
46 /// </summary>
47 /// <param name="step"><see cref="IBuildStep" /> implementation to be executed.</param>
48 /// <param name="context">Provides information about the build process.</param>
49 /// <returns><b>true</b> indicates that the process should continue, otherwise,
50 /// <b>false</b> indicates that the process should skip this step.</returns>
51 public override bool BeforeExecuteStep(IBuildStep step, BuildContext context)
52 {
53 stepStart = DateTime.Now;
54
55 return true;
56 }
57
58 /// <summary>
59 /// Called after a <paramref name="step" /> has been executed during a help build.
60 /// </summary>
61 /// <param name="step"><see cref="IBuildStep" /> implementation that was executed.</param>
62 /// <param name="context">Provides information about the build process.</param>
63 public override void AfterExecuteStep(IBuildStep step, BuildContext context)
64 {
65 TraceLine();
66 TraceLine("Step {0} Time Elapsed: {1}", context.CurrentStepIndex + 1, DateTime.Now - stepStart);
67 }
68
69 /// <summary>
70 /// Called after the project's help build has finished.
71 /// </summary>
72 /// <remarks>
73 /// The <see cref="BuildContext.Cancel" /> method has no affect at this
74 /// point in the build process. This method is the final step before the
75 /// build statistics are displayed.
76 /// <para>
77 /// This method is always invoked if <see cref="BuildStarting" /> is invoked,
78 /// regardless of whether an exception is thrown in any of the other methods,
79 /// <see cref="BuildContext.Cancel" /> has been called, or an exeception has
80 /// been thrown by the build engine.
81 /// </para>
82 /// <para>
83 /// To determine whether a help build failed or succeeded, examine the value of the
84 /// <see cref="BuildContext.BuildState" /> property.
85 /// </para>
86 /// </remarks>
87 /// <param name="context">Provides information about the build process.</param>
88 public override void BuildCompleted(BuildContext context)
89 {
90 TraceLine();
91 TraceLine("Total Time Elapsed: {0}", DateTime.Now - buildStart);
92 }
93 }
94}
Note: See TracBrowser for help on using the repository browser.