Let’s start in the end of the post with the output video
Now a little explanation on how to assemble this. I used the basis of my post about How to control with C# XBoxOne command. Then with a bit of code to control the rocket launcher, I get to connect both devices and the fun starts.
The complete solution includes 3 projects, 1 is responsible for controlling the Rocket Launcher, then the app WPF to coordinate signals of the remote control and the Lance missiles. Finally I have a PCL that is responsible for translating Int32 values from the command in command more basic type: up, down, left or right.
Actually, the work has not been very complicated, the only thing I had to keep in mind is the values that sends the controller. After seeing that the GamePad moves in the range of an Int32, the best thing was to define values for LeftFar > Left > Center > Right > RightFar, with values between – 20000 > – 10000 > 0 > 10000 > 20000. In this way a kind MoveControler helped me to translate these values the position of the joystick on the remote control.
The example is pretty simple, since I use the classes that I have created in previous posts to control the Lance missiles. For example
In this example I have left out the “corners”, I have to update the class RocketController to support this elegantly
By the way, the full code can be downloaded from here: http://1drv.ms/1pQDQQx
Important: I deleted the NuGet packages so that the code is not very heavy, please download them again to be able to compile the solution.
Saludos @ Home