Sorting out form and labels.
authorsl
Mon, 22 Dec 2014 11:54:44 +0100
changeset 3898cd08fa1d6d
parent 37 83b3361510a7
child 39 53886b25c49d
Sorting out form and labels.
MainForm.cs
MainForm.resx
     1.1 --- a/MainForm.cs	Mon Dec 22 11:43:55 2014 +0100
     1.2 +++ b/MainForm.cs	Mon Dec 22 11:54:44 2014 +0100
     1.3 @@ -16,10 +16,10 @@
     1.4  		/// <summary>
     1.5  		/// Required designer variable.
     1.6  		/// </summary>
     1.7 -		private System.ComponentModel.Container components = null;
     1.8 -		private System.Windows.Forms.Label label1;
     1.9 -		private RemoteControlDevice _remote;
    1.10 -		private System.Windows.Forms.Label label2;
    1.11 +        private System.ComponentModel.Container components = null;
    1.12 +        private RemoteControlDevice _remote;
    1.13 +        private Label labelButtonName;
    1.14 +        private Label labelDeviceName;
    1.15  		private Timer _timer;
    1.16  
    1.17  		public MainForm()
    1.18 @@ -57,42 +57,42 @@
    1.19  		/// </summary>
    1.20  		private void InitializeComponent()
    1.21  		{
    1.22 -			this.label1 = new System.Windows.Forms.Label();
    1.23 -			this.label2 = new System.Windows.Forms.Label();
    1.24 -			this.SuspendLayout();
    1.25 -			//
    1.26 -			// label1
    1.27 -			//
    1.28 -			this.label1.Dock = System.Windows.Forms.DockStyle.Fill;
    1.29 -			this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 36F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
    1.30 -			this.label1.ForeColor = System.Drawing.Color.White;
    1.31 -			this.label1.Location = new System.Drawing.Point(0, 0);
    1.32 -			this.label1.Name = "label1";
    1.33 -			this.label1.Size = new System.Drawing.Size(736, 266);
    1.34 -			this.label1.TabIndex = 0;
    1.35 -			this.label1.Text = "Ready...";
    1.36 -			this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
    1.37 -			//
    1.38 -			// label2
    1.39 -			//
    1.40 -			this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
    1.41 -			this.label2.Location = new System.Drawing.Point(72, 32);
    1.42 -			this.label2.Name = "label2";
    1.43 -			this.label2.Size = new System.Drawing.Size(576, 23);
    1.44 -			this.label2.TabIndex = 1;
    1.45 -			this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
    1.46 -			//
    1.47 -			// Form1
    1.48 -			//
    1.49 -			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
    1.50 -			this.BackColor = System.Drawing.Color.LightSteelBlue;
    1.51 -			this.ClientSize = new System.Drawing.Size(736, 266);
    1.52 -			this.Controls.Add(this.label2);
    1.53 -			this.Controls.Add(this.label1);
    1.54 -			this.Name = "Form1";
    1.55 -			this.Text = "Remote Control Sample";
    1.56 -			this.Load += new System.EventHandler(this.Form1_Load);
    1.57 -			this.ResumeLayout(false);
    1.58 +            this.labelButtonName = new System.Windows.Forms.Label();
    1.59 +            this.labelDeviceName = new System.Windows.Forms.Label();
    1.60 +            this.SuspendLayout();
    1.61 +            // 
    1.62 +            // labelButtonName
    1.63 +            // 
    1.64 +            this.labelButtonName.AutoSize = true;
    1.65 +            this.labelButtonName.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
    1.66 +            this.labelButtonName.Location = new System.Drawing.Point(257, 97);
    1.67 +            this.labelButtonName.Name = "labelButtonName";
    1.68 +            this.labelButtonName.Size = new System.Drawing.Size(103, 20);
    1.69 +            this.labelButtonName.TabIndex = 0;
    1.70 +            this.labelButtonName.Text = "Button Name";
    1.71 +            // 
    1.72 +            // labelDeviceName
    1.73 +            // 
    1.74 +            this.labelDeviceName.AutoSize = true;
    1.75 +            this.labelDeviceName.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
    1.76 +            this.labelDeviceName.Location = new System.Drawing.Point(257, 67);
    1.77 +            this.labelDeviceName.Name = "labelDeviceName";
    1.78 +            this.labelDeviceName.Size = new System.Drawing.Size(103, 20);
    1.79 +            this.labelDeviceName.TabIndex = 1;
    1.80 +            this.labelDeviceName.Text = "Device Name";
    1.81 +            // 
    1.82 +            // MainForm
    1.83 +            // 
    1.84 +            this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
    1.85 +            this.BackColor = System.Drawing.SystemColors.Control;
    1.86 +            this.ClientSize = new System.Drawing.Size(784, 393);
    1.87 +            this.Controls.Add(this.labelDeviceName);
    1.88 +            this.Controls.Add(this.labelButtonName);
    1.89 +            this.Name = "MainForm";
    1.90 +            this.Text = "Remote Control Sample";
    1.91 +            this.Load += new System.EventHandler(this.Form1_Load);
    1.92 +            this.ResumeLayout(false);
    1.93 +            this.PerformLayout();
    1.94  
    1.95  		}
    1.96  		#endregion Windows Form Designer generated code
    1.97 @@ -128,18 +128,18 @@
    1.98  			_timer.Enabled = false;
    1.99              if (e.Button != RemoteControlButton.Unknown)
   1.100              {
   1.101 -                label1.Text = e.Button.ToString();
   1.102 +                labelButtonName.Text = e.Button.ToString();
   1.103                  processed = true;
   1.104              }
   1.105              else if (e.MceButton != Hid.UsageTables.WindowsMediaCenterRemoteControl.Null)
   1.106              {
   1.107                  //Display MCE button name
   1.108 -                label1.Text = e.MceButton.ToString();
   1.109 +                labelButtonName.Text = e.MceButton.ToString();
   1.110                  //Check if this is an HP extension
   1.111                  if (Enum.IsDefined(typeof(Hid.UsageTables.HpWindowsMediaCenterRemoteControl), (ushort)e.MceButton))
   1.112                  {
   1.113                      //Also display HP button name
   1.114 -                    label1.Text += " / HP:" + ((Hid.UsageTables.HpWindowsMediaCenterRemoteControl)e.MceButton).ToString();
   1.115 +                    labelButtonName.Text += " / HP:" + ((Hid.UsageTables.HpWindowsMediaCenterRemoteControl)e.MceButton).ToString();
   1.116                  }
   1.117  
   1.118                  processed = true;
   1.119 @@ -147,14 +147,14 @@
   1.120              else if (e.ConsumerControl != Hid.UsageTables.ConsumerControl.Null)
   1.121              {
   1.122                  //Display consumer control name
   1.123 -                label1.Text = e.ConsumerControl.ToString();
   1.124 +                labelButtonName.Text = e.ConsumerControl.ToString();
   1.125                  processed = true;
   1.126              }
   1.127              else
   1.128              {
   1.129 -                label1.Text = "Unknown";
   1.130 +                labelButtonName.Text = "Unknown";
   1.131              }
   1.132 -			label2.Text = e.Device.ToString();
   1.133 +			labelDeviceName.Text = e.Device.ToString();
   1.134  			_timer.Enabled = true;
   1.135              return processed;
   1.136  		}
   1.137 @@ -162,7 +162,8 @@
   1.138  		private void _timer_Tick(object sender, EventArgs e)
   1.139  		{
   1.140  			_timer.Enabled = false;
   1.141 -			label1.Text = "Ready...";
   1.142 +			labelButtonName.Text = "Ready...";
   1.143  		}
   1.144 +
   1.145  	}
   1.146  }
     2.1 --- a/MainForm.resx	Mon Dec 22 11:43:55 2014 +0100
     2.2 +++ b/MainForm.resx	Mon Dec 22 11:54:44 2014 +0100
     2.3 @@ -3,7 +3,7 @@
     2.4    <!-- 
     2.5      Microsoft ResX Schema 
     2.6      
     2.7 -    Version 1.3
     2.8 +    Version 2.0
     2.9      
    2.10      The primary goals of this format is to allow a simple XML format 
    2.11      that is mostly human readable. The generation and parsing of the 
    2.12 @@ -14,16 +14,17 @@
    2.13      
    2.14      ... ado.net/XML headers & schema ...
    2.15      <resheader name="resmimetype">text/microsoft-resx</resheader>
    2.16 -    <resheader name="version">1.3</resheader>
    2.17 +    <resheader name="version">2.0</resheader>
    2.18      <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
    2.19      <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
    2.20 -    <data name="Name1">this is my long string</data>
    2.21 +    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
    2.22      <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
    2.23      <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
    2.24 -        [base64 mime encoded serialized .NET Framework object]
    2.25 +        <value>[base64 mime encoded serialized .NET Framework object]</value>
    2.26      </data>
    2.27      <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
    2.28 -        [base64 mime encoded string representing a byte array form of the .NET Framework object]
    2.29 +        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
    2.30 +        <comment>This is a comment</comment>
    2.31      </data>
    2.32                  
    2.33      There are any number of "resheader" rows that contain simple 
    2.34 @@ -35,7 +36,7 @@
    2.35      Classes that don't support this are serialized and stored with the 
    2.36      mimetype set.
    2.37      
    2.38 -    The mimetype is used forserialized objects, and tells the 
    2.39 +    The mimetype is used for serialized objects, and tells the 
    2.40      ResXResourceReader how to depersist the object. This is currently not 
    2.41      extensible. For a given mimetype the value must be set accordingly:
    2.42      
    2.43 @@ -45,7 +46,7 @@
    2.44      
    2.45      mimetype: application/x-microsoft.net.object.binary.base64
    2.46      value   : The object must be serialized with 
    2.47 -            : System.Serialization.Formatters.Binary.BinaryFormatter
    2.48 +            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
    2.49              : and then encoded with base64 encoding.
    2.50      
    2.51      mimetype: application/x-microsoft.net.object.soap.base64
    2.52 @@ -59,18 +60,37 @@
    2.53              : and then encoded with base64 encoding.
    2.54      -->
    2.55    <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
    2.56 +    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
    2.57      <xsd:element name="root" msdata:IsDataSet="true">
    2.58        <xsd:complexType>
    2.59          <xsd:choice maxOccurs="unbounded">
    2.60 +          <xsd:element name="metadata">
    2.61 +            <xsd:complexType>
    2.62 +              <xsd:sequence>
    2.63 +                <xsd:element name="value" type="xsd:string" minOccurs="0" />
    2.64 +              </xsd:sequence>
    2.65 +              <xsd:attribute name="name" use="required" type="xsd:string" />
    2.66 +              <xsd:attribute name="type" type="xsd:string" />
    2.67 +              <xsd:attribute name="mimetype" type="xsd:string" />
    2.68 +              <xsd:attribute ref="xml:space" />
    2.69 +            </xsd:complexType>
    2.70 +          </xsd:element>
    2.71 +          <xsd:element name="assembly">
    2.72 +            <xsd:complexType>
    2.73 +              <xsd:attribute name="alias" type="xsd:string" />
    2.74 +              <xsd:attribute name="name" type="xsd:string" />
    2.75 +            </xsd:complexType>
    2.76 +          </xsd:element>
    2.77            <xsd:element name="data">
    2.78              <xsd:complexType>
    2.79                <xsd:sequence>
    2.80                  <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
    2.81                  <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
    2.82                </xsd:sequence>
    2.83 -              <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
    2.84 +              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
    2.85                <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
    2.86                <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
    2.87 +              <xsd:attribute ref="xml:space" />
    2.88              </xsd:complexType>
    2.89            </xsd:element>
    2.90            <xsd:element name="resheader">
    2.91 @@ -89,60 +109,12 @@
    2.92      <value>text/microsoft-resx</value>
    2.93    </resheader>
    2.94    <resheader name="version">
    2.95 -    <value>1.3</value>
    2.96 +    <value>2.0</value>
    2.97    </resheader>
    2.98    <resheader name="reader">
    2.99 -    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   2.100 +    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   2.101    </resheader>
   2.102    <resheader name="writer">
   2.103 -    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   2.104 +    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   2.105    </resheader>
   2.106 -  <data name="label1.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
   2.107 -    <value>False</value>
   2.108 -  </data>
   2.109 -  <data name="label1.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
   2.110 -    <value>Private</value>
   2.111 -  </data>
   2.112 -  <data name="label1.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
   2.113 -    <value>Private</value>
   2.114 -  </data>
   2.115 -  <data name="label2.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
   2.116 -    <value>False</value>
   2.117 -  </data>
   2.118 -  <data name="label2.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
   2.119 -    <value>Private</value>
   2.120 -  </data>
   2.121 -  <data name="label2.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
   2.122 -    <value>Private</value>
   2.123 -  </data>
   2.124 -  <data name="$this.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
   2.125 -    <value>False</value>
   2.126 -  </data>
   2.127 -  <data name="$this.Language" type="System.Globalization.CultureInfo, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
   2.128 -    <value>(Default)</value>
   2.129 -  </data>
   2.130 -  <data name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
   2.131 -    <value>False</value>
   2.132 -  </data>
   2.133 -  <data name="$this.Localizable" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
   2.134 -    <value>False</value>
   2.135 -  </data>
   2.136 -  <data name="$this.GridSize" type="System.Drawing.Size, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
   2.137 -    <value>8, 8</value>
   2.138 -  </data>
   2.139 -  <data name="$this.Name">
   2.140 -    <value>Form1</value>
   2.141 -  </data>
   2.142 -  <data name="$this.DrawGrid" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
   2.143 -    <value>True</value>
   2.144 -  </data>
   2.145 -  <data name="$this.TrayHeight" type="System.Int32, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
   2.146 -    <value>80</value>
   2.147 -  </data>
   2.148 -  <data name="$this.SnapToGrid" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
   2.149 -    <value>True</value>
   2.150 -  </data>
   2.151 -  <data name="$this.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
   2.152 -    <value>Private</value>
   2.153 -  </data>
   2.154  </root>
   2.155 \ No newline at end of file