Adding progress dialog.
authorsl
Sat, 17 Jan 2015 18:26:41 +0100
changeset 9161e2e2d41c0a
parent 90 aa157e129c42
child 92 787dee27fc0a
Adding progress dialog.
Server/ProgressForm.Designer.cs
Server/ProgressForm.cs
Server/ProgressForm.resx
Server/SharpDisplayManager.csproj
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/Server/ProgressForm.Designer.cs	Sat Jan 17 18:26:41 2015 +0100
     1.3 @@ -0,0 +1,88 @@
     1.4 +namespace BackgroundWorkerDemo
     1.5 +{
     1.6 +    partial class ProgressForm
     1.7 +    {
     1.8 +        /// <summary>
     1.9 +        /// Required designer variable.
    1.10 +        /// </summary>
    1.11 +        private System.ComponentModel.IContainer components = null;
    1.12 +
    1.13 +        /// <summary>
    1.14 +        /// Clean up any resources being used.
    1.15 +        /// </summary>
    1.16 +        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
    1.17 +        protected override void Dispose(bool disposing)
    1.18 +        {
    1.19 +            if (disposing && (components != null))
    1.20 +            {
    1.21 +                components.Dispose();
    1.22 +            }
    1.23 +            base.Dispose(disposing);
    1.24 +        }
    1.25 +
    1.26 +        #region Windows Form Designer generated code
    1.27 +
    1.28 +        /// <summary>
    1.29 +        /// Required method for Designer support - do not modify
    1.30 +        /// the contents of this method with the code editor.
    1.31 +        /// </summary>
    1.32 +        private void InitializeComponent()
    1.33 +        {
    1.34 +            this.labelMessage = new System.Windows.Forms.Label();
    1.35 +            this.progressBar1 = new System.Windows.Forms.ProgressBar();
    1.36 +            this.buttonCancel = new System.Windows.Forms.Button();
    1.37 +            this.SuspendLayout();
    1.38 +            // 
    1.39 +            // labelMessage
    1.40 +            // 
    1.41 +            this.labelMessage.AutoSize = true;
    1.42 +            this.labelMessage.Location = new System.Drawing.Point(44, 25);
    1.43 +            this.labelMessage.Name = "labelMessage";
    1.44 +            this.labelMessage.Size = new System.Drawing.Size(127, 13);
    1.45 +            this.labelMessage.TabIndex = 0;
    1.46 +            this.labelMessage.Text = "In progress, please wait...";
    1.47 +            // 
    1.48 +            // progressBar1
    1.49 +            // 
    1.50 +            this.progressBar1.Location = new System.Drawing.Point(47, 52);
    1.51 +            this.progressBar1.Name = "progressBar1";
    1.52 +            this.progressBar1.Size = new System.Drawing.Size(195, 23);
    1.53 +            this.progressBar1.TabIndex = 1;
    1.54 +            // 
    1.55 +            // buttonCancel
    1.56 +            // 
    1.57 +            this.buttonCancel.Location = new System.Drawing.Point(167, 83);
    1.58 +            this.buttonCancel.Name = "buttonCancel";
    1.59 +            this.buttonCancel.Size = new System.Drawing.Size(75, 23);
    1.60 +            this.buttonCancel.TabIndex = 2;
    1.61 +            this.buttonCancel.Text = "Cancel";
    1.62 +            this.buttonCancel.UseVisualStyleBackColor = true;
    1.63 +            this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click);
    1.64 +            // 
    1.65 +            // AlertForm
    1.66 +            // 
    1.67 +            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    1.68 +            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    1.69 +            this.ClientSize = new System.Drawing.Size(280, 127);
    1.70 +            this.ControlBox = false;
    1.71 +            this.Controls.Add(this.buttonCancel);
    1.72 +            this.Controls.Add(this.progressBar1);
    1.73 +            this.Controls.Add(this.labelMessage);
    1.74 +            this.Name = "AlertForm";
    1.75 +            this.ShowIcon = false;
    1.76 +            this.ShowInTaskbar = false;
    1.77 +            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
    1.78 +            this.Text = "Processing";
    1.79 +            this.TopMost = true;
    1.80 +            this.ResumeLayout(false);
    1.81 +            this.PerformLayout();
    1.82 +
    1.83 +        }
    1.84 +
    1.85 +        #endregion
    1.86 +
    1.87 +        private System.Windows.Forms.Label labelMessage;
    1.88 +        private System.Windows.Forms.ProgressBar progressBar1;
    1.89 +        private System.Windows.Forms.Button buttonCancel;
    1.90 +    }
    1.91 +}
    1.92 \ No newline at end of file
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/Server/ProgressForm.cs	Sat Jan 17 18:26:41 2015 +0100
     2.3 @@ -0,0 +1,55 @@
     2.4 +using System;
     2.5 +using System.Collections.Generic;
     2.6 +using System.ComponentModel;
     2.7 +using System.Data;
     2.8 +using System.Drawing;
     2.9 +using System.Linq;
    2.10 +using System.Text;
    2.11 +using System.Windows.Forms;
    2.12 +
    2.13 +namespace BackgroundWorkerDemo
    2.14 +{
    2.15 +    public partial class ProgressForm : Form
    2.16 +    {
    2.17 +
    2.18 +        #region PROPERTIES
    2.19 +
    2.20 +        public string Message
    2.21 +        {
    2.22 +            set { labelMessage.Text = value; }
    2.23 +        }
    2.24 +
    2.25 +        public int ProgressValue
    2.26 +        {
    2.27 +            set { progressBar1.Value = value; }
    2.28 +        }
    2.29 +
    2.30 +        #endregion
    2.31 +
    2.32 +        #region METHODS
    2.33 +
    2.34 +        public ProgressForm()
    2.35 +        {
    2.36 +            InitializeComponent();
    2.37 +        }
    2.38 +
    2.39 +        #endregion
    2.40 +
    2.41 +        #region EVENTS
    2.42 +
    2.43 +        public event EventHandler<EventArgs> Canceled;
    2.44 +
    2.45 +        private void buttonCancel_Click(object sender, EventArgs e)
    2.46 +        {
    2.47 +            // Create a copy of the event to work with
    2.48 +            EventHandler<EventArgs> ea = Canceled;
    2.49 +            /* If there are no subscribers, eh will be null so we need to check
    2.50 +             * to avoid a NullReferenceException. */
    2.51 +            if (ea != null)
    2.52 +                ea(this, e);
    2.53 +        }
    2.54 +
    2.55 +        #endregion
    2.56 +
    2.57 +    }
    2.58 +}
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/Server/ProgressForm.resx	Sat Jan 17 18:26:41 2015 +0100
     3.3 @@ -0,0 +1,120 @@
     3.4 +<?xml version="1.0" encoding="utf-8"?>
     3.5 +<root>
     3.6 +  <!-- 
     3.7 +    Microsoft ResX Schema 
     3.8 +    
     3.9 +    Version 2.0
    3.10 +    
    3.11 +    The primary goals of this format is to allow a simple XML format 
    3.12 +    that is mostly human readable. The generation and parsing of the 
    3.13 +    various data types are done through the TypeConverter classes 
    3.14 +    associated with the data types.
    3.15 +    
    3.16 +    Example:
    3.17 +    
    3.18 +    ... ado.net/XML headers & schema ...
    3.19 +    <resheader name="resmimetype">text/microsoft-resx</resheader>
    3.20 +    <resheader name="version">2.0</resheader>
    3.21 +    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
    3.22 +    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
    3.23 +    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
    3.24 +    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
    3.25 +    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
    3.26 +        <value>[base64 mime encoded serialized .NET Framework object]</value>
    3.27 +    </data>
    3.28 +    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
    3.29 +        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
    3.30 +        <comment>This is a comment</comment>
    3.31 +    </data>
    3.32 +                
    3.33 +    There are any number of "resheader" rows that contain simple 
    3.34 +    name/value pairs.
    3.35 +    
    3.36 +    Each data row contains a name, and value. The row also contains a 
    3.37 +    type or mimetype. Type corresponds to a .NET class that support 
    3.38 +    text/value conversion through the TypeConverter architecture. 
    3.39 +    Classes that don't support this are serialized and stored with the 
    3.40 +    mimetype set.
    3.41 +    
    3.42 +    The mimetype is used for serialized objects, and tells the 
    3.43 +    ResXResourceReader how to depersist the object. This is currently not 
    3.44 +    extensible. For a given mimetype the value must be set accordingly:
    3.45 +    
    3.46 +    Note - application/x-microsoft.net.object.binary.base64 is the format 
    3.47 +    that the ResXResourceWriter will generate, however the reader can 
    3.48 +    read any of the formats listed below.
    3.49 +    
    3.50 +    mimetype: application/x-microsoft.net.object.binary.base64
    3.51 +    value   : The object must be serialized with 
    3.52 +            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
    3.53 +            : and then encoded with base64 encoding.
    3.54 +    
    3.55 +    mimetype: application/x-microsoft.net.object.soap.base64
    3.56 +    value   : The object must be serialized with 
    3.57 +            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
    3.58 +            : and then encoded with base64 encoding.
    3.59 +
    3.60 +    mimetype: application/x-microsoft.net.object.bytearray.base64
    3.61 +    value   : The object must be serialized into a byte array 
    3.62 +            : using a System.ComponentModel.TypeConverter
    3.63 +            : and then encoded with base64 encoding.
    3.64 +    -->
    3.65 +  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
    3.66 +    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
    3.67 +    <xsd:element name="root" msdata:IsDataSet="true">
    3.68 +      <xsd:complexType>
    3.69 +        <xsd:choice maxOccurs="unbounded">
    3.70 +          <xsd:element name="metadata">
    3.71 +            <xsd:complexType>
    3.72 +              <xsd:sequence>
    3.73 +                <xsd:element name="value" type="xsd:string" minOccurs="0" />
    3.74 +              </xsd:sequence>
    3.75 +              <xsd:attribute name="name" use="required" type="xsd:string" />
    3.76 +              <xsd:attribute name="type" type="xsd:string" />
    3.77 +              <xsd:attribute name="mimetype" type="xsd:string" />
    3.78 +              <xsd:attribute ref="xml:space" />
    3.79 +            </xsd:complexType>
    3.80 +          </xsd:element>
    3.81 +          <xsd:element name="assembly">
    3.82 +            <xsd:complexType>
    3.83 +              <xsd:attribute name="alias" type="xsd:string" />
    3.84 +              <xsd:attribute name="name" type="xsd:string" />
    3.85 +            </xsd:complexType>
    3.86 +          </xsd:element>
    3.87 +          <xsd:element name="data">
    3.88 +            <xsd:complexType>
    3.89 +              <xsd:sequence>
    3.90 +                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
    3.91 +                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
    3.92 +              </xsd:sequence>
    3.93 +              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
    3.94 +              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
    3.95 +              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
    3.96 +              <xsd:attribute ref="xml:space" />
    3.97 +            </xsd:complexType>
    3.98 +          </xsd:element>
    3.99 +          <xsd:element name="resheader">
   3.100 +            <xsd:complexType>
   3.101 +              <xsd:sequence>
   3.102 +                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
   3.103 +              </xsd:sequence>
   3.104 +              <xsd:attribute name="name" type="xsd:string" use="required" />
   3.105 +            </xsd:complexType>
   3.106 +          </xsd:element>
   3.107 +        </xsd:choice>
   3.108 +      </xsd:complexType>
   3.109 +    </xsd:element>
   3.110 +  </xsd:schema>
   3.111 +  <resheader name="resmimetype">
   3.112 +    <value>text/microsoft-resx</value>
   3.113 +  </resheader>
   3.114 +  <resheader name="version">
   3.115 +    <value>2.0</value>
   3.116 +  </resheader>
   3.117 +  <resheader name="reader">
   3.118 +    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   3.119 +  </resheader>
   3.120 +  <resheader name="writer">
   3.121 +    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   3.122 +  </resheader>
   3.123 +</root>
   3.124 \ No newline at end of file
     4.1 --- a/Server/SharpDisplayManager.csproj	Sat Jan 17 10:57:30 2015 +0100
     4.2 +++ b/Server/SharpDisplayManager.csproj	Sat Jan 17 18:26:41 2015 +0100
     4.3 @@ -133,6 +133,12 @@
     4.4      </Compile>
     4.5      <Compile Include="MarqueeLabel.cs" />
     4.6      <Compile Include="Program.cs" />
     4.7 +    <Compile Include="ProgressForm.cs">
     4.8 +      <SubType>Form</SubType>
     4.9 +    </Compile>
    4.10 +    <Compile Include="ProgressForm.Designer.cs">
    4.11 +      <DependentUpon>ProgressForm.cs</DependentUpon>
    4.12 +    </Compile>
    4.13      <Compile Include="Properties\AssemblyInfo.cs" />
    4.14      <Compile Include="Session.cs" />
    4.15      <Compile Include="Settings.cs" />
    4.16 @@ -142,6 +148,9 @@
    4.17      <EmbeddedResource Include="MainForm.resx">
    4.18        <DependentUpon>MainForm.cs</DependentUpon>
    4.19      </EmbeddedResource>
    4.20 +    <EmbeddedResource Include="ProgressForm.resx">
    4.21 +      <DependentUpon>ProgressForm.cs</DependentUpon>
    4.22 +    </EmbeddedResource>
    4.23      <EmbeddedResource Include="Properties\Resources.resx">
    4.24        <Generator>ResXFileCodeGenerator</Generator>
    4.25        <LastGenOutput>Resources.Designer.cs</LastGenOutput>