Initial contribution. Partly working with PCS-MCE.
authorsl
Tue, 04 Nov 2014 19:31:32 +0100
changeset 082a61d3d2706
child 1 4cf25f956ab2
Initial contribution. Partly working with PCS-MCE.
App.ico
AssemblyInfo.cs
Form1.cs
Form1.resx
RemoteControlDevice.cs
RemoteControlSample.csproj
RemoteControlSample.sln
     1.1 Binary file App.ico has changed
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/AssemblyInfo.cs	Tue Nov 04 19:31:32 2014 +0100
     2.3 @@ -0,0 +1,58 @@
     2.4 +using System.Reflection;
     2.5 +using System.Runtime.CompilerServices;
     2.6 +
     2.7 +//
     2.8 +// General Information about an assembly is controlled through the following 
     2.9 +// set of attributes. Change these attribute values to modify the information
    2.10 +// associated with an assembly.
    2.11 +//
    2.12 +[assembly: AssemblyTitle("")]
    2.13 +[assembly: AssemblyDescription("")]
    2.14 +[assembly: AssemblyConfiguration("")]
    2.15 +[assembly: AssemblyCompany("")]
    2.16 +[assembly: AssemblyProduct("")]
    2.17 +[assembly: AssemblyCopyright("")]
    2.18 +[assembly: AssemblyTrademark("")]
    2.19 +[assembly: AssemblyCulture("")]		
    2.20 +
    2.21 +//
    2.22 +// Version information for an assembly consists of the following four values:
    2.23 +//
    2.24 +//      Major Version
    2.25 +//      Minor Version 
    2.26 +//      Build Number
    2.27 +//      Revision
    2.28 +//
    2.29 +// You can specify all the values or you can default the Revision and Build Numbers 
    2.30 +// by using the '*' as shown below:
    2.31 +
    2.32 +[assembly: AssemblyVersion("1.0.*")]
    2.33 +
    2.34 +//
    2.35 +// In order to sign your assembly you must specify a key to use. Refer to the 
    2.36 +// Microsoft .NET Framework documentation for more information on assembly signing.
    2.37 +//
    2.38 +// Use the attributes below to control which key is used for signing. 
    2.39 +//
    2.40 +// Notes: 
    2.41 +//   (*) If no key is specified, the assembly is not signed.
    2.42 +//   (*) KeyName refers to a key that has been installed in the Crypto Service
    2.43 +//       Provider (CSP) on your machine. KeyFile refers to a file which contains
    2.44 +//       a key.
    2.45 +//   (*) If the KeyFile and the KeyName values are both specified, the 
    2.46 +//       following processing occurs:
    2.47 +//       (1) If the KeyName can be found in the CSP, that key is used.
    2.48 +//       (2) If the KeyName does not exist and the KeyFile does exist, the key 
    2.49 +//           in the KeyFile is installed into the CSP and used.
    2.50 +//   (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
    2.51 +//       When specifying the KeyFile, the location of the KeyFile should be
    2.52 +//       relative to the project output directory which is
    2.53 +//       %Project Directory%\obj\<configuration>. For example, if your KeyFile is
    2.54 +//       located in the project directory, you would specify the AssemblyKeyFile 
    2.55 +//       attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
    2.56 +//   (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
    2.57 +//       documentation for more information on this.
    2.58 +//
    2.59 +[assembly: AssemblyDelaySign(false)]
    2.60 +[assembly: AssemblyKeyFile("")]
    2.61 +[assembly: AssemblyKeyName("")]
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/Form1.cs	Tue Nov 04 19:31:32 2014 +0100
     3.3 @@ -0,0 +1,137 @@
     3.4 +using System;
     3.5 +using System.Drawing;
     3.6 +using System.Collections;
     3.7 +using System.ComponentModel;
     3.8 +using System.Windows.Forms;
     3.9 +using System.Data;
    3.10 +using BruceThomas.Devices.RemoteControl;
    3.11 +
    3.12 +namespace RemoteControlSample
    3.13 +{
    3.14 +	/// <summary>
    3.15 +	/// Summary description for Form1.
    3.16 +	/// </summary>
    3.17 +	public class Form1 : System.Windows.Forms.Form
    3.18 +	{
    3.19 +		/// <summary>
    3.20 +		/// Required designer variable.
    3.21 +		/// </summary>
    3.22 +		private System.ComponentModel.Container components = null;
    3.23 +		private System.Windows.Forms.Label label1;
    3.24 +		private RemoteControlDevice _remote;
    3.25 +		private System.Windows.Forms.Label label2;
    3.26 +		private Timer _timer;
    3.27 +
    3.28 +		public Form1()
    3.29 +		{
    3.30 +			//
    3.31 +			// Required for Windows Form Designer support
    3.32 +			//
    3.33 +			InitializeComponent();
    3.34 +
    3.35 +			_timer = new Timer();
    3.36 +			_timer.Interval = 3000;
    3.37 +			_timer.Enabled = false;
    3.38 +			_timer.Tick +=new EventHandler(_timer_Tick);
    3.39 +			_remote = new RemoteControlDevice();
    3.40 +			_remote.ButtonPressed +=new BruceThomas.Devices.RemoteControl.RemoteControlDevice.RemoteControlDeviceEventHandler(_remote_ButtonPressed);			
    3.41 +		}
    3.42 +
    3.43 +		/// <summary>
    3.44 +		/// Clean up any resources being used.
    3.45 +		/// </summary>
    3.46 +		protected override void Dispose( bool disposing )
    3.47 +		{
    3.48 +			if( disposing )
    3.49 +			{
    3.50 +				if (components != null) 
    3.51 +				{
    3.52 +					components.Dispose();
    3.53 +				}
    3.54 +			}
    3.55 +			base.Dispose( disposing );
    3.56 +		}
    3.57 +
    3.58 +		#region Windows Form Designer generated code
    3.59 +		/// <summary>
    3.60 +		/// Required method for Designer support - do not modify
    3.61 +		/// the contents of this method with the code editor.
    3.62 +		/// </summary>
    3.63 +		private void InitializeComponent()
    3.64 +		{
    3.65 +			this.label1 = new System.Windows.Forms.Label();
    3.66 +			this.label2 = new System.Windows.Forms.Label();
    3.67 +			this.SuspendLayout();
    3.68 +			// 
    3.69 +			// label1
    3.70 +			// 
    3.71 +			this.label1.Dock = System.Windows.Forms.DockStyle.Fill;
    3.72 +			this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 36F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
    3.73 +			this.label1.ForeColor = System.Drawing.Color.White;
    3.74 +			this.label1.Location = new System.Drawing.Point(0, 0);
    3.75 +			this.label1.Name = "label1";
    3.76 +			this.label1.Size = new System.Drawing.Size(736, 266);
    3.77 +			this.label1.TabIndex = 0;
    3.78 +			this.label1.Text = "Ready...";
    3.79 +			this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
    3.80 +			// 
    3.81 +			// label2
    3.82 +			// 
    3.83 +			this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
    3.84 +			this.label2.Location = new System.Drawing.Point(72, 32);
    3.85 +			this.label2.Name = "label2";
    3.86 +			this.label2.Size = new System.Drawing.Size(576, 23);
    3.87 +			this.label2.TabIndex = 1;
    3.88 +			this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
    3.89 +			// 
    3.90 +			// Form1
    3.91 +			// 
    3.92 +			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
    3.93 +			this.BackColor = System.Drawing.Color.LightSteelBlue;
    3.94 +			this.ClientSize = new System.Drawing.Size(736, 266);
    3.95 +			this.Controls.Add(this.label2);
    3.96 +			this.Controls.Add(this.label1);
    3.97 +			this.Name = "Form1";
    3.98 +			this.Text = "Remote Control Sample";
    3.99 +			this.Load += new System.EventHandler(this.Form1_Load);
   3.100 +			this.ResumeLayout(false);
   3.101 +
   3.102 +		}
   3.103 +		#endregion
   3.104 +
   3.105 +		/// <summary>
   3.106 +		/// The main entry point for the application.
   3.107 +		/// </summary>
   3.108 +		[STAThread]
   3.109 +		static void Main() 
   3.110 +		{
   3.111 +			Application.Run(new Form1());
   3.112 +		}
   3.113 +
   3.114 +		private void Form1_Load(object sender, System.EventArgs e)
   3.115 +		{
   3.116 +		
   3.117 +		}
   3.118 +
   3.119 +
   3.120 +		protected override void WndProc(ref Message message)
   3.121 +		{
   3.122 +			_remote.ProcessMessage(message);			
   3.123 +			base.WndProc(ref message);
   3.124 +		}
   3.125 +
   3.126 +		private void _remote_ButtonPressed(object sender, RemoteControlEventArgs e)
   3.127 +		{
   3.128 +			_timer.Enabled = false;
   3.129 +			label1.Text = e.Button.ToString();
   3.130 +			label2.Text = e.Device.ToString();			
   3.131 +			_timer.Enabled = true;
   3.132 +		}
   3.133 +
   3.134 +		private void _timer_Tick(object sender, EventArgs e)
   3.135 +		{
   3.136 +			_timer.Enabled = false;
   3.137 +			label1.Text = "Ready...";
   3.138 +		}
   3.139 +	}
   3.140 +}
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/Form1.resx	Tue Nov 04 19:31:32 2014 +0100
     4.3 @@ -0,0 +1,148 @@
     4.4 +<?xml version="1.0" encoding="utf-8"?>
     4.5 +<root>
     4.6 +  <!-- 
     4.7 +    Microsoft ResX Schema 
     4.8 +    
     4.9 +    Version 1.3
    4.10 +    
    4.11 +    The primary goals of this format is to allow a simple XML format 
    4.12 +    that is mostly human readable. The generation and parsing of the 
    4.13 +    various data types are done through the TypeConverter classes 
    4.14 +    associated with the data types.
    4.15 +    
    4.16 +    Example:
    4.17 +    
    4.18 +    ... ado.net/XML headers & schema ...
    4.19 +    <resheader name="resmimetype">text/microsoft-resx</resheader>
    4.20 +    <resheader name="version">1.3</resheader>
    4.21 +    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
    4.22 +    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
    4.23 +    <data name="Name1">this is my long string</data>
    4.24 +    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
    4.25 +    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
    4.26 +        [base64 mime encoded serialized .NET Framework object]
    4.27 +    </data>
    4.28 +    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
    4.29 +        [base64 mime encoded string representing a byte array form of the .NET Framework object]
    4.30 +    </data>
    4.31 +                
    4.32 +    There are any number of "resheader" rows that contain simple 
    4.33 +    name/value pairs.
    4.34 +    
    4.35 +    Each data row contains a name, and value. The row also contains a 
    4.36 +    type or mimetype. Type corresponds to a .NET class that support 
    4.37 +    text/value conversion through the TypeConverter architecture. 
    4.38 +    Classes that don't support this are serialized and stored with the 
    4.39 +    mimetype set.
    4.40 +    
    4.41 +    The mimetype is used forserialized objects, and tells the 
    4.42 +    ResXResourceReader how to depersist the object. This is currently not 
    4.43 +    extensible. For a given mimetype the value must be set accordingly:
    4.44 +    
    4.45 +    Note - application/x-microsoft.net.object.binary.base64 is the format 
    4.46 +    that the ResXResourceWriter will generate, however the reader can 
    4.47 +    read any of the formats listed below.
    4.48 +    
    4.49 +    mimetype: application/x-microsoft.net.object.binary.base64
    4.50 +    value   : The object must be serialized with 
    4.51 +            : System.Serialization.Formatters.Binary.BinaryFormatter
    4.52 +            : and then encoded with base64 encoding.
    4.53 +    
    4.54 +    mimetype: application/x-microsoft.net.object.soap.base64
    4.55 +    value   : The object must be serialized with 
    4.56 +            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
    4.57 +            : and then encoded with base64 encoding.
    4.58 +
    4.59 +    mimetype: application/x-microsoft.net.object.bytearray.base64
    4.60 +    value   : The object must be serialized into a byte array 
    4.61 +            : using a System.ComponentModel.TypeConverter
    4.62 +            : and then encoded with base64 encoding.
    4.63 +    -->
    4.64 +  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
    4.65 +    <xsd:element name="root" msdata:IsDataSet="true">
    4.66 +      <xsd:complexType>
    4.67 +        <xsd:choice maxOccurs="unbounded">
    4.68 +          <xsd:element name="data">
    4.69 +            <xsd:complexType>
    4.70 +              <xsd:sequence>
    4.71 +                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
    4.72 +                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
    4.73 +              </xsd:sequence>
    4.74 +              <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
    4.75 +              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
    4.76 +              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
    4.77 +            </xsd:complexType>
    4.78 +          </xsd:element>
    4.79 +          <xsd:element name="resheader">
    4.80 +            <xsd:complexType>
    4.81 +              <xsd:sequence>
    4.82 +                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
    4.83 +              </xsd:sequence>
    4.84 +              <xsd:attribute name="name" type="xsd:string" use="required" />
    4.85 +            </xsd:complexType>
    4.86 +          </xsd:element>
    4.87 +        </xsd:choice>
    4.88 +      </xsd:complexType>
    4.89 +    </xsd:element>
    4.90 +  </xsd:schema>
    4.91 +  <resheader name="resmimetype">
    4.92 +    <value>text/microsoft-resx</value>
    4.93 +  </resheader>
    4.94 +  <resheader name="version">
    4.95 +    <value>1.3</value>
    4.96 +  </resheader>
    4.97 +  <resheader name="reader">
    4.98 +    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
    4.99 +  </resheader>
   4.100 +  <resheader name="writer">
   4.101 +    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   4.102 +  </resheader>
   4.103 +  <data name="label1.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
   4.104 +    <value>False</value>
   4.105 +  </data>
   4.106 +  <data name="label1.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
   4.107 +    <value>Private</value>
   4.108 +  </data>
   4.109 +  <data name="label1.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
   4.110 +    <value>Private</value>
   4.111 +  </data>
   4.112 +  <data name="label2.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
   4.113 +    <value>False</value>
   4.114 +  </data>
   4.115 +  <data name="label2.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
   4.116 +    <value>Private</value>
   4.117 +  </data>
   4.118 +  <data name="label2.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
   4.119 +    <value>Private</value>
   4.120 +  </data>
   4.121 +  <data name="$this.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
   4.122 +    <value>False</value>
   4.123 +  </data>
   4.124 +  <data name="$this.Language" type="System.Globalization.CultureInfo, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
   4.125 +    <value>(Default)</value>
   4.126 +  </data>
   4.127 +  <data name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
   4.128 +    <value>False</value>
   4.129 +  </data>
   4.130 +  <data name="$this.Localizable" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
   4.131 +    <value>False</value>
   4.132 +  </data>
   4.133 +  <data name="$this.GridSize" type="System.Drawing.Size, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
   4.134 +    <value>8, 8</value>
   4.135 +  </data>
   4.136 +  <data name="$this.Name">
   4.137 +    <value>Form1</value>
   4.138 +  </data>
   4.139 +  <data name="$this.DrawGrid" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
   4.140 +    <value>True</value>
   4.141 +  </data>
   4.142 +  <data name="$this.TrayHeight" type="System.Int32, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
   4.143 +    <value>80</value>
   4.144 +  </data>
   4.145 +  <data name="$this.SnapToGrid" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
   4.146 +    <value>True</value>
   4.147 +  </data>
   4.148 +  <data name="$this.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
   4.149 +    <value>Private</value>
   4.150 +  </data>
   4.151 +</root>
   4.152 \ No newline at end of file
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/RemoteControlDevice.cs	Tue Nov 04 19:31:32 2014 +0100
     5.3 @@ -0,0 +1,589 @@
     5.4 +using System;
     5.5 +using System.Windows.Forms;
     5.6 +using System.Runtime.InteropServices;
     5.7 +using System.Diagnostics;
     5.8 +
     5.9 +
    5.10 +namespace BruceThomas.Devices.RemoteControl
    5.11 +{
    5.12 +	public enum InputDevice
    5.13 +	{
    5.14 +		Key,
    5.15 +		Mouse,
    5.16 +		OEM
    5.17 +	}
    5.18 +
    5.19 +
    5.20 +	public enum RemoteControlButton
    5.21 +	{
    5.22 +		Clear,
    5.23 +		Down,
    5.24 +		Left,
    5.25 +		Digit0,
    5.26 +		Digit1,
    5.27 +		Digit2,
    5.28 +		Digit3,
    5.29 +		Digit4,
    5.30 +		Digit5,
    5.31 +		Digit6,
    5.32 +		Digit7,
    5.33 +		Digit8,
    5.34 +		Digit9,
    5.35 +		Enter,
    5.36 +		Right,
    5.37 +		Up,
    5.38 +
    5.39 +		Back,
    5.40 +		ChannelDown,
    5.41 +		ChannelUp,
    5.42 +		FastForward,
    5.43 +		VolumeMute,
    5.44 +		Pause,
    5.45 +		Play,
    5.46 +        PlayPause,
    5.47 +		Record,
    5.48 +		PreviousTrack,
    5.49 +		Rewind,
    5.50 +		NextTrack,
    5.51 +		Stop,
    5.52 +		VolumeDown,
    5.53 +		VolumeUp,
    5.54 +
    5.55 +		RecordedTV,
    5.56 +		Guide,
    5.57 +		LiveTV,
    5.58 +		Details,
    5.59 +		DVDMenu,
    5.60 +		DVDAngle,
    5.61 +		DVDAudio,
    5.62 +		DVDSubtitle,
    5.63 +		MyMusic,
    5.64 +		MyPictures,
    5.65 +		MyVideos,
    5.66 +		MyTV,
    5.67 +		OEM1,
    5.68 +		OEM2,
    5.69 +		StandBy,
    5.70 +		TVJump,
    5.71 +
    5.72 +		Unknown
    5.73 +	}
    5.74 +
    5.75 +
    5.76 +	#region RemoteControlEventArgs
    5.77 +
    5.78 +	public class RemoteControlEventArgs : EventArgs
    5.79 +	{
    5.80 +		RemoteControlButton _rcb;
    5.81 +		InputDevice _device;
    5.82 +
    5.83 +		public RemoteControlEventArgs(RemoteControlButton rcb, InputDevice device)
    5.84 +		{
    5.85 +			_rcb = rcb;
    5.86 +			_device = device;
    5.87 +		}
    5.88 +
    5.89 +
    5.90 +		public RemoteControlEventArgs()
    5.91 +		{
    5.92 +			_rcb = RemoteControlButton.Unknown;
    5.93 +			_device = InputDevice.Key;
    5.94 +		}
    5.95 +
    5.96 +
    5.97 +		public RemoteControlButton Button
    5.98 +		{
    5.99 +			get { return _rcb;  }
   5.100 +			set { _rcb = value; }
   5.101 +		}
   5.102 +
   5.103 +		public InputDevice Device
   5.104 +		{
   5.105 +			get { return _device;  }
   5.106 +			set { _device = value; }
   5.107 +		}
   5.108 +	}
   5.109 +
   5.110 +	#endregion RemoteControlEventArgs
   5.111 +
   5.112 +
   5.113 +	public sealed class RemoteControlDevice
   5.114 +	{
   5.115 +
   5.116 +        [StructLayout(LayoutKind.Sequential, Pack = 1)]
   5.117 +		internal struct RAWINPUTDEVICE
   5.118 +		{
   5.119 +			[MarshalAs(UnmanagedType.U2)]
   5.120 +			public ushort usUsagePage;
   5.121 +			[MarshalAs(UnmanagedType.U2)]
   5.122 +			public ushort usUsage;
   5.123 +			[MarshalAs(UnmanagedType.U4)]
   5.124 +			public int	 dwFlags;
   5.125 +			public IntPtr hwndTarget;
   5.126 +		}
   5.127 +
   5.128 +
   5.129 +        [StructLayout(LayoutKind.Sequential, Pack = 1)]
   5.130 +		internal struct RAWINPUTHEADER
   5.131 +		{
   5.132 +			[MarshalAs(UnmanagedType.U4)]
   5.133 +			public int dwType;
   5.134 +			[MarshalAs(UnmanagedType.U4)]
   5.135 +			public int dwSize;
   5.136 +            public IntPtr hDevice;
   5.137 +			[MarshalAs(UnmanagedType.U4)]
   5.138 +			public int wParam;
   5.139 +		}
   5.140 +
   5.141 +
   5.142 +        [StructLayout(LayoutKind.Sequential, Pack = 1)]
   5.143 +		internal struct RAWHID
   5.144 +		{
   5.145 +			[MarshalAs(UnmanagedType.U4)]
   5.146 +			public int dwSizeHid;
   5.147 +			[MarshalAs(UnmanagedType.U4)]
   5.148 +			public int dwCount;
   5.149 +            //
   5.150 +            //BYTE  bRawData[1];
   5.151 +		}
   5.152 +
   5.153 +
   5.154 +        [StructLayout(LayoutKind.Sequential, Pack = 1)]
   5.155 +		internal struct BUTTONSSTR
   5.156 +		{
   5.157 +			[MarshalAs(UnmanagedType.U2)]
   5.158 +			public ushort usButtonFlags;
   5.159 +			[MarshalAs(UnmanagedType.U2)]
   5.160 +			public ushort usButtonData;
   5.161 +		}
   5.162 +
   5.163 +
   5.164 +        [StructLayout(LayoutKind.Explicit, Pack = 1)]
   5.165 +		internal struct RAWMOUSE
   5.166 +		{
   5.167 +			[MarshalAs(UnmanagedType.U2)]
   5.168 +			[FieldOffset (0)] public ushort usFlags;
   5.169 +			[MarshalAs(UnmanagedType.U4)]
   5.170 +			[FieldOffset (4)] public uint ulButtons;
   5.171 +			[FieldOffset (4)] public BUTTONSSTR buttonsStr;
   5.172 +			[MarshalAs(UnmanagedType.U4)]
   5.173 +			[FieldOffset (8)] public uint ulRawButtons;
   5.174 +            [MarshalAs(UnmanagedType.U4)]
   5.175 +            [FieldOffset (12)] public int lLastX;
   5.176 +            [MarshalAs(UnmanagedType.U4)]
   5.177 +            [FieldOffset (16)] public int lLastY;
   5.178 +			[MarshalAs(UnmanagedType.U4)]
   5.179 +			[FieldOffset (20)] public uint ulExtraInformation;
   5.180 +		}
   5.181 +
   5.182 +        [StructLayout(LayoutKind.Sequential, Pack = 1)]
   5.183 +		internal struct RAWKEYBOARD
   5.184 +		{
   5.185 +			[MarshalAs(UnmanagedType.U2)]
   5.186 +			public ushort MakeCode;
   5.187 +			[MarshalAs(UnmanagedType.U2)]
   5.188 +			public ushort Flags;
   5.189 +			[MarshalAs(UnmanagedType.U2)]
   5.190 +			public ushort Reserved;
   5.191 +			[MarshalAs(UnmanagedType.U2)]
   5.192 +			public ushort VKey;
   5.193 +			[MarshalAs(UnmanagedType.U4)]
   5.194 +			public uint Message;
   5.195 +			[MarshalAs(UnmanagedType.U4)]
   5.196 +			public uint ExtraInformation;
   5.197 +		}
   5.198 +
   5.199 +
   5.200 +		[StructLayout(LayoutKind.Explicit, Pack=1)]
   5.201 +		internal struct RAWINPUT
   5.202 +		{
   5.203 +			[FieldOffset  (0)] public RAWINPUTHEADER header;
   5.204 +			[FieldOffset (16)] public RAWMOUSE mouse;
   5.205 +			[FieldOffset (16)] public RAWKEYBOARD keyboard;
   5.206 +			[FieldOffset (16)] public RAWHID hid;
   5.207 +		}
   5.208 +
   5.209 +
   5.210 +		[DllImport("User32.dll")]
   5.211 +		extern static bool RegisterRawInputDevices(RAWINPUTDEVICE[] pRawInputDevice, uint uiNumDevices, uint cbSize);
   5.212 +
   5.213 +		[DllImport("User32.dll")]
   5.214 +		extern static uint GetRawInputData(IntPtr hRawInput, uint uiCommand, IntPtr pData, ref uint pcbSize, uint cbSizeHeader);
   5.215 +
   5.216 +
   5.217 +		private const int WM_KEYDOWN	= 0x0100;
   5.218 +		private const int WM_APPCOMMAND	= 0x0319;
   5.219 +		private const int WM_INPUT		= 0x00FF;
   5.220 +
   5.221 +		private const int APPCOMMAND_BROWSER_BACKWARD   = 1;
   5.222 +		private const int APPCOMMAND_VOLUME_MUTE        = 8;
   5.223 +		private const int APPCOMMAND_VOLUME_DOWN        = 9;
   5.224 +		private const int APPCOMMAND_VOLUME_UP          = 10;
   5.225 +		private const int APPCOMMAND_MEDIA_NEXTTRACK    = 11;
   5.226 +		private const int APPCOMMAND_MEDIA_PREVIOUSTRACK = 12;
   5.227 +		private const int APPCOMMAND_MEDIA_STOP         = 13;
   5.228 +		private const int APPCOMMAND_MEDIA_PLAY_PAUSE   = 14;
   5.229 +		private const int APPCOMMAND_MEDIA_PLAY         = 46;
   5.230 +		private const int APPCOMMAND_MEDIA_PAUSE        = 47;
   5.231 +		private const int APPCOMMAND_MEDIA_RECORD       = 48;
   5.232 +		private const int APPCOMMAND_MEDIA_FAST_FORWARD = 49;
   5.233 +		private const int APPCOMMAND_MEDIA_REWIND       = 50;
   5.234 +		private const int APPCOMMAND_MEDIA_CHANNEL_UP   = 51;
   5.235 +		private const int APPCOMMAND_MEDIA_CHANNEL_DOWN = 52;
   5.236 +
   5.237 +		private const int RAWINPUT_DETAILS				= 0x209;
   5.238 +		private const int RAWINPUT_GUIDE				= 0x8D;
   5.239 +		private const int RAWINPUT_TVJUMP				= 0x25;
   5.240 +		private const int RAWINPUT_STANDBY				= 0x82;
   5.241 +		private const int RAWINPUT_OEM1					= 0x80;
   5.242 +		private const int RAWINPUT_OEM2					= 0x81;
   5.243 +		private const int RAWINPUT_MYTV					= 0x46;
   5.244 +		private const int RAWINPUT_MYVIDEOS				= 0x4A;
   5.245 +		private const int RAWINPUT_MYPICTURES			= 0x49;
   5.246 +		private const int RAWINPUT_MYMUSIC				= 0x47;
   5.247 +		private const int RAWINPUT_RECORDEDTV			= 0x48;
   5.248 +		private const int RAWINPUT_DVDANGLE				= 0x4B;
   5.249 +		private const int RAWINPUT_DVDAUDIO				= 0x4C;
   5.250 +		private const int RAWINPUT_DVDMENU				= 0x24;
   5.251 +		private const int RAWINPUT_DVDSUBTITLE			= 0x4D;
   5.252 +
   5.253 +		private const int RIM_TYPEMOUSE					= 0;
   5.254 +		private const int RIM_TYPEKEYBOARD				= 1;
   5.255 +		private const int RIM_TYPEHID					= 2;
   5.256 +
   5.257 +		private const int RID_INPUT						= 0x10000003;
   5.258 +		private const int RID_HEADER					= 0x10000005;
   5.259 +
   5.260 +		private const int FAPPCOMMAND_MASK				= 0xF000;
   5.261 +		private const int FAPPCOMMAND_MOUSE				= 0x8000;
   5.262 +		private const int FAPPCOMMAND_KEY				= 0;
   5.263 +		private const int FAPPCOMMAND_OEM				= 0x1000;
   5.264 +
   5.265 +		public delegate void RemoteControlDeviceEventHandler(object sender, RemoteControlEventArgs e);
   5.266 +		public event RemoteControlDeviceEventHandler ButtonPressed;
   5.267 +
   5.268 +
   5.269 +		//-------------------------------------------------------------
   5.270 +		// constructors
   5.271 +		//-------------------------------------------------------------
   5.272 +
   5.273 +		public RemoteControlDevice()
   5.274 +		{
   5.275 +			// Register the input device to receive the commands from the
   5.276 +			// remote device. See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwmt/html/remote_control.asp
   5.277 +			// for the vendor defined usage page.
   5.278 +
   5.279 +			RAWINPUTDEVICE[] rid = new RAWINPUTDEVICE[3];
   5.280 +
   5.281 +			rid[0].usUsagePage = 0xFFBC;
   5.282 +			rid[0].usUsage = 0x88;
   5.283 +			rid[0].dwFlags = 0;
   5.284 +
   5.285 +			rid[1].usUsagePage = 0x0C;
   5.286 +			rid[1].usUsage = 0x01;
   5.287 +			rid[1].dwFlags = 0;
   5.288 +
   5.289 +			rid[2].usUsagePage = 0x0C;
   5.290 +			rid[2].usUsage = 0x80;
   5.291 +			rid[2].dwFlags = 0;
   5.292 +
   5.293 +			if (!RegisterRawInputDevices(rid,
   5.294 +				(uint) rid.Length,
   5.295 +				(uint) Marshal.SizeOf(rid[0]))
   5.296 +				)
   5.297 +			{
   5.298 +				throw new ApplicationException("Failed to register raw input devices.");
   5.299 +			}
   5.300 +		}
   5.301 +
   5.302 +
   5.303 +		//-------------------------------------------------------------
   5.304 +		// methods
   5.305 +		//-------------------------------------------------------------
   5.306 +
   5.307 +		public void ProcessMessage(Message message)
   5.308 +		{
   5.309 +			int param;
   5.310 +
   5.311 +			switch (message.Msg)
   5.312 +			{
   5.313 +				case WM_KEYDOWN:
   5.314 +					param = message.WParam.ToInt32();
   5.315 +					ProcessKeyDown(param);
   5.316 +					break;
   5.317 +				case WM_APPCOMMAND:
   5.318 +					param = message.LParam.ToInt32();
   5.319 +					ProcessAppCommand(param);
   5.320 +					break;
   5.321 +				case WM_INPUT:
   5.322 +					ProcessInputCommand(ref message);
   5.323 +                    message.Result = new IntPtr(0);
   5.324 +					break;
   5.325 +			}
   5.326 +
   5.327 +		}
   5.328 +
   5.329 +
   5.330 +		//-------------------------------------------------------------
   5.331 +		// methods (helpers)
   5.332 +		//-------------------------------------------------------------
   5.333 +
   5.334 +		private void ProcessKeyDown(int param)
   5.335 +		{
   5.336 +			RemoteControlButton rcb = RemoteControlButton.Unknown;
   5.337 +
   5.338 +			switch (param)
   5.339 +			{
   5.340 +				case (int) Keys.Escape:
   5.341 +					rcb = RemoteControlButton.Clear;
   5.342 +					break;
   5.343 +				case (int) Keys.Down:
   5.344 +					rcb = RemoteControlButton.Down;
   5.345 +					break;
   5.346 +				case (int) Keys.Left:
   5.347 +					rcb = RemoteControlButton.Left;
   5.348 +					break;
   5.349 +				case (int) Keys.D0:
   5.350 +					rcb = RemoteControlButton.Digit0;
   5.351 +					break;
   5.352 +				case (int) Keys.D1:
   5.353 +					rcb = RemoteControlButton.Digit1;
   5.354 +					break;
   5.355 +				case (int) Keys.D2:
   5.356 +					rcb = RemoteControlButton.Digit2;
   5.357 +					break;
   5.358 +				case (int) Keys.D3:
   5.359 +					rcb = RemoteControlButton.Digit3;
   5.360 +					break;
   5.361 +				case (int) Keys.D4:
   5.362 +					rcb = RemoteControlButton.Digit4;
   5.363 +					break;
   5.364 +				case (int) Keys.D5:
   5.365 +					rcb = RemoteControlButton.Digit5;
   5.366 +					break;
   5.367 +				case (int) Keys.D6:
   5.368 +					rcb = RemoteControlButton.Digit6;
   5.369 +					break;
   5.370 +				case (int) Keys.D7:
   5.371 +					rcb = RemoteControlButton.Digit7;
   5.372 +					break;
   5.373 +				case (int) Keys.D8:
   5.374 +					rcb = RemoteControlButton.Digit8;
   5.375 +					break;
   5.376 +				case (int) Keys.D9:
   5.377 +					rcb = RemoteControlButton.Digit9;
   5.378 +					break;
   5.379 +				case (int) Keys.Enter:
   5.380 +					rcb = RemoteControlButton.Enter;
   5.381 +					break;
   5.382 +				case (int) Keys.Right:
   5.383 +					rcb = RemoteControlButton.Right;
   5.384 +					break;
   5.385 +				case (int) Keys.Up:
   5.386 +					rcb = RemoteControlButton.Up;
   5.387 +					break;
   5.388 +			}
   5.389 +
   5.390 +			if (this.ButtonPressed != null && rcb != RemoteControlButton.Unknown)
   5.391 +				this.ButtonPressed(this, new RemoteControlEventArgs(rcb, GetDevice(param)));
   5.392 +		}
   5.393 +
   5.394 +
   5.395 +		private void ProcessAppCommand(int param)
   5.396 +		{
   5.397 +			RemoteControlButton rcb = RemoteControlButton.Unknown;
   5.398 +
   5.399 +			int cmd	= (int) (((ushort) (param >> 16)) & ~FAPPCOMMAND_MASK);
   5.400 +
   5.401 +			switch (cmd)
   5.402 +			{
   5.403 +				case APPCOMMAND_BROWSER_BACKWARD:
   5.404 +					rcb = RemoteControlButton.Back;
   5.405 +					break;
   5.406 +				case APPCOMMAND_MEDIA_CHANNEL_DOWN:
   5.407 +					rcb = RemoteControlButton.ChannelDown;
   5.408 +					break;
   5.409 +				case APPCOMMAND_MEDIA_CHANNEL_UP:
   5.410 +					rcb = RemoteControlButton.ChannelUp;
   5.411 +					break;
   5.412 +				case APPCOMMAND_MEDIA_FAST_FORWARD:
   5.413 +					rcb = RemoteControlButton.FastForward;
   5.414 +					break;
   5.415 +				case APPCOMMAND_VOLUME_MUTE:
   5.416 +					rcb = RemoteControlButton.VolumeMute;
   5.417 +					break;
   5.418 +				case APPCOMMAND_MEDIA_PAUSE:
   5.419 +					rcb = RemoteControlButton.Pause;
   5.420 +					break;
   5.421 +				case APPCOMMAND_MEDIA_PLAY:
   5.422 +					rcb = RemoteControlButton.Play;
   5.423 +					break;
   5.424 +                case APPCOMMAND_MEDIA_PLAY_PAUSE:
   5.425 +                    rcb = RemoteControlButton.PlayPause;
   5.426 +                    break;
   5.427 +				case APPCOMMAND_MEDIA_RECORD:
   5.428 +					rcb = RemoteControlButton.Record;
   5.429 +					break;
   5.430 +				case APPCOMMAND_MEDIA_PREVIOUSTRACK:
   5.431 +					rcb = RemoteControlButton.PreviousTrack;
   5.432 +					break;
   5.433 +				case APPCOMMAND_MEDIA_REWIND:
   5.434 +					rcb = RemoteControlButton.Rewind;
   5.435 +					break;
   5.436 +				case APPCOMMAND_MEDIA_NEXTTRACK:
   5.437 +					rcb = RemoteControlButton.NextTrack;
   5.438 +					break;
   5.439 +				case APPCOMMAND_MEDIA_STOP:
   5.440 +					rcb = RemoteControlButton.Stop;
   5.441 +					break;
   5.442 +				case APPCOMMAND_VOLUME_DOWN:
   5.443 +					rcb = RemoteControlButton.VolumeDown;
   5.444 +					break;
   5.445 +				case APPCOMMAND_VOLUME_UP:
   5.446 +					rcb = RemoteControlButton.VolumeUp;
   5.447 +					break;
   5.448 +			}
   5.449 +
   5.450 +			if (this.ButtonPressed != null && rcb != RemoteControlButton.Unknown)
   5.451 +				this.ButtonPressed(this, new RemoteControlEventArgs(rcb, GetDevice(param)));
   5.452 +		}
   5.453 +
   5.454 +
   5.455 +		private void ProcessInputCommand(ref Message message)
   5.456 +		{
   5.457 +			RemoteControlButton rcb = RemoteControlButton.Unknown;
   5.458 +			uint dwSize = 0;
   5.459 +
   5.460 +            uint sizeOfHeader=(uint)Marshal.SizeOf(typeof(RAWINPUTHEADER));
   5.461 +
   5.462 +            //Get the size of our raw input data.
   5.463 +			GetRawInputData(message.LParam,	RID_INPUT, IntPtr.Zero,	ref dwSize,	sizeOfHeader);
   5.464 +
   5.465 +            //Allocate a large enough buffer
   5.466 +			IntPtr buffer = Marshal.AllocHGlobal((int) dwSize);
   5.467 +			try
   5.468 +			{
   5.469 +				if(buffer == IntPtr.Zero)
   5.470 +					return;
   5.471 +
   5.472 +                //Now read our RAWINPUT data
   5.473 +				if (GetRawInputData(message.LParam,	RID_INPUT, buffer, ref dwSize, (uint) Marshal.SizeOf(typeof(RAWINPUTHEADER))) != dwSize)
   5.474 +				{
   5.475 +					return;
   5.476 +				}
   5.477 +
   5.478 +                //Cast our buffer
   5.479 +                RAWINPUT raw = (RAWINPUT)Marshal.PtrToStructure(buffer, typeof(RAWINPUT));
   5.480 +
   5.481 +                //Check that our raw input is HID
   5.482 +                if (raw.header.dwType == RIM_TYPEHID && raw.hid.dwSizeHid>0)
   5.483 +				{
   5.484 +                    //Allocate a buffer for one HID message
   5.485 +					byte[] bRawData = new byte[raw.hid.dwSizeHid];
   5.486 +
   5.487 +                    //Compute the address from which to copy our HID message
   5.488 +                    int pRawData = 0;
   5.489 +                    unsafe
   5.490 +                    {
   5.491 +                        byte* source = (byte*)buffer;
   5.492 +                        source += sizeof(RAWINPUTHEADER) + sizeof(RAWHID);
   5.493 +                        //source += 1;
   5.494 +                        pRawData = (int)source;
   5.495 +                    }
   5.496 +                    //int pRawData = buffer.ToUint32() + Marshal.SizeOf(typeof(RAWINPUT)) + 1;
   5.497 +
   5.498 +					//Marshal.Copy(new IntPtr(pRawData), bRawData, 0, raw.hid.dwSizeHid - 1);
   5.499 +                    Marshal.Copy(new IntPtr(pRawData), bRawData, 0, raw.hid.dwSizeHid);
   5.500 +					//int rawData = bRawData[0] | bRawData[1] << 8;
   5.501 +                    int rawData = bRawData[1]; //Get button code
   5.502 +                    Debug.WriteLine("HID " + raw.hid.dwCount + "/" + raw.hid.dwSizeHid + ":" + bRawData[0].ToString("X") + bRawData[1].ToString("X"));
   5.503 +
   5.504 +					switch (rawData)
   5.505 +					{
   5.506 +						case RAWINPUT_DETAILS:
   5.507 +							rcb = RemoteControlButton.Details;
   5.508 +							break;
   5.509 +						case RAWINPUT_GUIDE:
   5.510 +							rcb = RemoteControlButton.Guide;
   5.511 +							break;
   5.512 +						case RAWINPUT_TVJUMP:
   5.513 +							rcb = RemoteControlButton.TVJump;
   5.514 +							break;
   5.515 +						case RAWINPUT_STANDBY:
   5.516 +							rcb = RemoteControlButton.StandBy;
   5.517 +							break;
   5.518 +						case RAWINPUT_OEM1:
   5.519 +							rcb = RemoteControlButton.OEM1;
   5.520 +							break;
   5.521 +						case RAWINPUT_OEM2:
   5.522 +							rcb = RemoteControlButton.OEM2;
   5.523 +							break;
   5.524 +						case RAWINPUT_MYTV:
   5.525 +							rcb = RemoteControlButton.MyTV;
   5.526 +							break;
   5.527 +						case RAWINPUT_MYVIDEOS:
   5.528 +							rcb = RemoteControlButton.MyVideos;
   5.529 +							break;
   5.530 +						case RAWINPUT_MYPICTURES:
   5.531 +							rcb = RemoteControlButton.MyPictures;
   5.532 +							break;
   5.533 +						case RAWINPUT_MYMUSIC:
   5.534 +							rcb = RemoteControlButton.MyMusic;
   5.535 +							break;
   5.536 +						case RAWINPUT_RECORDEDTV:
   5.537 +							rcb = RemoteControlButton.RecordedTV;
   5.538 +							break;
   5.539 +						case RAWINPUT_DVDANGLE:
   5.540 +							rcb = RemoteControlButton.DVDAngle;
   5.541 +							break;
   5.542 +						case RAWINPUT_DVDAUDIO:
   5.543 +							rcb = RemoteControlButton.DVDAudio;
   5.544 +							break;
   5.545 +						case RAWINPUT_DVDMENU:
   5.546 +							rcb = RemoteControlButton.DVDMenu;
   5.547 +							break;
   5.548 +						case RAWINPUT_DVDSUBTITLE:
   5.549 +							rcb = RemoteControlButton.DVDSubtitle;
   5.550 +							break;
   5.551 +					}
   5.552 +
   5.553 +					if (rcb != RemoteControlButton.Unknown && this.ButtonPressed != null)
   5.554 +						this.ButtonPressed(this, new RemoteControlEventArgs(rcb, GetDevice(message.LParam.ToInt32())));
   5.555 +				}
   5.556 +				else if(raw.header.dwType == RIM_TYPEMOUSE)
   5.557 +				{
   5.558 +					// do mouse handling...
   5.559 +				}
   5.560 +				else if(raw.header.dwType == RIM_TYPEKEYBOARD)
   5.561 +				{
   5.562 +					// do keyboard handling...
   5.563 +				}
   5.564 +			}
   5.565 +			finally
   5.566 +			{
   5.567 +				Marshal.FreeHGlobal(buffer);
   5.568 +			}
   5.569 +		}
   5.570 +
   5.571 +
   5.572 +		private InputDevice GetDevice(int param)
   5.573 +		{
   5.574 +			InputDevice inputDevice;
   5.575 +
   5.576 +			switch ((int) (((ushort) (param >> 16)) & FAPPCOMMAND_MASK))
   5.577 +			{
   5.578 +				case FAPPCOMMAND_OEM:
   5.579 +					inputDevice = InputDevice.OEM;
   5.580 +					break;
   5.581 +				case FAPPCOMMAND_MOUSE:
   5.582 +					inputDevice = InputDevice.Mouse;
   5.583 +					break;
   5.584 +				default:
   5.585 +					inputDevice = InputDevice.Key;
   5.586 +					break;
   5.587 +			}
   5.588 +
   5.589 +			return inputDevice;
   5.590 +		}
   5.591 +	}
   5.592 +}
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/RemoteControlSample.csproj	Tue Nov 04 19:31:32 2014 +0100
     6.3 @@ -0,0 +1,155 @@
     6.4 +<?xml version="1.0" encoding="utf-8"?>
     6.5 +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
     6.6 +  <PropertyGroup>
     6.7 +    <ProjectType>Local</ProjectType>
     6.8 +    <ProductVersion>7.10.3077</ProductVersion>
     6.9 +    <SchemaVersion>2.0</SchemaVersion>
    6.10 +    <ProjectGuid>{F676C5E5-266C-439A-98C4-EF21CB9957F2}</ProjectGuid>
    6.11 +    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    6.12 +    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    6.13 +    <ApplicationIcon>App.ico</ApplicationIcon>
    6.14 +    <AssemblyKeyContainerName />
    6.15 +    <AssemblyName>RemoteControlSample</AssemblyName>
    6.16 +    <AssemblyOriginatorKeyFile />
    6.17 +    <DefaultClientScript>JScript</DefaultClientScript>
    6.18 +    <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
    6.19 +    <DefaultTargetSchema>IE50</DefaultTargetSchema>
    6.20 +    <DelaySign>false</DelaySign>
    6.21 +    <OutputType>WinExe</OutputType>
    6.22 +    <RootNamespace>RemoteControlSample</RootNamespace>
    6.23 +    <RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
    6.24 +    <StartupObject />
    6.25 +    <FileUpgradeFlags>
    6.26 +    </FileUpgradeFlags>
    6.27 +    <TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
    6.28 +    <UpgradeBackupLocation>
    6.29 +    </UpgradeBackupLocation>
    6.30 +    <OldToolsVersion>0.0</OldToolsVersion>
    6.31 +    <IsWebBootstrapper>false</IsWebBootstrapper>
    6.32 +    <PublishUrl>publish\</PublishUrl>
    6.33 +    <Install>true</Install>
    6.34 +    <InstallFrom>Disk</InstallFrom>
    6.35 +    <UpdateEnabled>false</UpdateEnabled>
    6.36 +    <UpdateMode>Foreground</UpdateMode>
    6.37 +    <UpdateInterval>7</UpdateInterval>
    6.38 +    <UpdateIntervalUnits>Days</UpdateIntervalUnits>
    6.39 +    <UpdatePeriodically>false</UpdatePeriodically>
    6.40 +    <UpdateRequired>false</UpdateRequired>
    6.41 +    <MapFileExtensions>true</MapFileExtensions>
    6.42 +    <ApplicationRevision>0</ApplicationRevision>
    6.43 +    <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
    6.44 +    <UseApplicationTrust>false</UseApplicationTrust>
    6.45 +    <BootstrapperEnabled>true</BootstrapperEnabled>
    6.46 +  </PropertyGroup>
    6.47 +  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    6.48 +    <OutputPath>bin\Debug\</OutputPath>
    6.49 +    <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
    6.50 +    <BaseAddress>285212672</BaseAddress>
    6.51 +    <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
    6.52 +    <ConfigurationOverrideFile />
    6.53 +    <DefineConstants>DEBUG;TRACE</DefineConstants>
    6.54 +    <DocumentationFile />
    6.55 +    <DebugSymbols>true</DebugSymbols>
    6.56 +    <FileAlignment>4096</FileAlignment>
    6.57 +    <NoStdLib>false</NoStdLib>
    6.58 +    <NoWarn />
    6.59 +    <Optimize>false</Optimize>
    6.60 +    <RegisterForComInterop>false</RegisterForComInterop>
    6.61 +    <RemoveIntegerChecks>false</RemoveIntegerChecks>
    6.62 +    <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
    6.63 +    <WarningLevel>4</WarningLevel>
    6.64 +    <DebugType>full</DebugType>
    6.65 +    <ErrorReport>prompt</ErrorReport>
    6.66 +  </PropertyGroup>
    6.67 +  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    6.68 +    <OutputPath>bin\Release\</OutputPath>
    6.69 +    <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
    6.70 +    <BaseAddress>285212672</BaseAddress>
    6.71 +    <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
    6.72 +    <ConfigurationOverrideFile />
    6.73 +    <DefineConstants>TRACE</DefineConstants>
    6.74 +    <DocumentationFile />
    6.75 +    <DebugSymbols>false</DebugSymbols>
    6.76 +    <FileAlignment>4096</FileAlignment>
    6.77 +    <NoStdLib>false</NoStdLib>
    6.78 +    <NoWarn />
    6.79 +    <Optimize>true</Optimize>
    6.80 +    <RegisterForComInterop>false</RegisterForComInterop>
    6.81 +    <RemoveIntegerChecks>false</RemoveIntegerChecks>
    6.82 +    <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
    6.83 +    <WarningLevel>4</WarningLevel>
    6.84 +    <DebugType>none</DebugType>
    6.85 +    <ErrorReport>prompt</ErrorReport>
    6.86 +  </PropertyGroup>
    6.87 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
    6.88 +    <DebugSymbols>true</DebugSymbols>
    6.89 +    <OutputPath>bin\x86\Debug\</OutputPath>
    6.90 +    <DefineConstants>DEBUG;TRACE</DefineConstants>
    6.91 +    <BaseAddress>285212672</BaseAddress>
    6.92 +    <FileAlignment>4096</FileAlignment>
    6.93 +    <DebugType>full</DebugType>
    6.94 +    <PlatformTarget>x86</PlatformTarget>
    6.95 +    <ErrorReport>prompt</ErrorReport>
    6.96 +    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
    6.97 +    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
    6.98 +  </PropertyGroup>
    6.99 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
   6.100 +    <OutputPath>bin\x86\Release\</OutputPath>
   6.101 +    <DefineConstants>TRACE</DefineConstants>
   6.102 +    <BaseAddress>285212672</BaseAddress>
   6.103 +    <Optimize>true</Optimize>
   6.104 +    <FileAlignment>4096</FileAlignment>
   6.105 +    <PlatformTarget>x86</PlatformTarget>
   6.106 +    <ErrorReport>prompt</ErrorReport>
   6.107 +    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
   6.108 +  </PropertyGroup>
   6.109 +  <ItemGroup>
   6.110 +    <Reference Include="System">
   6.111 +      <Name>System</Name>
   6.112 +    </Reference>
   6.113 +    <Reference Include="System.Data">
   6.114 +      <Name>System.Data</Name>
   6.115 +    </Reference>
   6.116 +    <Reference Include="System.Drawing">
   6.117 +      <Name>System.Drawing</Name>
   6.118 +    </Reference>
   6.119 +    <Reference Include="System.Windows.Forms">
   6.120 +      <Name>System.Windows.Forms</Name>
   6.121 +    </Reference>
   6.122 +    <Reference Include="System.XML">
   6.123 +      <Name>System.XML</Name>
   6.124 +    </Reference>
   6.125 +  </ItemGroup>
   6.126 +  <ItemGroup>
   6.127 +    <Compile Include="AssemblyInfo.cs">
   6.128 +      <SubType>Code</SubType>
   6.129 +    </Compile>
   6.130 +    <Compile Include="Form1.cs">
   6.131 +      <SubType>Form</SubType>
   6.132 +    </Compile>
   6.133 +    <Compile Include="RemoteControlDevice.cs">
   6.134 +      <SubType>Code</SubType>
   6.135 +    </Compile>
   6.136 +    <Content Include="App.ico" />
   6.137 +    <EmbeddedResource Include="Form1.resx">
   6.138 +      <DependentUpon>Form1.cs</DependentUpon>
   6.139 +    </EmbeddedResource>
   6.140 +  </ItemGroup>
   6.141 +  <ItemGroup>
   6.142 +    <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
   6.143 +      <Visible>False</Visible>
   6.144 +      <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
   6.145 +      <Install>false</Install>
   6.146 +    </BootstrapperPackage>
   6.147 +    <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
   6.148 +      <Visible>False</Visible>
   6.149 +      <ProductName>.NET Framework 3.5 SP1</ProductName>
   6.150 +      <Install>true</Install>
   6.151 +    </BootstrapperPackage>
   6.152 +  </ItemGroup>
   6.153 +  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   6.154 +  <PropertyGroup>
   6.155 +    <PreBuildEvent />
   6.156 +    <PostBuildEvent />
   6.157 +  </PropertyGroup>
   6.158 +</Project>
   6.159 \ No newline at end of file
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/RemoteControlSample.sln	Tue Nov 04 19:31:32 2014 +0100
     7.3 @@ -0,0 +1,26 @@
     7.4 +
     7.5 +Microsoft Visual Studio Solution File, Format Version 12.00
     7.6 +# Visual Studio 2012
     7.7 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RemoteControlSample", "RemoteControlSample.csproj", "{F676C5E5-266C-439A-98C4-EF21CB9957F2}"
     7.8 +EndProject
     7.9 +Global
    7.10 +	GlobalSection(SolutionConfigurationPlatforms) = preSolution
    7.11 +		Debug|Any CPU = Debug|Any CPU
    7.12 +		Debug|x86 = Debug|x86
    7.13 +		Release|Any CPU = Release|Any CPU
    7.14 +		Release|x86 = Release|x86
    7.15 +	EndGlobalSection
    7.16 +	GlobalSection(ProjectConfigurationPlatforms) = postSolution
    7.17 +		{F676C5E5-266C-439A-98C4-EF21CB9957F2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
    7.18 +		{F676C5E5-266C-439A-98C4-EF21CB9957F2}.Debug|Any CPU.Build.0 = Debug|Any CPU
    7.19 +		{F676C5E5-266C-439A-98C4-EF21CB9957F2}.Debug|x86.ActiveCfg = Debug|x86
    7.20 +		{F676C5E5-266C-439A-98C4-EF21CB9957F2}.Debug|x86.Build.0 = Debug|x86
    7.21 +		{F676C5E5-266C-439A-98C4-EF21CB9957F2}.Release|Any CPU.ActiveCfg = Release|Any CPU
    7.22 +		{F676C5E5-266C-439A-98C4-EF21CB9957F2}.Release|Any CPU.Build.0 = Release|Any CPU
    7.23 +		{F676C5E5-266C-439A-98C4-EF21CB9957F2}.Release|x86.ActiveCfg = Release|x86
    7.24 +		{F676C5E5-266C-439A-98C4-EF21CB9957F2}.Release|x86.Build.0 = Release|x86
    7.25 +	EndGlobalSection
    7.26 +	GlobalSection(SolutionProperties) = preSolution
    7.27 +		HideSolutionNode = FALSE
    7.28 +	EndGlobalSection
    7.29 +EndGlobal