From efde98a69746f41c1055858142b1935955d82fb0 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Mon, 24 Feb 2020 16:51:04 +0200 Subject: Implemented job runs reset on factory restore. --- .../MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI') 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 7e47097ca..275db58c9 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.0.0")] +[assembly: AssemblyVersion("4.1.1.0")] [assembly: ComVisible(false)] \ No newline at end of file -- cgit v1.3.1 From 1d2a8fcc28a69b87f8deb3f08323c9a80e3631e2 Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Tue, 25 Feb 2020 12:15:30 +0200 Subject: Fixed issue with current module image when starting machine studio and multiple modules opened. --- .../Tango.MachineStudio.UI/ViewModels/MainViewVM.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI') diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs index 4d37321dd..46491c823 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs @@ -737,7 +737,7 @@ namespace Tango.MachineStudio.UI.ViewModels /// Opens the module in a new window. /// /// The module. - private async void OpenModuleInWindow(IStudioModule module, Rect? bounds = null, WindowState? state = null) + private async void OpenModuleInWindow(IStudioModule module, Rect? bounds = null, WindowState? state = null, bool setHomeModule = true) { if (module == null) return; @@ -745,7 +745,10 @@ namespace Tango.MachineStudio.UI.ViewModels { module.InNewWindow = true; - StartModule(null); + if (setHomeModule) + { + StartModule(null); + } await Task.Delay(1000); @@ -943,7 +946,7 @@ namespace Tango.MachineStudio.UI.ViewModels if (module != null && !module.InNewWindow) { - OpenModuleInWindow(module, item.Bounds, item.State); + OpenModuleInWindow(module, item.Bounds, item.State, false); } } -- cgit v1.3.1 From c38f1c80f1fbdfdb758c5a0b93d045a9a5b526ad Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Tue, 3 Mar 2020 18:56:58 +0200 Subject: Machine Studio v4.1.2 PPC v1.1.5 Added BYPASS_ROCKERS to SQLExaminer config. Started integrating FSE Remote/Console To PPC. Added support for generic continuous request. --- .../Tango.RemoteDesktop/Clipping/BitmapCliper.cs | 82 +++++++-- .../Tango.RemoteDesktop/Tango.RemoteDesktop.csproj | 8 +- .../Tango.RemoteDesktop/WpfApp1/MainWindow.xaml.cs | 3 +- .../Machine Studio Installer.aip | 6 +- .../PPC Installer-cache/cacheIndex.txt | Bin 52 -> 52 bytes .../Advanced Installer Projects/PPC Installer.aip | 10 +- .../Tango.FSE.PPCConsole.csproj | 29 ++- .../ViewModels/RemoteDesktopViewVM.cs | 96 ++++++++++ .../Tango.FSE.PPCConsole/Views/ConsoleView.xaml | 4 +- .../Views/RemoteDesktopView.xaml | 46 +++-- .../FSE/Modules/Tango.FSE.PPCConsole/app.config | 4 + .../Modules/Tango.FSE.PPCConsole/packages.config | 6 + .../Connection/IMachineProvider.cs | 10 ++ .../Connection/MachineConnectedEventArgs.cs | 14 ++ .../Connection/MachineDisconnectedEventArgs.cs | 15 ++ .../FSE/Tango.FSE.Common/Tango.FSE.Common.csproj | 2 + Software/Visual_Studio/FSE/Tango.FSE.UI/App.config | 4 + .../Connection/DefaultMachineProvider.cs | 33 ++++ .../FSE/Tango.FSE.UI/Views/LayoutView.xaml | 23 ++- .../Views/JobView.xaml | 2 +- .../Properties/AssemblyInfo.cs | 2 +- .../Console/DefaultConsoleEngineService.cs | 5 + .../PPC/Tango.PPC.Common/PPCSettings.cs | 12 ++ .../RemoteDesktop/DefaultRemoteDesktopService.cs | 198 +++++++++++++++++++++ .../RemoteDesktop/IRemoteDesktopService.cs | 15 ++ .../PPC/Tango.PPC.Common/Tango.PPC.Common.csproj | 6 + .../PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs | 2 +- .../PPC/Tango.PPC.UI/ViewModelLocator.cs | 3 + .../Visual_Studio/Tango.Core/Tango.Core.csproj | 3 +- .../Tango.Core/Threading/SequencerThread.cs | 71 ++++++++ .../ExternalBridge/ExternalBridgeService.cs | 10 ++ .../IExternalBridgeRequestHandler.cs | 2 +- .../Tango.RemoteDesktop/Clipping/BitmapCliper.cs | 20 +-- .../Visual_Studio/Tango.RemoteDesktop/Frame.cs | 10 ++ .../Network/RemoteDesktopPacket.cs | 26 +++ .../Network/StartRemoteDesktopSessionRequest.cs | 16 ++ .../Network/StartRemoteDesktopSessionResponse.cs | 25 +++ .../Tango.RemoteDesktop/ScreenCaptureEngine.cs | 43 +++-- .../Tango.RemoteDesktop/Tango.RemoteDesktop.csproj | 3 + .../SQLExaminer/Configurations/OverrideData.xml | Bin 83900 -> 83988 bytes .../Visual_Studio/Tango.Transport/ITransporter.cs | 9 + .../Tango.Transport/TransporterBase.cs | 55 ++++++ 42 files changed, 848 insertions(+), 85 deletions(-) create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.Common/Connection/MachineConnectedEventArgs.cs create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.Common/Connection/MachineDisconnectedEventArgs.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Common/RemoteDesktop/DefaultRemoteDesktopService.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Common/RemoteDesktop/IRemoteDesktopService.cs create mode 100644 Software/Visual_Studio/Tango.Core/Threading/SequencerThread.cs create mode 100644 Software/Visual_Studio/Tango.RemoteDesktop/Network/RemoteDesktopPacket.cs create mode 100644 Software/Visual_Studio/Tango.RemoteDesktop/Network/StartRemoteDesktopSessionRequest.cs create mode 100644 Software/Visual_Studio/Tango.RemoteDesktop/Network/StartRemoteDesktopSessionResponse.cs (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI') diff --git a/Software/Experiments/Tango.RemoteDesktop/Tango.RemoteDesktop/Clipping/BitmapCliper.cs b/Software/Experiments/Tango.RemoteDesktop/Tango.RemoteDesktop/Clipping/BitmapCliper.cs index 4f93eeb66..5bd8beaa3 100644 --- a/Software/Experiments/Tango.RemoteDesktop/Tango.RemoteDesktop/Clipping/BitmapCliper.cs +++ b/Software/Experiments/Tango.RemoteDesktop/Tango.RemoteDesktop/Clipping/BitmapCliper.cs @@ -30,8 +30,8 @@ namespace Tango.RemoteDesktop.Clipping //determine top for (int i = 0; i < rgbValues.Length; i++) { - int color = rgbValues[i] & 0x00ffffff; - if (color != 0x00ffffff) + int color = rgbValues[i] & 0xffffff; + if (color != 0x0) { int r = i / bd.Width; int c = i % bd.Width; @@ -53,8 +53,8 @@ namespace Tango.RemoteDesktop.Clipping //determine bottom for (int i = rgbValues.Length - 1; i >= 0; i--) { - int color = rgbValues[i] & 0x00ffffff; - if (color != 0x00ffffff) + int color = rgbValues[i] & 0xffffff; + if (color != 0x0) { int r = i / bd.Width; int c = i % bd.Width; @@ -79,8 +79,8 @@ namespace Tango.RemoteDesktop.Clipping //determine left for (int c = 0; c < left; c++) { - int color = rgbValues[r * bd.Width + c] & 0x00ffffff; - if (color != 0x00ffffff) + int color = rgbValues[r * bd.Width + c] & 0xffffff; + if (color != 0x0) { if (left > c) { @@ -93,8 +93,8 @@ namespace Tango.RemoteDesktop.Clipping //determine right for (int c = bd.Width - 1; c > right; c--) { - int color = rgbValues[r * bd.Width + c] & 0x00ffffff; - if (color != 0x00ffffff) + int color = rgbValues[r * bd.Width + c] & 0xffffff; + if (color != 0x0) { if (right < c) { @@ -128,9 +128,7 @@ namespace Tango.RemoteDesktop.Clipping //create new image Bitmap newImage = new Bitmap(width, height, PixelFormat.Format32bppArgb); - BitmapData nbd - = newImage.LockBits(new Rectangle(0, 0, width, height), - ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb); + BitmapData nbd = newImage.LockBits(new Rectangle(0, 0, width, height), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb); Marshal.Copy(imgData, 0, nbd.Scan0, imgData.Length); newImage.UnlockBits(nbd); @@ -140,5 +138,67 @@ namespace Tango.RemoteDesktop.Clipping Bounds = new Rectangle(left, top, width, height) }; } + + public static ClipResult ClipBitmap2(Bitmap bmp) + { + // Initialize variables + //var cropColor = Color.White; + + var bottom = 0; + var left = bmp.Width; // Set the left crop point to the width so that the logic below will set the left value to the first non crop color pixel it comes across. + var right = 0; + var top = bmp.Height; // Set the top crop point to the height so that the logic below will set the top value to the first non crop color pixel it comes across. + + var bmpData = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadOnly, bmp.PixelFormat); + + unsafe + { + var dataPtr = (byte*)bmpData.Scan0; + + for (var y = 0; y < bmp.Height; y++) + { + for (var x = 0; x < bmp.Width; x++) + { + var rgbPtr = dataPtr + (x * 4); + + //var b = rgbPtr[0]; + //var g = rgbPtr[1]; + //var r = rgbPtr[2]; + var a = rgbPtr[3]; + + // If any of the pixel RGBA values don't match and the crop color is not transparent, or if the crop color is transparent and the pixel A value is not transparent + if (a > 0) + { + if (x < left) + left = x; + + if (x >= right) + right = x + 1; + + if (y < top) + top = y; + + if (y >= bottom) + bottom = y + 1; + } + } + + dataPtr += bmpData.Stride; + } + } + + bmp.UnlockBits(bmpData); + + if (left < right && top < bottom) + { + return new ClipResult() + { + Bitmap = bmp.Clone(new Rectangle(left, top, right - left, bottom - top), bmp.PixelFormat), + Bounds = new Rectangle(left, top, right - left, bottom - top), + }; + } + + return null; // Entire image should be cropped, so just return null + } } } diff --git a/Software/Experiments/Tango.RemoteDesktop/Tango.RemoteDesktop/Tango.RemoteDesktop.csproj b/Software/Experiments/Tango.RemoteDesktop/Tango.RemoteDesktop/Tango.RemoteDesktop.csproj index f760b43dc..de790ca10 100644 --- a/Software/Experiments/Tango.RemoteDesktop/Tango.RemoteDesktop/Tango.RemoteDesktop.csproj +++ b/Software/Experiments/Tango.RemoteDesktop/Tango.RemoteDesktop/Tango.RemoteDesktop.csproj @@ -35,16 +35,16 @@ - ..\..\..\..\..\..\DATA\Development\WpfVideoTools\WpfVideoTools\Resources\Referenced Assemblies\SharpDX.dll + ..\..\..\Visual_Studio\Referenced Assemblies\SharpDX\SharpDX.dll - ..\..\..\..\..\..\DATA\Development\WpfVideoTools\WpfVideoTools\Resources\Referenced Assemblies\SharpDX.Direct3D11.dll + ..\..\..\Visual_Studio\Referenced Assemblies\SharpDX\SharpDX.Direct3D11.dll - ..\..\..\..\..\..\DATA\Development\WpfVideoTools\WpfVideoTools\Resources\Referenced Assemblies\SharpDX.DXGI.dll + ..\..\..\Visual_Studio\Referenced Assemblies\SharpDX\SharpDX.DXGI.dll - ..\..\..\..\..\..\DATA\Development\WpfVideoTools\WpfVideoTools\Resources\Referenced Assemblies\SharpDX.Mathematics.dll + ..\..\..\Visual_Studio\Referenced Assemblies\SharpDX\SharpDX.Mathematics.dll diff --git a/Software/Experiments/Tango.RemoteDesktop/WpfApp1/MainWindow.xaml.cs b/Software/Experiments/Tango.RemoteDesktop/WpfApp1/MainWindow.xaml.cs index 6bd0b7a23..7953e9666 100644 --- a/Software/Experiments/Tango.RemoteDesktop/WpfApp1/MainWindow.xaml.cs +++ b/Software/Experiments/Tango.RemoteDesktop/WpfApp1/MainWindow.xaml.cs @@ -40,8 +40,9 @@ namespace WpfApp1 _engine = new RasterScreenCaptureEngine() { - CaptureRegion = new CaptureRegion(0, 0, 1280, 800) + CaptureRegion = new CaptureRegion(1920 + 1920, 0, 1280, 800) }; + _engine.CaptureMethod = new GdiScreenCapture(); _engine.FrameRate = 5; //Per second _engine.CaptureCursor = true; _engine.FrameReceived += _engine_FrameReceived; 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 7a98315e6..a1d8353fe 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 @@ - + - + @@ -810,7 +810,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 a603ff06b..993ced97e 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 bae639a22..e3bea2a1b 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 @@ - + - + @@ -142,6 +142,7 @@ + @@ -406,6 +407,8 @@ + + @@ -415,7 +418,7 @@ - + @@ -656,6 +659,7 @@ + diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.PPCConsole/Tango.FSE.PPCConsole.csproj b/Software/Visual_Studio/FSE/Modules/Tango.FSE.PPCConsole/Tango.FSE.PPCConsole.csproj index bcb1242a3..75cae76a9 100644 --- a/Software/Visual_Studio/FSE/Modules/Tango.FSE.PPCConsole/Tango.FSE.PPCConsole.csproj +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.PPCConsole/Tango.FSE.PPCConsole.csproj @@ -61,6 +61,23 @@ + + + ..\..\..\packages\System.Reactive.Core.3.1.1\lib\net46\System.Reactive.Core.dll + + + ..\..\..\packages\System.Reactive.Interfaces.3.1.1\lib\net45\System.Reactive.Interfaces.dll + + + ..\..\..\packages\System.Reactive.Linq.3.1.1\lib\net46\System.Reactive.Linq.dll + + + ..\..\..\packages\System.Reactive.PlatformServices.3.1.1\lib\net46\System.Reactive.PlatformServices.dll + + + ..\..\..\packages\System.Reactive.Windows.Threading.3.1.1\lib\net45\System.Reactive.Windows.Threading.dll + + ..\..\..\packages\ControlzEx.3.0.2.4\lib\net45\System.Windows.Interactivity.dll @@ -111,8 +128,12 @@ ResXFileCodeGenerator Resources.Designer.cs - - + + Designer + + + Designer + SettingsSingleFileGenerator Settings.Designer.cs @@ -147,6 +168,10 @@ {e4927038-348d-4295-aaf4-861c58cb3943} Tango.PMR + + {a78068d4-2061-4376-8ede-583d8d880dec} + Tango.RemoteDesktop + {d8f1ad85-526a-4f50-b6dc-d437af63d8d8} Tango.Settings 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 32a85ada6..eb5d57447 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 @@ -1,13 +1,109 @@ using System; using System.Collections.Generic; +using System.Diagnostics; +using System.Drawing; +using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Windows.Media.Imaging; +using Tango.Core.Commands; +using Tango.Core.Threading; using Tango.FSE.Common; +using Tango.RemoteDesktop.Frames; +using Tango.RemoteDesktop.Network; namespace Tango.FSE.PPCConsole.ViewModels { public class RemoteDesktopViewVM : FSEViewModel { + private RasterFrame _currentFrame; + + private BitmapSource _source; + public BitmapSource Source + { + get { return _source; } + set { _source = value; RaisePropertyChangedAuto(); } + } + + public RelayCommand StartCommand { get; set; } + public RelayCommand StopCommand { get; set; } + + public RemoteDesktopViewVM() + { + StartCommand = new RelayCommand(StartRemoteDesktop, () => MachineProvider.IsConnected); + StopCommand = new RelayCommand(StopRemoteDesktop); + } + + public override void OnApplicationStarted() + { + base.OnApplicationStarted(); + + MachineProvider.MachineConnected += (_, __) => InvalidateRelayCommands(); + MachineProvider.MachineDisconnected += (_, __) => InvalidateRelayCommands(); + } + + private void StartRemoteDesktop() + { + SequencerThread sequencer = null; + sequencer = new SequencerThread((response) => + { + if (response.Packet == null) + { + sequencer.FrameRate = 1000 / response.FrameRate; + return; //Returned just to notice that there was no timeout.. + } + + try + { + if (!response.Packet.IsPartial) + { + using (MemoryStream ms = new MemoryStream(response.Packet.Bitmap)) + { + if (_currentFrame != null) + { + _currentFrame.Dispose(); + } + + _currentFrame = new RasterFrame(new Bitmap(ms)); + } + } + else + { + using (MemoryStream ms = new MemoryStream(response.Packet.Bitmap)) + { + var diffFrame = new RasterFrame(new Bitmap(ms), response.Packet.PartialRegion.Left, response.Packet.PartialRegion.Top); + diffFrame.Apply(_currentFrame); + diffFrame.Dispose(); + } + } + + Source = _currentFrame.ToBitmapSource(); + } + catch (Exception ex) + { + Debug.WriteLine($"Error on remote desktop packet received: {ex.Message}"); + } + }); + + sequencer.Start(); + + MachineProvider.MachineOperator.SendGenericContinuousRequest(new StartRemoteDesktopSessionRequest() { }, new Transport.TransportContinuousRequestConfig() + { + ContinuousTimeout = TimeSpan.FromSeconds(30), + }).Subscribe((response) => + { + sequencer.Push(response); + + }, (ex) => + { + Debug.WriteLine(ex); + }, () => { }); + } + + private void StopRemoteDesktop() + { + + } } } diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.PPCConsole/Views/ConsoleView.xaml b/Software/Visual_Studio/FSE/Modules/Tango.FSE.PPCConsole/Views/ConsoleView.xaml index 4e2afa884..9514db919 100644 --- a/Software/Visual_Studio/FSE/Modules/Tango.FSE.PPCConsole/Views/ConsoleView.xaml +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.PPCConsole/Views/ConsoleView.xaml @@ -11,8 +11,8 @@ mc:Ignorable="d" d:DesignHeight="450" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:ConsoleViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.ConsoleViewVM}"> - - + + diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.PPCConsole/Views/RemoteDesktopView.xaml b/Software/Visual_Studio/FSE/Modules/Tango.FSE.PPCConsole/Views/RemoteDesktopView.xaml index 8d986a04a..b6a4eec62 100644 --- a/Software/Visual_Studio/FSE/Modules/Tango.FSE.PPCConsole/Views/RemoteDesktopView.xaml +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.PPCConsole/Views/RemoteDesktopView.xaml @@ -11,27 +11,41 @@ mc:Ignorable="d" d:DesignHeight="1280" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:RemoteDesktopViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.RemoteDesktopViewVM}"> - - - - - - - - - + + + + + + + + + + + + + + - - - + + - - - + + + + + + + + + + + + + - + diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.PPCConsole/app.config b/Software/Visual_Studio/FSE/Modules/Tango.FSE.PPCConsole/app.config index 36bc04f85..5d8d17458 100644 --- a/Software/Visual_Studio/FSE/Modules/Tango.FSE.PPCConsole/app.config +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.PPCConsole/app.config @@ -74,6 +74,10 @@ + + + + diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.PPCConsole/packages.config b/Software/Visual_Studio/FSE/Modules/Tango.FSE.PPCConsole/packages.config index dd8c723e4..d17a56d7d 100644 --- a/Software/Visual_Studio/FSE/Modules/Tango.FSE.PPCConsole/packages.config +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.PPCConsole/packages.config @@ -7,4 +7,10 @@ + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Connection/IMachineProvider.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/Connection/IMachineProvider.cs index c5886fb3c..be4748617 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.Common/Connection/IMachineProvider.cs +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Connection/IMachineProvider.cs @@ -15,6 +15,16 @@ namespace Tango.FSE.Common.Connection /// public interface IMachineProvider { + /// + /// Occurs when machine operator has connected. + /// + event EventHandler MachineConnected; + + /// + /// Occurs when the machine operator has disconnected. + /// + event EventHandler MachineDisconnected; + /// /// Gets the database machine entity associated with the current machine. /// diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Connection/MachineConnectedEventArgs.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/Connection/MachineConnectedEventArgs.cs new file mode 100644 index 000000000..ae4d18538 --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Connection/MachineConnectedEventArgs.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Integration.ExternalBridge; + +namespace Tango.FSE.Common.Connection +{ + public class MachineConnectedEventArgs : EventArgs + { + public IExternalBridgeClient MachineOperator { get; set; } + } +} diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Connection/MachineDisconnectedEventArgs.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/Connection/MachineDisconnectedEventArgs.cs new file mode 100644 index 000000000..1a4534baf --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Connection/MachineDisconnectedEventArgs.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Integration.ExternalBridge; + +namespace Tango.FSE.Common.Connection +{ + public class MachineDisconnectedEventArgs : EventArgs + { + public IExternalBridgeClient MachineOperator { get; set; } + public Exception Exception { get; set; } + } +} diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Tango.FSE.Common.csproj b/Software/Visual_Studio/FSE/Tango.FSE.Common/Tango.FSE.Common.csproj index 80e1dde40..664643f95 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.Common/Tango.FSE.Common.csproj +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Tango.FSE.Common.csproj @@ -83,6 +83,8 @@ + + ConnectedMachineIcon.xaml diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/App.config b/Software/Visual_Studio/FSE/Tango.FSE.UI/App.config index 22e3d6062..27bce5f20 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.UI/App.config +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/App.config @@ -80,6 +80,10 @@ + + + + diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/Connection/DefaultMachineProvider.cs b/Software/Visual_Studio/FSE/Tango.FSE.UI/Connection/DefaultMachineProvider.cs index 10ba9d957..9027d6a01 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.UI/Connection/DefaultMachineProvider.cs +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/Connection/DefaultMachineProvider.cs @@ -57,6 +57,16 @@ namespace Tango.FSE.UI.Connection } } + /// + /// Occurs when machine operator has connected. + /// + public event EventHandler MachineConnected; + + /// + /// Occurs when the machine operator has disconnected. + /// + public event EventHandler MachineDisconnected; + [TangoInject] private INotificationProvider NotificationProvider { get; set; } @@ -192,6 +202,7 @@ namespace Tango.FSE.UI.Connection await MachineOperator.Connect(); IsConnected = true; + OnMachineConnected(MachineOperator); return true; } } @@ -234,6 +245,7 @@ namespace Tango.FSE.UI.Connection { IsConnected = false; IsBusy = false; + OnMachineDisconnected(MachineOperator, null); } } } @@ -247,6 +259,8 @@ namespace Tango.FSE.UI.Connection { IsConnected = false; + OnMachineDisconnected(MachineOperator, MachineOperator.FailedStateException); + InvokeUI(async () => { var vm = await NotificationProvider.ShowDialog(new MachineConnectionLostViewVM(MachineOperator, MachineOperator.FailedStateException.FlattenMessage(), 10)); @@ -280,6 +294,8 @@ namespace Tango.FSE.UI.Connection { IsConnected = false; + OnMachineDisconnected(MachineOperator, new Exception("The connection has been terminated by the remote machine.")); + InvokeUI(() => { NotificationProvider.ShowError("The connection has been terminated by the remote machine."); @@ -301,6 +317,23 @@ namespace Tango.FSE.UI.Connection MachineOperator.ContinuousRequestTimeout = TimeSpan.FromSeconds(5); } + protected virtual void OnMachineConnected(IExternalBridgeClient machineOperator) + { + MachineConnected?.Invoke(this, new MachineConnectedEventArgs() + { + MachineOperator = machineOperator, + }); + } + + protected virtual void OnMachineDisconnected(IExternalBridgeClient machineOperator, Exception exception) + { + MachineDisconnected?.Invoke(this, new MachineDisconnectedEventArgs() + { + MachineOperator = machineOperator, + Exception = exception + }); + } + /// /// Reassigns the event handlers from the previous connected machine to a new one. /// diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/Views/LayoutView.xaml b/Software/Visual_Studio/FSE/Tango.FSE.UI/Views/LayoutView.xaml index 5d84b6b46..2a4db030b 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.UI/Views/LayoutView.xaml +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/Views/LayoutView.xaml @@ -36,9 +36,9 @@ - + - + + + + @@ -68,34 +84,6 @@ - - - - - - - - - - - - - - - - - - - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -475,11 +537,142 @@ - - - TOTALS: - Cyan: - + + + + + + + + + + + + + + + + + + + + + + + + Total Thread Consumption per thread: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Views/JobRunsView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Views/JobRunsView.xaml.cs index c460e2a9b..2b3ed79ca 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Views/JobRunsView.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Views/JobRunsView.xaml.cs @@ -1,4 +1,6 @@ -using System; +using LiveCharts; +using LiveCharts.Wpf; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -79,5 +81,6 @@ namespace Tango.MachineStudio.Statistics.Views } } } + } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/packages.config b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/packages.config index 31c5f029f..6938c8a4b 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/packages.config +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/packages.config @@ -1,6 +1,7 @@  + diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.config b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.config index 59f92d6b9..d70e2180b 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.config +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.config @@ -152,6 +152,10 @@ + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.BL/Entities/JobRun.cs b/Software/Visual_Studio/Tango.BL/Entities/JobRun.cs index f422447fe..45bfd9840 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/JobRun.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/JobRun.cs @@ -7,6 +7,7 @@ using System.Text; using System.Threading.Tasks; using Tango.BL.Enumerations; using Tango.BL.ValueObjects; +using Tango.PMR.Exports; namespace Tango.BL.Entities { @@ -82,6 +83,28 @@ namespace Tango.BL.Entities } } + private JobFile _jobFile; + [NotMapped] + [JsonIgnore] + public JobFile JobFile + { + get + { + if (_jobFile == null && JobString != null) + { + _jobFile = JobFile.Parser.ParseJson(JobString); + } + + return _jobFile; + } + set { _jobFile = value; } + } + + public Task CreateAssociatedJob() + { + return Job.FromJobFile(JobFile, MachineGuid, UserGuid); + } + protected override void RaisePropertyChanged(string propName) { base.RaisePropertyChanged(propName); -- cgit v1.3.1