From 862ee0839083ca350125d48841ce7427d5a578d9 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Sun, 31 May 2020 17:00:45 +0300 Subject: PPC 1.1.17 MS 4.1.11 --- .../Machine Studio Installer.aip | 33 ++------------------- .../PPC Installer-cache/cacheIndex.txt | Bin 52 -> 52 bytes .../Advanced Installer Projects/PPC Installer.aip | 28 +++++++++++------ .../Properties/AssemblyInfo.cs | 2 +- .../PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs | 2 +- .../Visual_Studio/PPC/Tango.PPC.UI/app.manifest | 2 +- 6 files changed, 25 insertions(+), 42 deletions(-) (limited to 'Software/Visual_Studio') diff --git a/Software/Visual_Studio/Advanced Installer Projects/Machine Studio Installer.aip b/Software/Visual_Studio/Advanced Installer Projects/Machine Studio Installer.aip index d4f515069..2ce93f743 100644 --- a/Software/Visual_Studio/Advanced Installer Projects/Machine Studio Installer.aip +++ b/Software/Visual_Studio/Advanced Installer Projects/Machine Studio Installer.aip @@ -16,10 +16,10 @@ - + - + @@ -806,33 +806,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -844,7 +817,7 @@ - + diff --git a/Software/Visual_Studio/Advanced Installer Projects/PPC Installer-cache/cacheIndex.txt b/Software/Visual_Studio/Advanced Installer Projects/PPC Installer-cache/cacheIndex.txt index 9453b5c13..a603ff06b 100644 Binary files a/Software/Visual_Studio/Advanced Installer Projects/PPC Installer-cache/cacheIndex.txt and b/Software/Visual_Studio/Advanced Installer Projects/PPC Installer-cache/cacheIndex.txt differ diff --git a/Software/Visual_Studio/Advanced Installer Projects/PPC Installer.aip b/Software/Visual_Studio/Advanced Installer Projects/PPC Installer.aip index 2da259bc0..631fd61b5 100644 --- a/Software/Visual_Studio/Advanced Installer Projects/PPC Installer.aip +++ b/Software/Visual_Studio/Advanced Installer Projects/PPC Installer.aip @@ -18,10 +18,10 @@ - + - + @@ -147,6 +147,7 @@ + @@ -202,11 +203,13 @@ + + + + - - @@ -453,6 +456,12 @@ + + + + + + @@ -462,7 +471,7 @@ - + @@ -530,8 +539,6 @@ - - @@ -722,8 +729,11 @@ - - + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs index 20cfa84df..5d5571e57 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs @@ -4,5 +4,5 @@ using System.Runtime.InteropServices; [assembly: System.Windows.ThemeInfo(System.Windows.ResourceDictionaryLocation.None, System.Windows.ResourceDictionaryLocation.SourceAssembly)] [assembly: AssemblyTitle("Tango - Machine Studio")] -[assembly: AssemblyVersion("4.1.10.0")] +[assembly: AssemblyVersion("4.1.11.0")] [assembly: ComVisible(false)] \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs index 23fecdf0e..aff093b15 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs @@ -8,4 +8,4 @@ using System.Windows; // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Tango PPC Application")] -[assembly: AssemblyVersion("1.1.16.0")] +[assembly: AssemblyVersion("1.1.17.0")] diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest b/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest index efc5f8179..d72e75011 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest @@ -16,7 +16,7 @@ Remove this element if your application requires this virtualization for backwards compatibility. --> - + -- cgit v1.3.1 From aff00af76242117e3991b0ee526df905a63debce Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Mon, 1 Jun 2020 02:06:40 +0300 Subject: Remote Cursor. Cursor Visibility. Mouse Scroll. PPC notification bar workaround. --- .../Controls/RemoteDesktopControl.xaml | 4 +- .../Controls/RemoteDesktopControl.xaml.cs | 6 ++ .../ViewModels/RemoteDesktopViewVM.cs | 26 ++++++ .../RemoteDesktop/DesktopFrameReceivedEventArgs.cs | 2 + .../RemoteDesktop/IRemoteDesktopProvider.cs | 24 ++++++ .../Tango.FSE.UI/Properties/Resources.Designer.cs | 44 +++++----- .../FSE/Tango.FSE.UI/Properties/Resources.resx | 13 +-- .../RemoteDesktop/DefaultRemoteDesktopProvider.cs | 90 ++++++++++++++++++++- .../WindowsManager/ChildWindow.xaml.cs | 2 +- .../Properties/Resources.Designer.cs | 22 ++++- .../PPC/Tango.PPC.Common/Properties/Resources.resx | 20 +++-- .../RemoteDesktop/DefaultRemoteDesktopService.cs | 40 ++++++++- .../PPC/Tango.PPC.Common/Resources/finger3.png | Bin 0 -> 1005 bytes .../PPC/Tango.PPC.Common/Resources/tap.png | Bin 0 -> 1316 bytes .../PPC/Tango.PPC.Common/Tango.PPC.Common.csproj | 8 +- .../Visual_Studio/PPC/Tango.PPC.UI/app.manifest | 2 +- .../Tango.RemoteDesktop/Frames/RasterFrame.cs | 12 +++ .../Tango.RemoteDesktop/Input/MouseController.cs | 5 ++ .../Tango.RemoteDesktop/Network/MouseEventType.cs | 3 +- .../Network/MouseStateRequest.cs | 1 + .../Network/RemoteDesktopPacket.cs | 11 +++ .../Network/SetCursorVisibilityRequest.cs | 13 +++ .../Network/SetCursorVisibilityResponse.cs | 13 +++ .../Tango.RemoteDesktop/Tango.RemoteDesktop.csproj | 2 + .../Tango.Touch/Controls/TouchNotificationBar.cs | 7 +- 25 files changed, 323 insertions(+), 47 deletions(-) create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Common/Resources/finger3.png create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Common/Resources/tap.png create mode 100644 Software/Visual_Studio/Tango.RemoteDesktop/Network/SetCursorVisibilityRequest.cs create mode 100644 Software/Visual_Studio/Tango.RemoteDesktop/Network/SetCursorVisibilityResponse.cs (limited to 'Software/Visual_Studio') diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.PPCConsole/Controls/RemoteDesktopControl.xaml b/Software/Visual_Studio/FSE/Modules/Tango.FSE.PPCConsole/Controls/RemoteDesktopControl.xaml index a630dbac6..b3c3dbbc9 100644 --- a/Software/Visual_Studio/FSE/Modules/Tango.FSE.PPCConsole/Controls/RemoteDesktopControl.xaml +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.PPCConsole/Controls/RemoteDesktopControl.xaml @@ -43,8 +43,8 @@ - - + + diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.PPCConsole/Controls/RemoteDesktopControl.xaml.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.PPCConsole/Controls/RemoteDesktopControl.xaml.cs index c32ab3048..617c3ec44 100644 --- a/Software/Visual_Studio/FSE/Modules/Tango.FSE.PPCConsole/Controls/RemoteDesktopControl.xaml.cs +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.PPCConsole/Controls/RemoteDesktopControl.xaml.cs @@ -34,6 +34,7 @@ namespace Tango.FSE.PPCConsole.Controls img.PreviewMouseMove += Img_PreviewMouseMove; img.PreviewKeyDown += Img_PreviewKeyDown; img.PreviewKeyUp += Img_PreviewKeyUp; + img.PreviewMouseWheel += Img_PreviewMouseWheel; } private void Img_PreviewKeyDown(object sender, KeyEventArgs e) @@ -73,6 +74,11 @@ namespace Tango.FSE.PPCConsole.Controls _vm.OnMouseMove(e.GetPosition(img), new Size(img.ActualWidth, img.ActualHeight)); } + private void Img_PreviewMouseWheel(object sender, MouseWheelEventArgs e) + { + _vm.OnMouseScroll(e.Delta, e.GetPosition(img), new Size(img.ActualWidth, img.ActualHeight)); + } + private void BtnSnapshot_Click(object sender, RoutedEventArgs e) { rectSnapshot.StartDoubleAnimation(Rectangle.OpacityProperty, TimeSpan.FromSeconds(0.2), 1, 0, null, null, null, true); diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.PPCConsole/ViewModels/RemoteDesktopViewVM.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.PPCConsole/ViewModels/RemoteDesktopViewVM.cs index b4a0b07ea..bedcf9b7a 100644 --- a/Software/Visual_Studio/FSE/Modules/Tango.FSE.PPCConsole/ViewModels/RemoteDesktopViewVM.cs +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.PPCConsole/ViewModels/RemoteDesktopViewVM.cs @@ -57,6 +57,13 @@ namespace Tango.FSE.PPCConsole.ViewModels set { _recordingTime = value; RaisePropertyChangedAuto(); } } + private bool _cursorVisible; + public bool CursorVisible + { + get { return _cursorVisible; } + set { _cursorVisible = value; RaisePropertyChangedAuto(); SetCursorVisibility(); } + } + #endregion #region Commands @@ -127,6 +134,7 @@ namespace Tango.FSE.PPCConsole.ViewModels base.OnApplicationStarted(); RemoteDesktopProvider.FrameReceived += RemoteDesktopProvider_FrameReceived; + RemoteDesktopProvider.SessionStopped += RemoteDesktopProvider_SessionStopped; MachineProvider.MachineConnected += MachineProvider_MachineConnected; } @@ -162,6 +170,14 @@ namespace Tango.FSE.PPCConsole.ViewModels private void RemoteDesktopProvider_FrameReceived(object sender, DesktopFrameReceivedEventArgs e) { Source = e.Source; + _cursorVisible = e.CursorVisible; + RaisePropertyChanged(nameof(CursorVisible)); + } + + private void RemoteDesktopProvider_SessionStopped(object sender, EventArgs e) + { + _cursorVisible = false; + RaisePropertyChanged(nameof(CursorVisible)); } #endregion @@ -216,6 +232,11 @@ namespace Tango.FSE.PPCConsole.ViewModels RemoteDesktopProvider.MouseDoubleClick(changedButton, point, size); } + public void OnMouseScroll(int delta, System.Windows.Point point, System.Windows.Size size) + { + RemoteDesktopProvider.MouseScroll(delta, point, size); + } + public void OnKeyboardDown(Key key, bool ctrlDown, bool shitDown, bool altDown) { RemoteDesktopProvider.KeyboardDown(key, ctrlDown, shitDown, altDown); @@ -226,6 +247,11 @@ namespace Tango.FSE.PPCConsole.ViewModels RemoteDesktopProvider.KeyboardUp(key, ctrlDown, shitDown, altDown); } + private void SetCursorVisibility() + { + RemoteDesktopProvider.SetRemoteCursorVisibility(CursorVisible); + } + #endregion #region Snapshot diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/RemoteDesktop/DesktopFrameReceivedEventArgs.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/RemoteDesktop/DesktopFrameReceivedEventArgs.cs index 44094ad89..1dee4c8e2 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.Common/RemoteDesktop/DesktopFrameReceivedEventArgs.cs +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/RemoteDesktop/DesktopFrameReceivedEventArgs.cs @@ -18,5 +18,7 @@ namespace Tango.FSE.Common.RemoteDesktop public BitmapSource Source { get; set; } public FrameOrigin Origin { get; set; } + + public bool CursorVisible { get; set; } } } diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/RemoteDesktop/IRemoteDesktopProvider.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/RemoteDesktop/IRemoteDesktopProvider.cs index ff93923fb..81f19ff6d 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.Common/RemoteDesktop/IRemoteDesktopProvider.cs +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/RemoteDesktop/IRemoteDesktopProvider.cs @@ -15,6 +15,16 @@ namespace Tango.FSE.Common.RemoteDesktop /// public interface IRemoteDesktopProvider { + /// + /// Occurs when a remote desktop session has started. + /// + event EventHandler SessionStarted; + + /// + /// Occurs when a remote desktop session has stopped. + /// + event EventHandler SessionStopped; + /// /// Occurs when a new remote desktop screen frame is available. /// @@ -109,6 +119,14 @@ namespace Tango.FSE.Common.RemoteDesktop /// Size of the view. void MouseDoubleClick(MouseButton button, Point location, Size viewSize); + /// + /// Send a mouse scroll command to the remote PPC. + /// + /// The delta. + /// The location. + /// Size of the view. + void MouseScroll(int delta, Point location, Size viewSize); + /// /// Sends a key down command to the remote PPC. /// @@ -132,5 +150,11 @@ namespace Tango.FSE.Common.RemoteDesktop /// /// The command. void SendCommand(RemoteDesktopCommand command); + + /// + /// Sets the remote cursor visibility. + /// + /// if set to true [visible]. + void SetRemoteCursorVisibility(bool visible); } } diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/Properties/Resources.Designer.cs b/Software/Visual_Studio/FSE/Tango.FSE.UI/Properties/Resources.Designer.cs index b9a160c5e..9a772a793 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.UI/Properties/Resources.Designer.cs +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/Properties/Resources.Designer.cs @@ -8,10 +8,10 @@ // //------------------------------------------------------------------------------ -namespace Tango.FSE.UI.Properties -{ - - +namespace Tango.FSE.UI.Properties { + using System; + + /// /// A strongly-typed resource class, for looking up localized strings, etc. /// @@ -19,51 +19,43 @@ namespace Tango.FSE.UI.Properties // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources - { - + internal class Resources { + private static global::System.Resources.ResourceManager resourceMan; - + private static global::System.Globalization.CultureInfo resourceCulture; - + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() - { + internal Resources() { } - + /// /// Returns the cached ResourceManager instance used by this class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager - { - get - { - if ((resourceMan == null)) - { + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Tango.FSE.UI.Properties.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; } } - + /// /// Overrides the current thread's CurrentUICulture property for all /// resource lookups using this strongly typed resource class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture - { - get - { + internal static global::System.Globalization.CultureInfo Culture { + get { return resourceCulture; } - set - { + set { resourceCulture = value; } } diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/Properties/Resources.resx b/Software/Visual_Studio/FSE/Tango.FSE.UI/Properties/Resources.resx index af7dbebba..1af7de150 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.UI/Properties/Resources.resx +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/Properties/Resources.resx @@ -46,7 +46,7 @@ mimetype: application/x-microsoft.net.object.binary.base64 value : The object must be serialized with - : System.Serialization.Formatters.Binary.BinaryFormatter + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter : and then encoded with base64 encoding. mimetype: application/x-microsoft.net.object.soap.base64 @@ -60,6 +60,7 @@ : and then encoded with base64 encoding. --> + @@ -68,9 +69,10 @@ - + + @@ -85,9 +87,10 @@ - + + @@ -109,9 +112,9 @@ 2.0 - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 \ No newline at end of file diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/RemoteDesktop/DefaultRemoteDesktopProvider.cs b/Software/Visual_Studio/FSE/Tango.FSE.UI/RemoteDesktop/DefaultRemoteDesktopProvider.cs index b43a13e61..e69e39e87 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.UI/RemoteDesktop/DefaultRemoteDesktopProvider.cs +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/RemoteDesktop/DefaultRemoteDesktopProvider.cs @@ -52,6 +52,7 @@ namespace Tango.FSE.UI.RemoteDesktop private List _iceCandidates; private bool _answerReceived; private JsonSerializerSettings _jsonSettings; + private bool _cursorVisible; [TangoInject] private INotificationProvider NotificationProvider { get; set; } @@ -61,6 +62,16 @@ namespace Tango.FSE.UI.RemoteDesktop #region Events + /// + /// Occurs when a remote desktop session has started. + /// + public event EventHandler SessionStarted; + + /// + /// Occurs when a remote desktop session has stopped. + /// + public event EventHandler SessionStopped; + /// /// Occurs when a new remote desktop screen frame is available. /// @@ -92,7 +103,26 @@ namespace Tango.FSE.UI.RemoteDesktop public bool InSession { get { return _inSession; } - set { _inSession = value; RaisePropertyChangedAuto(); RaisePropertyChanged(nameof(CanStartSession)); } + set + { + bool changed = _inSession != value; + + _inSession = value; + RaisePropertyChangedAuto(); + RaisePropertyChanged(nameof(CanStartSession)); + + if (changed) + { + if (_inSession) + { + SessionStarted?.Invoke(this, new EventArgs()); + } + else + { + SessionStopped.Invoke(this, new EventArgs()); + } + } + } } /// @@ -361,7 +391,8 @@ namespace Tango.FSE.UI.RemoteDesktop FrameReceived?.Invoke(this, new DesktopFrameReceivedEventArgs() { Source = source, - Origin = origin + Origin = origin, + CursorVisible = _cursorVisible }); } } @@ -407,6 +438,7 @@ namespace Tango.FSE.UI.RemoteDesktop } } + _cursorVisible = response.Packet.CursorVisible; OnFrameReceived(_currentFrame.ToBitmapSource()); } catch (Exception ex) @@ -588,6 +620,60 @@ namespace Tango.FSE.UI.RemoteDesktop } } + /// + /// Send a mouse scroll command to the remote PPC. + /// + /// The delta. + /// The location. + /// Size of the view. + public async void MouseScroll(int delta, Point location, Size viewSize) + { + if (!InSession || _frameSize == null) return; + if (!AuthenticationProvider.CurrentUser.HasPermission(Permissions.FSE_RemoteDesktopControl)) return; + + try + { + var request = new MouseStateRequest() + { + Button = MouseButton.Middle, + EventType = MouseEventType.Scroll, + Location = TranslateLocation(location, viewSize), + ScrollDelta = delta + }; + + if (IsWebRtcActive) + { + SendWebRtcObject(request); + } + else + { + await _machineProvider.MachineOperator.SendGenericRequest(request); + } + } + catch (Exception ex) + { + LogManager.Log(ex, "Error sending remote desktop mouse scroll command."); + } + } + + /// + /// Sets the remote cursor visibility. + /// + /// if set to true [visible]. + public async void SetRemoteCursorVisibility(bool visible) + { + try + { + var request = new SetCursorVisibilityRequest() { Visible = visible }; + await _machineProvider.MachineOperator.SendGenericRequest(request); + _cursorVisible = visible; + } + catch (Exception ex) + { + LogManager.Log(ex, "Error sending remote desktop mouse visibility command."); + } + } + /// /// Translates the location. /// diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/WindowsManager/ChildWindow.xaml.cs b/Software/Visual_Studio/FSE/Tango.FSE.UI/WindowsManager/ChildWindow.xaml.cs index 466eece26..bd21b9cc3 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.UI/WindowsManager/ChildWindow.xaml.cs +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/WindowsManager/ChildWindow.xaml.cs @@ -36,7 +36,7 @@ namespace Tango.FSE.UI.WindowsManager _startPoint = e.GetPosition(this); - if (e.ClickCount > 1) + if (e.ClickCount > 1 && btnMaximize.IsEnabled) { WindowState = WindowState == WindowState.Normal ? WindowState.Maximized : WindowState.Normal; return; diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Properties/Resources.Designer.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Properties/Resources.Designer.cs index 60e2bdb01..30828af87 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Properties/Resources.Designer.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Properties/Resources.Designer.cs @@ -19,7 +19,7 @@ namespace Tango.PPC.Common.Properties { // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { @@ -59,5 +59,25 @@ namespace Tango.PPC.Common.Properties { resourceCulture = value; } } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap finger3 { + get { + object obj = ResourceManager.GetObject("finger3", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap tap { + get { + object obj = ResourceManager.GetObject("tap", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Properties/Resources.resx b/Software/Visual_Studio/PPC/Tango.PPC.Common/Properties/Resources.resx index af7dbebba..ca6197f54 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Properties/Resources.resx +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Properties/Resources.resx @@ -46,7 +46,7 @@ mimetype: application/x-microsoft.net.object.binary.base64 value : The object must be serialized with - : System.Serialization.Formatters.Binary.BinaryFormatter + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter : and then encoded with base64 encoding. mimetype: application/x-microsoft.net.object.soap.base64 @@ -60,6 +60,7 @@ : and then encoded with base64 encoding. --> + @@ -68,9 +69,10 @@ - + + @@ -85,9 +87,10 @@ - + + @@ -109,9 +112,16 @@ 2.0 - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ..\Resources\finger3.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\tap.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/RemoteDesktop/DefaultRemoteDesktopService.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/RemoteDesktop/DefaultRemoteDesktopService.cs index b118dcdda..9a815df11 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/RemoteDesktop/DefaultRemoteDesktopService.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/RemoteDesktop/DefaultRemoteDesktopService.cs @@ -6,6 +6,7 @@ using System.Linq; using System.Security.Authentication; using System.Text; using System.Threading.Tasks; +using System.Windows; using System.Windows.Input; using Tango.Core; using Tango.Core.DI; @@ -38,6 +39,9 @@ namespace Tango.PPC.Common.RemoteDesktop private JsonSerializerSettings _jsonSettings; private IOperationSystemManager _osManager; private IPPCApplicationManager _appManager; + private bool _drawCursor; + private bool _isMouseDown; + private bool _ensureMouseDown; /// /// Gets or sets a value indicating whether this is enabled. @@ -137,6 +141,17 @@ namespace Tango.PPC.Common.RemoteDesktop //} } + mainWindow.PreviewMouseDown += (_, __) => + { + _isMouseDown = true; + _ensureMouseDown = true; + }; + + mainWindow.PreviewMouseUp += (_, __) => + { + _isMouseDown = false; + }; + _engine.Comparer.MaxDifferencesThrow = _engine.CaptureRegion.Width * _engine.CaptureRegion.Height / 2; } @@ -300,6 +315,10 @@ namespace Tango.PPC.Common.RemoteDesktop { MouseController.DoubleClick(); } + else if (request.EventType == MouseEventType.Scroll) + { + MouseController.Scroll(request.ScrollDelta); + } if (receiver != null) { @@ -339,8 +358,21 @@ namespace Tango.PPC.Common.RemoteDesktop await receiver.SendGenericResponse(new RemoteDesktopCommandResponse(), token); } + [ExternalBridgeRequestHandlerMethod(typeof(SetCursorVisibilityRequest), RequestHandlerLoggingMode.LogRequestName)] + public async Task OnSetCursorVisibilityRequest(SetCursorVisibilityRequest request, String token, ExternalBridgeReceiver receiver) + { + _drawCursor = request.Visible; + await receiver.SendGenericResponse(new SetCursorVisibilityResponse(), token); + } + private async void _engine_FrameReceived(object sender, ScreenCaptureFrameReceivedEventArgs e) { + if (_drawCursor) + { + e.Frame.DrawImage((_isMouseDown || _ensureMouseDown) ? Properties.Resources.tap : Properties.Resources.finger3, new System.Drawing.Point(System.Windows.Forms.Cursor.Position.X - 5, System.Windows.Forms.Cursor.Position.Y - 4)); + _ensureMouseDown = false; + } + _initialPacket = new RemoteDesktopPacket() { Bitmap = e.Frame.ToEncoder().ToArray(), @@ -396,11 +428,15 @@ namespace Tango.PPC.Common.RemoteDesktop { RemoteDesktopPacket packet = null; + Point mousePosition = new Point(System.Windows.Forms.Cursor.Position.X, System.Windows.Forms.Cursor.Position.Y); + if (!e.Frame.DifferenceAvailable) { packet = new RemoteDesktopPacket() { - Bitmap = e.Frame.ToEncoder().ToArray(30) + Bitmap = e.Frame.ToEncoder().ToArray(30), + MousePosition = mousePosition, + CursorVisible = _drawCursor }; } else @@ -413,6 +449,8 @@ namespace Tango.PPC.Common.RemoteDesktop Bitmap = diffFrame.ToEncoder().ToArray(), IsPartial = true, PartialRegion = new CaptureRegion(diffFrame.Left, diffFrame.Top, diffFrame.Width, diffFrame.Height), + MousePosition = mousePosition, + CursorVisible = _drawCursor }; diffFrame.Dispose(); diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Resources/finger3.png b/Software/Visual_Studio/PPC/Tango.PPC.Common/Resources/finger3.png new file mode 100644 index 000000000..c0a6ce9cd Binary files /dev/null and b/Software/Visual_Studio/PPC/Tango.PPC.Common/Resources/finger3.png differ diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Resources/tap.png b/Software/Visual_Studio/PPC/Tango.PPC.Common/Resources/tap.png new file mode 100644 index 000000000..4fa679b81 Binary files /dev/null and b/Software/Visual_Studio/PPC/Tango.PPC.Common/Resources/tap.png differ diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj b/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj index 47b5e310b..6fc24e22a 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj @@ -458,6 +458,12 @@ + + + + + + @@ -468,7 +474,7 @@ - + \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest b/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest index d72e75011..efc5f8179 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest @@ -16,7 +16,7 @@ Remove this element if your application requires this virtualization for backwards compatibility. --> - + diff --git a/Software/Visual_Studio/Tango.RemoteDesktop/Frames/RasterFrame.cs b/Software/Visual_Studio/Tango.RemoteDesktop/Frames/RasterFrame.cs index bcb372bd3..a9cbea6f2 100644 --- a/Software/Visual_Studio/Tango.RemoteDesktop/Frames/RasterFrame.cs +++ b/Software/Visual_Studio/Tango.RemoteDesktop/Frames/RasterFrame.cs @@ -109,6 +109,18 @@ namespace Tango.RemoteDesktop.Frames } } + /// + /// Draws the specified image on to this frame. + /// + /// The bitmap. + public virtual void DrawImage(Bitmap bitmap, Point position) + { + using (Graphics g = Graphics.FromImage(_bitmap)) + { + g.DrawImage(bitmap, new Rectangle(position, bitmap.Size)); + } + } + /// /// Optimizes the bounds of this frame by removing unnecessary margins. /// diff --git a/Software/Visual_Studio/Tango.RemoteDesktop/Input/MouseController.cs b/Software/Visual_Studio/Tango.RemoteDesktop/Input/MouseController.cs index ce3a3eb09..295aca4b1 100644 --- a/Software/Visual_Studio/Tango.RemoteDesktop/Input/MouseController.cs +++ b/Software/Visual_Studio/Tango.RemoteDesktop/Input/MouseController.cs @@ -77,6 +77,11 @@ namespace Tango.RemoteDesktop.Input simulator.Mouse.LeftButtonDoubleClick(); } + public static void Scroll(int delta) + { + simulator.Mouse.VerticalScroll(delta); + } + [StructLayout(LayoutKind.Sequential)] public struct MousePoint { diff --git a/Software/Visual_Studio/Tango.RemoteDesktop/Network/MouseEventType.cs b/Software/Visual_Studio/Tango.RemoteDesktop/Network/MouseEventType.cs index 2c9f84e03..ca8945dda 100644 --- a/Software/Visual_Studio/Tango.RemoteDesktop/Network/MouseEventType.cs +++ b/Software/Visual_Studio/Tango.RemoteDesktop/Network/MouseEventType.cs @@ -11,6 +11,7 @@ namespace Tango.RemoteDesktop.Network Down, Up, Move, - DoubleClick + DoubleClick, + Scroll, } } diff --git a/Software/Visual_Studio/Tango.RemoteDesktop/Network/MouseStateRequest.cs b/Software/Visual_Studio/Tango.RemoteDesktop/Network/MouseStateRequest.cs index 36e98351f..67076c211 100644 --- a/Software/Visual_Studio/Tango.RemoteDesktop/Network/MouseStateRequest.cs +++ b/Software/Visual_Studio/Tango.RemoteDesktop/Network/MouseStateRequest.cs @@ -13,5 +13,6 @@ namespace Tango.RemoteDesktop.Network public MouseButton Button { get; set; } public MouseEventType EventType { get; set; } public Point Location { get; set; } + public int ScrollDelta { get; set; } } } diff --git a/Software/Visual_Studio/Tango.RemoteDesktop/Network/RemoteDesktopPacket.cs b/Software/Visual_Studio/Tango.RemoteDesktop/Network/RemoteDesktopPacket.cs index 28f890a9a..f0186e94f 100644 --- a/Software/Visual_Studio/Tango.RemoteDesktop/Network/RemoteDesktopPacket.cs +++ b/Software/Visual_Studio/Tango.RemoteDesktop/Network/RemoteDesktopPacket.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Windows; namespace Tango.RemoteDesktop.Network { @@ -22,5 +23,15 @@ namespace Tango.RemoteDesktop.Network /// Gets or sets the region on the previous bitmap that needs to be applied with this packet bitmap. /// public CaptureRegion PartialRegion { get; set; } + + /// + /// Gets or sets the mouse position. + /// + public Point MousePosition { get; set; } + + /// + /// Gets or sets a value indicating whether the frame includes the remote cursor. + /// + public bool CursorVisible { get; set; } } } diff --git a/Software/Visual_Studio/Tango.RemoteDesktop/Network/SetCursorVisibilityRequest.cs b/Software/Visual_Studio/Tango.RemoteDesktop/Network/SetCursorVisibilityRequest.cs new file mode 100644 index 000000000..f8b832f36 --- /dev/null +++ b/Software/Visual_Studio/Tango.RemoteDesktop/Network/SetCursorVisibilityRequest.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.RemoteDesktop.Network +{ + public class SetCursorVisibilityRequest + { + public bool Visible { get; set; } + } +} diff --git a/Software/Visual_Studio/Tango.RemoteDesktop/Network/SetCursorVisibilityResponse.cs b/Software/Visual_Studio/Tango.RemoteDesktop/Network/SetCursorVisibilityResponse.cs new file mode 100644 index 000000000..d333cb134 --- /dev/null +++ b/Software/Visual_Studio/Tango.RemoteDesktop/Network/SetCursorVisibilityResponse.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.RemoteDesktop.Network +{ + public class SetCursorVisibilityResponse + { + + } +} diff --git a/Software/Visual_Studio/Tango.RemoteDesktop/Tango.RemoteDesktop.csproj b/Software/Visual_Studio/Tango.RemoteDesktop/Tango.RemoteDesktop.csproj index 25c1d265c..4b2c95501 100644 --- a/Software/Visual_Studio/Tango.RemoteDesktop/Tango.RemoteDesktop.csproj +++ b/Software/Visual_Studio/Tango.RemoteDesktop/Tango.RemoteDesktop.csproj @@ -100,6 +100,8 @@ + + diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchNotificationBar.cs b/Software/Visual_Studio/Tango.Touch/Controls/TouchNotificationBar.cs index ccd27333a..d7f79cb8d 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchNotificationBar.cs +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchNotificationBar.cs @@ -165,7 +165,12 @@ namespace Tango.Touch.Controls { element.RegisterForLoadedOrNow((x, y) => { - CurrentMinHeight = element.FindChild().MinHeight; + var userControl = element.FindChild(); + + if (userControl != null) + { + CurrentMinHeight = userControl.MinHeight; + } }); } } -- cgit v1.3.1