# HG changeset patch # User sl # Date 1421515601 -3600 # Node ID 61e2e2d41c0a69934956a23a86a2a03109369349 # Parent aa157e129c420d482a96d2dfddd27a3bc353c433 Adding progress dialog. diff -r aa157e129c42 -r 61e2e2d41c0a Server/ProgressForm.Designer.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Server/ProgressForm.Designer.cs Sat Jan 17 18:26:41 2015 +0100 @@ -0,0 +1,88 @@ +namespace BackgroundWorkerDemo +{ + partial class ProgressForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.labelMessage = new System.Windows.Forms.Label(); + this.progressBar1 = new System.Windows.Forms.ProgressBar(); + this.buttonCancel = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // labelMessage + // + this.labelMessage.AutoSize = true; + this.labelMessage.Location = new System.Drawing.Point(44, 25); + this.labelMessage.Name = "labelMessage"; + this.labelMessage.Size = new System.Drawing.Size(127, 13); + this.labelMessage.TabIndex = 0; + this.labelMessage.Text = "In progress, please wait..."; + // + // progressBar1 + // + this.progressBar1.Location = new System.Drawing.Point(47, 52); + this.progressBar1.Name = "progressBar1"; + this.progressBar1.Size = new System.Drawing.Size(195, 23); + this.progressBar1.TabIndex = 1; + // + // buttonCancel + // + this.buttonCancel.Location = new System.Drawing.Point(167, 83); + this.buttonCancel.Name = "buttonCancel"; + this.buttonCancel.Size = new System.Drawing.Size(75, 23); + this.buttonCancel.TabIndex = 2; + this.buttonCancel.Text = "Cancel"; + this.buttonCancel.UseVisualStyleBackColor = true; + this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click); + // + // AlertForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(280, 127); + this.ControlBox = false; + this.Controls.Add(this.buttonCancel); + this.Controls.Add(this.progressBar1); + this.Controls.Add(this.labelMessage); + this.Name = "AlertForm"; + this.ShowIcon = false; + this.ShowInTaskbar = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "Processing"; + this.TopMost = true; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label labelMessage; + private System.Windows.Forms.ProgressBar progressBar1; + private System.Windows.Forms.Button buttonCancel; + } +} \ No newline at end of file diff -r aa157e129c42 -r 61e2e2d41c0a Server/ProgressForm.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Server/ProgressForm.cs Sat Jan 17 18:26:41 2015 +0100 @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Windows.Forms; + +namespace BackgroundWorkerDemo +{ + public partial class ProgressForm : Form + { + + #region PROPERTIES + + public string Message + { + set { labelMessage.Text = value; } + } + + public int ProgressValue + { + set { progressBar1.Value = value; } + } + + #endregion + + #region METHODS + + public ProgressForm() + { + InitializeComponent(); + } + + #endregion + + #region EVENTS + + public event EventHandler Canceled; + + private void buttonCancel_Click(object sender, EventArgs e) + { + // Create a copy of the event to work with + EventHandler ea = Canceled; + /* If there are no subscribers, eh will be null so we need to check + * to avoid a NullReferenceException. */ + if (ea != null) + ea(this, e); + } + + #endregion + + } +} diff -r aa157e129c42 -r 61e2e2d41c0a Server/ProgressForm.resx --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Server/ProgressForm.resx Sat Jan 17 18:26:41 2015 +0100 @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff -r aa157e129c42 -r 61e2e2d41c0a Server/SharpDisplayManager.csproj --- a/Server/SharpDisplayManager.csproj Sat Jan 17 10:57:30 2015 +0100 +++ b/Server/SharpDisplayManager.csproj Sat Jan 17 18:26:41 2015 +0100 @@ -133,6 +133,12 @@ + + Form + + + ProgressForm.cs + @@ -142,6 +148,9 @@ MainForm.cs + + ProgressForm.cs + ResXFileCodeGenerator Resources.Designer.cs