RemoteControlDevice.cs
changeset 20 f2b65a8318e9
parent 19 d066e3999973
child 21 fb4f80d5cf57
     1.1 --- a/RemoteControlDevice.cs	Sat Dec 06 00:59:59 2014 +0100
     1.2 +++ b/RemoteControlDevice.cs	Sat Dec 06 01:09:32 2014 +0100
     1.3 @@ -207,9 +207,6 @@
     1.4  				case Const.WM_KEYDOWN:
     1.5                      ProcessKeyDown(message.WParam);
     1.6  					break;
     1.7 -                case Const.WM_APPCOMMAND:
     1.8 -					//ProcessAppCommand(message.LParam);
     1.9 -					break;
    1.10                  case Const.WM_INPUT:
    1.11                      //Returning zero means we processed that message.
    1.12                      message.Result = new IntPtr(0);
    1.13 @@ -281,70 +278,10 @@
    1.14  			}
    1.15  
    1.16  			if (this.ButtonPressed != null && rcb != RemoteControlButton.Unknown)
    1.17 -				this.ButtonPressed(this, new RemoteControlEventArgs(rcb, GetDevice(wParam)));
    1.18 +                this.ButtonPressed(this, new RemoteControlEventArgs(rcb, InputDevice.Key));
    1.19  		}
    1.20  
    1.21  
    1.22 -		private void ProcessAppCommand(IntPtr lParam)
    1.23 -		{
    1.24 -			RemoteControlButton rcb = RemoteControlButton.Unknown;
    1.25 -
    1.26 -            int cmd = Macro.GET_APPCOMMAND_LPARAM(lParam);
    1.27 -                //(int) (((ushort) (param >> 16)) & ~Const.FAPPCOMMAND_MASK);
    1.28 -
    1.29 -			switch (cmd)
    1.30 -			{
    1.31 -                case Const.APPCOMMAND_BROWSER_BACKWARD:
    1.32 -					rcb = RemoteControlButton.Back;
    1.33 -					break;
    1.34 -                case Const.APPCOMMAND_MEDIA_CHANNEL_DOWN:
    1.35 -					rcb = RemoteControlButton.ChannelDown;
    1.36 -					break;
    1.37 -                case Const.APPCOMMAND_MEDIA_CHANNEL_UP:
    1.38 -					rcb = RemoteControlButton.ChannelUp;
    1.39 -					break;
    1.40 -                case Const.APPCOMMAND_MEDIA_FAST_FORWARD:
    1.41 -					rcb = RemoteControlButton.FastForward;
    1.42 -					break;
    1.43 -                case Const.APPCOMMAND_VOLUME_MUTE:
    1.44 -					rcb = RemoteControlButton.VolumeMute;
    1.45 -					break;
    1.46 -                case Const.APPCOMMAND_MEDIA_PAUSE:
    1.47 -					rcb = RemoteControlButton.Pause;
    1.48 -					break;
    1.49 -                case Const.APPCOMMAND_MEDIA_PLAY:
    1.50 -					rcb = RemoteControlButton.Play;
    1.51 -					break;
    1.52 -                case Const.APPCOMMAND_MEDIA_PLAY_PAUSE:
    1.53 -                    rcb = RemoteControlButton.PlayPause;
    1.54 -                    break;
    1.55 -                case Const.APPCOMMAND_MEDIA_RECORD:
    1.56 -					rcb = RemoteControlButton.Record;
    1.57 -					break;
    1.58 -                case Const.APPCOMMAND_MEDIA_PREVIOUSTRACK:
    1.59 -					rcb = RemoteControlButton.PreviousTrack;
    1.60 -					break;
    1.61 -                case Const.APPCOMMAND_MEDIA_REWIND:
    1.62 -					rcb = RemoteControlButton.Rewind;
    1.63 -					break;
    1.64 -                case Const.APPCOMMAND_MEDIA_NEXTTRACK:
    1.65 -					rcb = RemoteControlButton.NextTrack;
    1.66 -					break;
    1.67 -                case Const.APPCOMMAND_MEDIA_STOP:
    1.68 -					rcb = RemoteControlButton.Stop;
    1.69 -					break;
    1.70 -                case Const.APPCOMMAND_VOLUME_DOWN:
    1.71 -					rcb = RemoteControlButton.VolumeDown;
    1.72 -					break;
    1.73 -                case Const.APPCOMMAND_VOLUME_UP:
    1.74 -					rcb = RemoteControlButton.VolumeUp;
    1.75 -					break;
    1.76 -			}
    1.77 -
    1.78 -			if (this.ButtonPressed != null && rcb != RemoteControlButton.Unknown)
    1.79 -                this.ButtonPressed(this, new RemoteControlEventArgs(rcb, GetDevice(lParam)));
    1.80 -		}
    1.81 -
    1.82          /// <summary>
    1.83          /// 
    1.84          /// </summary>
    1.85 @@ -539,26 +476,5 @@
    1.86                  Marshal.FreeHGlobal(preParsedData);
    1.87              }
    1.88  		}
    1.89 -
    1.90 -
    1.91 -		private InputDevice GetDevice(IntPtr lParam)
    1.92 -		{
    1.93 -			InputDevice inputDevice;
    1.94 -
    1.95 -            switch (Macro.GET_DEVICE_LPARAM(lParam))
    1.96 -			{
    1.97 -				case Const.FAPPCOMMAND_OEM:
    1.98 -					inputDevice = InputDevice.OEM;
    1.99 -					break;
   1.100 -				case Const.FAPPCOMMAND_MOUSE:
   1.101 -					inputDevice = InputDevice.Mouse;
   1.102 -					break;
   1.103 -				default:
   1.104 -					inputDevice = InputDevice.Key;
   1.105 -					break;
   1.106 -			}
   1.107 -
   1.108 -			return inputDevice;
   1.109 -		}
   1.110  	}
   1.111  }