# HG changeset patch
# User sl
# Date 1419245035 -3600
# Node ID 83b3361510a78b5d03fcecd575ecec5c1d1c5310
# Parent 259e823a8e843d2dd72daed44021dde41fde6688
Renaming Form files.
diff -r 259e823a8e84 -r 83b3361510a7 Form1.cs
--- a/Form1.cs Mon Dec 22 11:40:23 2014 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,168 +0,0 @@
-using System;
-using System.Drawing;
-using System.Collections;
-using System.ComponentModel;
-using System.Windows.Forms;
-using System.Data;
-using Devices.RemoteControl;
-
-namespace RemoteControlSample
-{
- ///
- /// Summary description for Form1.
- ///
- public class MainForm : System.Windows.Forms.Form
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.Container components = null;
- private System.Windows.Forms.Label label1;
- private RemoteControlDevice _remote;
- private System.Windows.Forms.Label label2;
- private Timer _timer;
-
- public MainForm()
- {
- //
- // Required for Windows Form Designer support
- //
- InitializeComponent();
-
- _timer = new Timer();
- _timer.Interval = 3000;
- _timer.Enabled = false;
- _timer.Tick +=new EventHandler(_timer_Tick);
- }
-
- ///
- /// Clean up any resources being used.
- ///
- protected override void Dispose( bool disposing )
- {
- if( disposing )
- {
- if (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.label1 = new System.Windows.Forms.Label();
- this.label2 = new System.Windows.Forms.Label();
- this.SuspendLayout();
- //
- // label1
- //
- this.label1.Dock = System.Windows.Forms.DockStyle.Fill;
- this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 36F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
- this.label1.ForeColor = System.Drawing.Color.White;
- this.label1.Location = new System.Drawing.Point(0, 0);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(736, 266);
- this.label1.TabIndex = 0;
- this.label1.Text = "Ready...";
- this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
- //
- // label2
- //
- this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
- this.label2.Location = new System.Drawing.Point(72, 32);
- this.label2.Name = "label2";
- this.label2.Size = new System.Drawing.Size(576, 23);
- this.label2.TabIndex = 1;
- this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
- //
- // Form1
- //
- this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
- this.BackColor = System.Drawing.Color.LightSteelBlue;
- this.ClientSize = new System.Drawing.Size(736, 266);
- this.Controls.Add(this.label2);
- this.Controls.Add(this.label1);
- this.Name = "Form1";
- this.Text = "Remote Control Sample";
- this.Load += new System.EventHandler(this.Form1_Load);
- this.ResumeLayout(false);
-
- }
- #endregion Windows Form Designer generated code
-
- ///
- /// The main entry point for the application.
- ///
- [STAThread]
- static void Main()
- {
- Application.Run(new MainForm());
- }
-
- private void Form1_Load(object sender, System.EventArgs e)
- {
- _remote = new RemoteControlDevice(this.Handle);
- _remote.ButtonPressed += new Devices.RemoteControl.RemoteControlDevice.RemoteControlDeviceEventHandler(_remote_ButtonPressed);
- }
-
-
- protected override void WndProc(ref Message message)
- {
- if (_remote != null)
- {
- _remote.ProcessMessage(message);
- }
- base.WndProc(ref message);
- }
-
- private bool _remote_ButtonPressed(object sender, RemoteControlEventArgs e)
- {
- bool processed = false;
- _timer.Enabled = false;
- if (e.Button != RemoteControlButton.Unknown)
- {
- label1.Text = e.Button.ToString();
- processed = true;
- }
- else if (e.MceButton != Hid.UsageTables.WindowsMediaCenterRemoteControl.Null)
- {
- //Display MCE button name
- label1.Text = e.MceButton.ToString();
- //Check if this is an HP extension
- if (Enum.IsDefined(typeof(Hid.UsageTables.HpWindowsMediaCenterRemoteControl), (ushort)e.MceButton))
- {
- //Also display HP button name
- label1.Text += " / HP:" + ((Hid.UsageTables.HpWindowsMediaCenterRemoteControl)e.MceButton).ToString();
- }
-
- processed = true;
- }
- else if (e.ConsumerControl != Hid.UsageTables.ConsumerControl.Null)
- {
- //Display consumer control name
- label1.Text = e.ConsumerControl.ToString();
- processed = true;
- }
- else
- {
- label1.Text = "Unknown";
- }
- label2.Text = e.Device.ToString();
- _timer.Enabled = true;
- return processed;
- }
-
- private void _timer_Tick(object sender, EventArgs e)
- {
- _timer.Enabled = false;
- label1.Text = "Ready...";
- }
- }
-}
diff -r 259e823a8e84 -r 83b3361510a7 Form1.resx
--- a/Form1.resx Mon Dec 22 11:40:23 2014 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,148 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 1.3
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- False
-
-
- Private
-
-
- Private
-
-
- False
-
-
- Private
-
-
- Private
-
-
- False
-
-
- (Default)
-
-
- False
-
-
- False
-
-
- 8, 8
-
-
- Form1
-
-
- True
-
-
- 80
-
-
- True
-
-
- Private
-
-
\ No newline at end of file
diff -r 259e823a8e84 -r 83b3361510a7 MainForm.cs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/MainForm.cs Mon Dec 22 11:43:55 2014 +0100
@@ -0,0 +1,168 @@
+using System;
+using System.Drawing;
+using System.Collections;
+using System.ComponentModel;
+using System.Windows.Forms;
+using System.Data;
+using Devices.RemoteControl;
+
+namespace RemoteControlSample
+{
+ ///
+ /// Summary description for Form1.
+ ///
+ public class MainForm : System.Windows.Forms.Form
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.Container components = null;
+ private System.Windows.Forms.Label label1;
+ private RemoteControlDevice _remote;
+ private System.Windows.Forms.Label label2;
+ private Timer _timer;
+
+ public MainForm()
+ {
+ //
+ // Required for Windows Form Designer support
+ //
+ InitializeComponent();
+
+ _timer = new Timer();
+ _timer.Interval = 3000;
+ _timer.Enabled = false;
+ _timer.Tick +=new EventHandler(_timer_Tick);
+ }
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ protected override void Dispose( bool disposing )
+ {
+ if( disposing )
+ {
+ if (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.label1 = new System.Windows.Forms.Label();
+ this.label2 = new System.Windows.Forms.Label();
+ this.SuspendLayout();
+ //
+ // label1
+ //
+ this.label1.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 36F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
+ this.label1.ForeColor = System.Drawing.Color.White;
+ this.label1.Location = new System.Drawing.Point(0, 0);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(736, 266);
+ this.label1.TabIndex = 0;
+ this.label1.Text = "Ready...";
+ this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+ //
+ // label2
+ //
+ this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
+ this.label2.Location = new System.Drawing.Point(72, 32);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(576, 23);
+ this.label2.TabIndex = 1;
+ this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+ //
+ // Form1
+ //
+ this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
+ this.BackColor = System.Drawing.Color.LightSteelBlue;
+ this.ClientSize = new System.Drawing.Size(736, 266);
+ this.Controls.Add(this.label2);
+ this.Controls.Add(this.label1);
+ this.Name = "Form1";
+ this.Text = "Remote Control Sample";
+ this.Load += new System.EventHandler(this.Form1_Load);
+ this.ResumeLayout(false);
+
+ }
+ #endregion Windows Form Designer generated code
+
+ ///
+ /// The main entry point for the application.
+ ///
+ [STAThread]
+ static void Main()
+ {
+ Application.Run(new MainForm());
+ }
+
+ private void Form1_Load(object sender, System.EventArgs e)
+ {
+ _remote = new RemoteControlDevice(this.Handle);
+ _remote.ButtonPressed += new Devices.RemoteControl.RemoteControlDevice.RemoteControlDeviceEventHandler(_remote_ButtonPressed);
+ }
+
+
+ protected override void WndProc(ref Message message)
+ {
+ if (_remote != null)
+ {
+ _remote.ProcessMessage(message);
+ }
+ base.WndProc(ref message);
+ }
+
+ private bool _remote_ButtonPressed(object sender, RemoteControlEventArgs e)
+ {
+ bool processed = false;
+ _timer.Enabled = false;
+ if (e.Button != RemoteControlButton.Unknown)
+ {
+ label1.Text = e.Button.ToString();
+ processed = true;
+ }
+ else if (e.MceButton != Hid.UsageTables.WindowsMediaCenterRemoteControl.Null)
+ {
+ //Display MCE button name
+ label1.Text = e.MceButton.ToString();
+ //Check if this is an HP extension
+ if (Enum.IsDefined(typeof(Hid.UsageTables.HpWindowsMediaCenterRemoteControl), (ushort)e.MceButton))
+ {
+ //Also display HP button name
+ label1.Text += " / HP:" + ((Hid.UsageTables.HpWindowsMediaCenterRemoteControl)e.MceButton).ToString();
+ }
+
+ processed = true;
+ }
+ else if (e.ConsumerControl != Hid.UsageTables.ConsumerControl.Null)
+ {
+ //Display consumer control name
+ label1.Text = e.ConsumerControl.ToString();
+ processed = true;
+ }
+ else
+ {
+ label1.Text = "Unknown";
+ }
+ label2.Text = e.Device.ToString();
+ _timer.Enabled = true;
+ return processed;
+ }
+
+ private void _timer_Tick(object sender, EventArgs e)
+ {
+ _timer.Enabled = false;
+ label1.Text = "Ready...";
+ }
+ }
+}
diff -r 259e823a8e84 -r 83b3361510a7 MainForm.resx
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/MainForm.resx Mon Dec 22 11:43:55 2014 +0100
@@ -0,0 +1,148 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 1.3
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ False
+
+
+ Private
+
+
+ Private
+
+
+ False
+
+
+ Private
+
+
+ Private
+
+
+ False
+
+
+ (Default)
+
+
+ False
+
+
+ False
+
+
+ 8, 8
+
+
+ Form1
+
+
+ True
+
+
+ 80
+
+
+ True
+
+
+ Private
+
+
\ No newline at end of file
diff -r 259e823a8e84 -r 83b3361510a7 RemoteControlSample.csproj
--- a/RemoteControlSample.csproj Mon Dec 22 11:40:23 2014 +0100
+++ b/RemoteControlSample.csproj Mon Dec 22 11:43:55 2014 +0100
@@ -124,13 +124,13 @@
Code
-
- Form
-
+
+ Form
+
Code
@@ -139,9 +139,6 @@
-
- Form1.cs
-
@@ -155,6 +152,11 @@
true
+
+
+ MainForm.cs
+
+