diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2020-06-01 02:06:40 +0300 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2020-06-01 02:06:40 +0300 |
| commit | aff00af76242117e3991b0ee526df905a63debce (patch) | |
| tree | 96bc51983c314a6c08cc7f804c599a28f23efd8a | |
| parent | 862ee0839083ca350125d48841ce7427d5a578d9 (diff) | |
| download | Tango-aff00af76242117e3991b0ee526df905a63debce.tar.gz Tango-aff00af76242117e3991b0ee526df905a63debce.zip | |
Remote Cursor.
Cursor Visibility.
Mouse Scroll.
PPC notification bar workaround.
25 files changed, 323 insertions, 47 deletions
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 @@ <Grid HorizontalAlignment="Right" VerticalAlignment="Top"> <StackPanel Margin="0 5 27 0" Orientation="Horizontal"> - <controls:IconButton Cursor="Hand" ToolTip="Take snapshot" x:Name="btnSnapshot" Click="BtnSnapshot_Click" Command="{Binding TakeSnapshotCommand}" IsEnabled="{Binding RemoteDesktopProvider.InSession}" Icon="ImagePlus" Width="24" Height="24" Padding="0" /> - <material:PackIcon Margin="2 0 0 0" ToolTip="Active communication channel is active" Visibility="{Binding RemoteDesktopProvider.IsWebRtcActive,Converter={StaticResource BooleanToVisibilityConverter}}" VerticalAlignment="Center" Kind="LightningBoltCircle" Width="16" Height="16" Foreground="{StaticResource FSE_GreenBrush}" /> + <controls:ToggleIconButton IsChecked="{Binding CursorVisible}" UncheckedIcon="CursorDefault" CheckedIcon="CursorDefault" UncheckedForeground="{StaticResource FSE_GrayBrush}" CheckedForeground="{StaticResource FSE_GreenBrush}" Cursor="Hand" ToolTip="Display remote cursor" IsEnabled="{Binding RemoteDesktopProvider.InSession}" Width="16" Height="16" Padding="0" /> + <controls:IconButton Margin="7 0 0 0" Cursor="Hand" ToolTip="Take snapshot" x:Name="btnSnapshot" Click="BtnSnapshot_Click" Command="{Binding TakeSnapshotCommand}" IsEnabled="{Binding RemoteDesktopProvider.InSession}" Icon="ImagePlus" Width="24" Height="24" Padding="0" /> <controls:IconButton Margin="5 0 0 0" Cursor="Hand" ToolTip="Open in separate window" Icon="OpenInNew" Width="24" Height="24" Padding="0" Command="{Binding WindowsManager.DetachToWindowCommand}" CommandParameter="{Binding ElementName=remoteDesktopControl}" Visibility="{Binding ElementName=remoteDesktopControl,Path=(win:WindowsManagerHelper.IsDetached),Converter={StaticResource BooleanToVisibilityInverseConverter}}" /> </StackPanel> </Grid> 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 @@ -16,6 +16,16 @@ namespace Tango.FSE.Common.RemoteDesktop public interface IRemoteDesktopProvider { /// <summary> + /// Occurs when a remote desktop session has started. + /// </summary> + event EventHandler SessionStarted; + + /// <summary> + /// Occurs when a remote desktop session has stopped. + /// </summary> + event EventHandler SessionStopped; + + /// <summary> /// Occurs when a new remote desktop screen frame is available. /// </summary> event EventHandler<DesktopFrameReceivedEventArgs> FrameReceived; @@ -110,6 +120,14 @@ namespace Tango.FSE.Common.RemoteDesktop void MouseDoubleClick(MouseButton button, Point location, Size viewSize); /// <summary> + /// Send a mouse scroll command to the remote PPC. + /// </summary> + /// <param name="delta">The delta.</param> + /// <param name="location">The location.</param> + /// <param name="viewSize">Size of the view.</param> + void MouseScroll(int delta, Point location, Size viewSize); + + /// <summary> /// Sends a key down command to the remote PPC. /// </summary> /// <param name="key">The key.</param> @@ -132,5 +150,11 @@ namespace Tango.FSE.Common.RemoteDesktop /// </summary> /// <param name="command">The command.</param> void SendCommand(RemoteDesktopCommand command); + + /// <summary> + /// Sets the remote cursor visibility. + /// </summary> + /// <param name="visible">if set to <c>true</c> [visible].</param> + 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 @@ // </auto-generated> //------------------------------------------------------------------------------ -namespace Tango.FSE.UI.Properties -{ - - +namespace Tango.FSE.UI.Properties { + using System; + + /// <summary> /// A strongly-typed resource class, for looking up localized strings, etc. /// </summary> @@ -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() { } - + /// <summary> /// Returns the cached ResourceManager instance used by this class. /// </summary> [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; } } - + /// <summary> /// Overrides the current thread's CurrentUICulture property for all /// resource lookups using this strongly typed resource class. /// </summary> [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. --> <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> <xsd:element name="root" msdata:IsDataSet="true"> <xsd:complexType> <xsd:choice maxOccurs="unbounded"> @@ -68,9 +69,10 @@ <xsd:sequence> <xsd:element name="value" type="xsd:string" minOccurs="0" /> </xsd:sequence> - <xsd:attribute name="name" type="xsd:string" /> + <xsd:attribute name="name" use="required" type="xsd:string" /> <xsd:attribute name="type" type="xsd:string" /> <xsd:attribute name="mimetype" type="xsd:string" /> + <xsd:attribute ref="xml:space" /> </xsd:complexType> </xsd:element> <xsd:element name="assembly"> @@ -85,9 +87,10 @@ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> </xsd:sequence> - <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" /> + <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + <xsd:attribute ref="xml:space" /> </xsd:complexType> </xsd:element> <xsd:element name="resheader"> @@ -109,9 +112,9 @@ <value>2.0</value> </resheader> <resheader name="reader"> - <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> <resheader name="writer"> - <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> </root>
\ 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<IceCandidate> _iceCandidates; private bool _answerReceived; private JsonSerializerSettings _jsonSettings; + private bool _cursorVisible; [TangoInject] private INotificationProvider NotificationProvider { get; set; } @@ -62,6 +63,16 @@ namespace Tango.FSE.UI.RemoteDesktop #region Events /// <summary> + /// Occurs when a remote desktop session has started. + /// </summary> + public event EventHandler SessionStarted; + + /// <summary> + /// Occurs when a remote desktop session has stopped. + /// </summary> + public event EventHandler SessionStopped; + + /// <summary> /// Occurs when a new remote desktop screen frame is available. /// </summary> public event EventHandler<DesktopFrameReceivedEventArgs> FrameReceived; @@ -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()); + } + } + } } /// <summary> @@ -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) @@ -589,6 +621,60 @@ namespace Tango.FSE.UI.RemoteDesktop } /// <summary> + /// Send a mouse scroll command to the remote PPC. + /// </summary> + /// <param name="delta">The delta.</param> + /// <param name="location">The location.</param> + /// <param name="viewSize">Size of the view.</param> + 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<MouseStateRequest, MouseStateResponse>(request); + } + } + catch (Exception ex) + { + LogManager.Log(ex, "Error sending remote desktop mouse scroll command."); + } + } + + /// <summary> + /// Sets the remote cursor visibility. + /// </summary> + /// <param name="visible">if set to <c>true</c> [visible].</param> + public async void SetRemoteCursorVisibility(bool visible) + { + try + { + var request = new SetCursorVisibilityRequest() { Visible = visible }; + await _machineProvider.MachineOperator.SendGenericRequest<SetCursorVisibilityRequest, SetCursorVisibilityResponse>(request); + _cursorVisible = visible; + } + catch (Exception ex) + { + LogManager.Log(ex, "Error sending remote desktop mouse visibility command."); + } + } + + /// <summary> /// Translates the location. /// </summary> /// <param name="location">The location.</param> 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; } } + + /// <summary> + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// </summary> + internal static System.Drawing.Bitmap finger3 { + get { + object obj = ResourceManager.GetObject("finger3", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// <summary> + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// </summary> + 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. --> <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> <xsd:element name="root" msdata:IsDataSet="true"> <xsd:complexType> <xsd:choice maxOccurs="unbounded"> @@ -68,9 +69,10 @@ <xsd:sequence> <xsd:element name="value" type="xsd:string" minOccurs="0" /> </xsd:sequence> - <xsd:attribute name="name" type="xsd:string" /> + <xsd:attribute name="name" use="required" type="xsd:string" /> <xsd:attribute name="type" type="xsd:string" /> <xsd:attribute name="mimetype" type="xsd:string" /> + <xsd:attribute ref="xml:space" /> </xsd:complexType> </xsd:element> <xsd:element name="assembly"> @@ -85,9 +87,10 @@ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> </xsd:sequence> - <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" /> + <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + <xsd:attribute ref="xml:space" /> </xsd:complexType> </xsd:element> <xsd:element name="resheader"> @@ -109,9 +112,16 @@ <value>2.0</value> </resheader> <resheader name="reader"> - <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> <resheader name="writer"> - <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> + <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> + <data name="finger3" type="System.Resources.ResXFileRef, System.Windows.Forms"> + <value>..\Resources\finger3.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> + </data> + <data name="tap" type="System.Resources.ResXFileRef, System.Windows.Forms"> + <value>..\Resources\tap.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> + </data> </root>
\ 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; /// <summary> /// Gets or sets a value indicating whether this <see cref="IPPCService" /> 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<RasterFrame> 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<PngEncoder>().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<TurboJpegEncoder>().ToArray(30) + Bitmap = e.Frame.ToEncoder<TurboJpegEncoder>().ToArray(30), + MousePosition = mousePosition, + CursorVisible = _drawCursor }; } else @@ -413,6 +449,8 @@ namespace Tango.PPC.Common.RemoteDesktop Bitmap = diffFrame.ToEncoder<PngEncoder>().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 Binary files differnew file mode 100644 index 000000000..c0a6ce9cd --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Resources/finger3.png diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Resources/tap.png b/Software/Visual_Studio/PPC/Tango.PPC.Common/Resources/tap.png Binary files differnew file mode 100644 index 000000000..4fa679b81 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Resources/tap.png 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 @@ <ItemGroup> <Folder Include="Scripting\" /> </ItemGroup> + <ItemGroup> + <None Include="Resources\finger3.png" /> + </ItemGroup> + <ItemGroup> + <None Include="Resources\tap.png" /> + </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="..\..\packages\System.Data.SQLite.Core.1.0.108.0\build\net46\System.Data.SQLite.Core.targets" Condition="Exists('..\..\packages\System.Data.SQLite.Core.1.0.108.0\build\net46\System.Data.SQLite.Core.targets')" /> <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> @@ -468,7 +474,7 @@ </Target> <ProjectExtensions> <VisualStudio> - <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" /> + <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" /> </VisualStudio> </ProjectExtensions> </Project>
\ 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. --> - <requestedExecutionLevel level="requireAdministrator" uiAccess="false" /> + <!--<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />--> </requestedPrivileges> </security> </trustInfo> 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 @@ -110,6 +110,18 @@ namespace Tango.RemoteDesktop.Frames } /// <summary> + /// Draws the specified image on to this frame. + /// </summary> + /// <param name="bitmap">The bitmap.</param> + public virtual void DrawImage(Bitmap bitmap, Point position) + { + using (Graphics g = Graphics.FromImage(_bitmap)) + { + g.DrawImage(bitmap, new Rectangle(position, bitmap.Size)); + } + } + + /// <summary> /// Optimizes the bounds of this frame by removing unnecessary margins. /// </summary> /// <returns></returns> 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. /// </summary> public CaptureRegion PartialRegion { get; set; } + + /// <summary> + /// Gets or sets the mouse position. + /// </summary> + public Point MousePosition { get; set; } + + /// <summary> + /// Gets or sets a value indicating whether the frame includes the remote cursor. + /// </summary> + 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 @@ <Compile Include="Network\RemoteDesktopCommandRequest.cs" /> <Compile Include="Network\RemoteDesktopPacket.cs" /> <Compile Include="Network\RemoteDesktopCommandResponse.cs" /> + <Compile Include="Network\SetCursorVisibilityRequest.cs" /> + <Compile Include="Network\SetCursorVisibilityResponse.cs" /> <Compile Include="Network\StartRemoteDesktopSessionRequest.cs" /> <Compile Include="Network\StartRemoteDesktopSessionResponse.cs" /> <Compile Include="Network\StopRemoteDesktopSessionRequest.cs" /> 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<UserControl>().MinHeight; + var userControl = element.FindChild<UserControl>(); + + if (userControl != null) + { + CurrentMinHeight = userControl.MinHeight; + } }); } } |
