| 0: | using System; | |
| 1: | using System.Drawing; | |
| 2: | using System.Collections; | |
| 3: | using System.ComponentModel; | |
| 4: | using System.Windows.Forms; | |
| 5: | using System.Threading; | |
| 6: | using XMarksTheDOT.Documenter; | |
| 7: | ||
| 8: | namespace SharpDevelop.Gui.HelpFileGenerator | |
| 9: | { | |
| 10: | /// <summary> | |
| 11: | /// Summary description for BuildForm. | |
| 12: | /// </summary> | |
| 13: | public class BuildForm : System.Windows.Forms.Form | |
| 14: | { | |
| 15: | private System.Windows.Forms.Button cancelButton; | |
| 16: | private System.Windows.Forms.ProgressBar progressBar1; | |
| 17: | /// <summary> | |
| 18: | /// Required designer variable. | |
| 19: | /// </summary> | |
| 20: | private System.ComponentModel.Container components = null; | |
| 21: | ||
| 22: | private Thread buildThread; | |
| 23: | private IDocumenter documenter; | |
| 24: | private ArrayList assemblySlashDocs; | |
| 25: | private System.Windows.Forms.Label statusLabel; | |
| 26: | private System.Windows.Forms.ProgressBar progressBar2; | |
| 27: | private Hashtable namespaceSummaries; | |
| 28: | ||
| 29: | public BuildForm() | |
| 30: | { | |
| 31: | // | |
| 32: | // Required for Windows Form Designer support | |
| 33: | // | |
| 34: | InitializeComponent(); | |
| 35: | TopMost = true; | |
| 36: | ||
| 37: | // | |
| 38: | // TODO: Add any constructor code after InitializeComponent call | |
| 39: | // | |
| 40: | } | |
| 41: | ||
| 42: | /// <summary> | |
| 43: | /// Clean up any resources being used. | |
| 44: | /// </summary> | |
| 45: | protected override void Dispose(bool disposing) | |
| 46: | { | |
| 47: | if (disposing) { | |
| 48: | if (components != null){ | |
| 49: | components.Dispose(); | |
| 50: | } | |
| 51: | } | |
| 52: | base.Dispose(disposing); | |
| 53: | } | |
| 54: | ||
| 55: | #region Windows Form Designer generated code | |
| 56: | /// <summary> | |
| 57: | /// Required method for Designer support - do not modify | |
| 58: | /// the contents of this method with the code editor. | |
| 59: | /// </summary> | |
| 60: | private void InitializeComponent() | |
| 61: | { | |
| 62: | this.cancelButton = new System.Windows.Forms.Button(); | |
| 63: | this.progressBar1 = new System.Windows.Forms.ProgressBar(); | |
| 64: | this.statusLabel = new System.Windows.Forms.Label(); | |
| 65: | this.progressBar2 = new System.Windows.Forms.ProgressBar(); | |
| 66: | this.SuspendLayout(); | |
| 67: | // | |
| 68: | // cancelButton | |
| 69: | // | |
| 70: | this.cancelButton.Location = new System.Drawing.Point(112, 104); | |
| 71: | this.cancelButton.Name = "cancelButton"; | |
| 72: | this.cancelButton.TabIndex = 0; | |
| 73: | this.cancelButton.Text = "&Cancel"; | |
| 74: | this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click); | |
| 75: | // | |
| 76: | // progressBar1 | |
| 77: | // | |
| 78: | this.progressBar1.Location = new System.Drawing.Point(16, 16); | |
| 79: | this.progressBar1.Name = "progressBar1"; | |
| 80: | this.progressBar1.Size = new System.Drawing.Size(264, 16); | |
| 81: | this.progressBar1.TabIndex = 1; | |
| 82: | // | |
| 83: | // statusLabel | |
| 84: | // | |
| 85: | this.statusLabel.Location = new System.Drawing.Point(16, 80); | |
| 86: | this.statusLabel.Name = "statusLabel"; | |
| 87: | this.statusLabel.Size = new System.Drawing.Size(264, 16); | |
| 88: | this.statusLabel.TabIndex = 2; | |
| 89: | this.statusLabel.Text = "Please wait..."; | |
| 90: | // | |
| 91: | // progressBar2 | |
| 92: | // | |
| 93: | this.progressBar2.Location = new System.Drawing.Point(16, 48); | |
| 94: | this.progressBar2.Name = "progressBar2"; | |
| 95: | this.progressBar2.Size = new System.Drawing.Size(264, 16); | |
| 96: | this.progressBar2.TabIndex = 1; | |
| 97: | // | |
| 98: | // BuildForm | |
| 99: | // | |
| 100: | this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); | |
| 101: | this.ClientSize = new System.Drawing.Size(306, 146); | |
| 102: | this.ControlBox = false; | |
| 103: | this.Controls.AddRange(new System.Windows.Forms.Control[] { | |
| 104: | this.progressBar2, | |
| 105: | this.statusLabel, | |
| 106: | this.progressBar1, | |
| 107: | this.cancelButton}); | |
| 108: | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; | |
| 109: | this.Name = "BuildForm"; | |
| 110: | this.ShowInTaskbar = false; | |
| 111: | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; | |
| 112: | this.Text = "Building Documentation"; | |
| 113: | this.Load += new System.EventHandler(this.BuildForm_Load); | |
| 114: | this.ResumeLayout(false); | |
| 115: | ||
| 116: | } | |
| 117: | #endregion | |
| 118: | ||
| 119: | protected void DoBuild() | |
| 120: | { | |
| 121: | try | |
| 122: | { | |
| 123: | // Build the documentation. | |
| 124: | Project p = new Project(); | |
| 125: | p.AssemblySlashDocs = assemblySlashDocs; | |
| 126: | p.NamespaceSummaries = namespaceSummaries; | |
| 127: | documenter.Build(p); | |
| 128: | } | |
| 129: | catch (DocumenterException docEx) | |
| 130: | { | |
| 131: | MessageBox.Show( | |
| 132: | docEx.Message, | |
| 133: | "Unable to Build", | |
| 134: | MessageBoxButtons.OK, | |
| 135: | MessageBoxIcon.Information); | |
| 136: | } | |
| 137: | catch (ThreadAbortException) | |
| 138: | { | |
| 139: | //ignore... | |
| 140: | } | |
| 141: | catch (Exception ex) | |
| 142: | { | |
| 143: | MessageBox.Show(ex.ToString()); | |
| 144: | MessageBox.Show( | |
| 145: | "An error occured while trying to build the documentation.", | |
| 146: | "WinDoc Error", | |
| 147: | MessageBoxButtons.OK, | |
| 148: | MessageBoxIcon.Error); | |
| 149: | } | |
| 150: | finally | |
| 151: | { | |
| 152: | this.Hide(); | |
| 153: | } | |
| 154: | } | |
| 155: | ||
| 156: | public void OnDocBuildingStep(object sender, ProgressArgs e) | |
| 157: | { | |
| 158: | progressBar2.Value = e.Progress; | |
| 159: | if (e.Status.Length > 0) | |
| 160: | statusLabel.Text = e.Status; | |
| 161: | } | |
| 162: | ||
| 163: | public void OnDocBuildingProgress(object sender, ProgressArgs e) | |
| 164: | { | |
| 165: | progressBar1.Value = e.Progress; | |
| 166: | //if (e.Status.Length > 0) | |
| 167: | // statusLabel.Text = e.Status; | |
| 168: | } | |
| 169: | ||
| 170: | public void Start( | |
| 171: | IDocumenter documenter, | |
| 172: | ArrayList assemblySlashDocs, | |
| 173: | Hashtable namespaceSummaries) | |
| 174: | { | |
| 175: | this.documenter = documenter; | |
| 176: | this.assemblySlashDocs = assemblySlashDocs; | |
| 177: | this.namespaceSummaries = namespaceSummaries; | |
| 178: | this.documenter.DocBuildingProgress += new DocBuildingEventHandler(OnDocBuildingProgress); | |
| 179: | this.documenter.DocBuildingStep += new DocBuildingEventHandler(OnDocBuildingStep); | |
| 180: | ||
| 181: | cancelButton.Enabled = true; | |
| 182: | ||
| 183: | buildThread = new Thread(new ThreadStart(DoBuild)); | |
| 184: | buildThread.Start(); | |
| 185: | ||
| 186: | progressBar1.Value = 0; | |
| 187: | } | |
| 188: | ||
| 189: | private void cancelButton_Click(object sender, System.EventArgs e) | |
| 190: | { | |
| 191: | cancelButton.Enabled = false; | |
| 192: | statusLabel.Text = "Canceling..."; | |
| 193: | buildThread.Abort(); | |
| 194: | //documenter.AbortBuild(); | |
| 195: | } | |
| 196: | ||
| 197: | private void BuildForm_Load(object sender, System.EventArgs e) | |
| 198: | { | |
| 199: | ||
| 200: | } | |
| 201: | } | |
| 202: | } |
This page was automatically generated by SharpDevelop.