From f17d39f37cac50861467e07a7bee40534d20100a Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Wed, 4 Mar 2020 21:32:42 +0200 Subject: Improved "Notify Continuous Requests About Disconnection". Integrated FSE/PPC Remote Desktop. Implemented RemoteDesktopService / RemoteDesktopProvider. Implemented Mouse/Keyboard gestures. --- .../Input/KeyboardController.cs | 79 ++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 Software/Visual_Studio/Tango.RemoteDesktop/Input/KeyboardController.cs (limited to 'Software/Visual_Studio/Tango.RemoteDesktop/Input/KeyboardController.cs') diff --git a/Software/Visual_Studio/Tango.RemoteDesktop/Input/KeyboardController.cs b/Software/Visual_Studio/Tango.RemoteDesktop/Input/KeyboardController.cs new file mode 100644 index 000000000..832018dac --- /dev/null +++ b/Software/Visual_Studio/Tango.RemoteDesktop/Input/KeyboardController.cs @@ -0,0 +1,79 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Input; +using WindowsInput; +using WindowsInput.Native; + +namespace Tango.RemoteDesktop.Input +{ + public static class KeyboardController + { + private static InputSimulator simulator; + + static KeyboardController() + { + simulator = new InputSimulator(); + } + + public static void KeyDown(Key key, bool ctrlDown, bool shitDown, bool altDown) + { + VirtualKeyCode virtualKey = (VirtualKeyCode)KeyInterop.VirtualKeyFromKey(key); + + if (ctrlDown || shitDown || altDown) + { + List modifierKeys = new List(); + + if (ctrlDown) + { + modifierKeys.Add(VirtualKeyCode.LCONTROL); + } + if (shitDown) + { + modifierKeys.Add(VirtualKeyCode.LSHIFT); + } + if (altDown) + { + modifierKeys.Add(VirtualKeyCode.MENU); + } + + simulator.Keyboard.ModifiedKeyStroke(modifierKeys, virtualKey); + } + else + { + simulator.Keyboard.KeyDown(virtualKey); + } + } + + public static void KeyUp(Key key, bool ctrlDown, bool shitDown, bool altDown) + { + VirtualKeyCode virtualKey = (VirtualKeyCode)KeyInterop.VirtualKeyFromKey(key); + + if (ctrlDown || shitDown || altDown) + { + List modifierKeys = new List(); + + if (ctrlDown) + { + modifierKeys.Add(VirtualKeyCode.LCONTROL); + } + if (shitDown) + { + modifierKeys.Add(VirtualKeyCode.LSHIFT); + } + if (altDown) + { + modifierKeys.Add(VirtualKeyCode.MENU); + } + + simulator.Keyboard.ModifiedKeyStroke(modifierKeys, virtualKey); + } + else + { + simulator.Keyboard.KeyUp(virtualKey); + } + } + } +} -- cgit v1.3.1