From c3cacd847c2b2577ef5d815963d1d8f2b557c8ac Mon Sep 17 00:00:00 2001 From: Victoria Plitt Date: Mon, 19 Aug 2019 19:02:58 +0300 Subject: PPC Graphic changes --- .../PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs') diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs index 5062df1d6..fd967e39a 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs @@ -143,6 +143,7 @@ namespace Tango.PPC.UI.Notifications Icon = TouchIconKind.AlertCircleOutline, Title = "Error", Brush = Application.Current.Resources["TangoMessageBoxErrorBrush"] as Brush, + MessageType = MessageBoxVM.MessageTypes.Error, }); } @@ -159,6 +160,7 @@ namespace Tango.PPC.UI.Notifications Icon = TouchIconKind.AlertCircleOutline, Title = "Information", Brush = Application.Current.Resources["TangoMessageBoxInfoBrush"] as Brush, + MessageType = MessageBoxVM.MessageTypes.Info, }); } @@ -175,6 +177,7 @@ namespace Tango.PPC.UI.Notifications Icon = TouchIconKind.AlertCircleOutline, Title = "Warning", Brush = Application.Current.Resources["TangoMessageBoxWarningBrush"] as Brush, + MessageType = MessageBoxVM.MessageTypes.Warning, }); } @@ -192,6 +195,7 @@ namespace Tango.PPC.UI.Notifications Title = "Confirm", HasCancel = true, Brush = Application.Current.Resources["TangoMessageBoxQuestionBrush"] as Brush, + MessageType = MessageBoxVM.MessageTypes.Question, }); } @@ -208,6 +212,7 @@ namespace Tango.PPC.UI.Notifications Icon = TouchIconKind.Check, Title = "Success", Brush = Application.Current.Resources["TangoMessageBoxSuccessBrush"] as Brush, + MessageType = MessageBoxVM.MessageTypes.Success, }); } -- cgit v1.3.1 From 53d2c81ebf6a98b4a0c46559abd6a636a4517314 Mon Sep 17 00:00:00 2001 From: Victoria Plitt Date: Tue, 20 Aug 2019 14:49:46 +0300 Subject: PPC Graphic UX QA_1.1.19 --- .../Tango.PPC.Jobs/Controls/JobSummeryViewer.xaml | 2 +- .../Tango.PPC.Jobs/Controls/RunningJobViewer.xaml | 2 +- .../Tango.PPC.Jobs/Views/JobProgressView.xaml | 6 +-- .../Tango.PPC.Jobs/Views/JobSummeryView.xaml | 6 +-- .../PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml | 2 +- .../Notifications/DefaultNotificationProvider.cs | 11 +++-- .../PPC/Tango.PPC.UI/Resources/Colors.xaml | 5 +++ .../PPC/Tango.PPC.UI/Views/LayoutView.xaml | 2 +- .../Tango.ColorConversion/DefaultColorConverter.cs | 2 +- .../Tango.Integration/Operation/MachineStatuses.cs | 2 +- .../Tango.Touch/Controls/MessageBoxVM.cs | 10 +---- .../Tango.Touch/Controls/TouchPanel.xaml | 49 +--------------------- .../Visual_Studio/Tango.Touch/Resources/Fonts.xaml | 4 +- 13 files changed, 26 insertions(+), 77 deletions(-) (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs') diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/JobSummeryViewer.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/JobSummeryViewer.xaml index 830718cb6..ba6c13e91 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/JobSummeryViewer.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/JobSummeryViewer.xaml @@ -89,7 +89,7 @@ - + diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/RunningJobViewer.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/RunningJobViewer.xaml index a0bc6c1d9..97aedcf89 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/RunningJobViewer.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/RunningJobViewer.xaml @@ -90,7 +90,7 @@ - + diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobProgressView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobProgressView.xaml index cf49bd024..4545d5903 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobProgressView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobProgressView.xaml @@ -89,7 +89,7 @@ Completed - + m @@ -109,7 +109,7 @@ Time Left - + @@ -201,7 +201,7 @@ - + diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobSummeryView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobSummeryView.xaml index ad60c46ca..630b2089f 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobSummeryView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobSummeryView.xaml @@ -68,7 +68,7 @@ Length - + m @@ -82,7 +82,7 @@ Time - + @@ -91,7 +91,7 @@ - + diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml index 1c7e48bfa..2fd8496f8 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml @@ -648,7 +648,7 @@ - + diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs index fd967e39a..b543fe58e 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs @@ -143,10 +143,9 @@ namespace Tango.PPC.UI.Notifications Icon = TouchIconKind.AlertCircleOutline, Title = "Error", Brush = Application.Current.Resources["TangoMessageBoxErrorBrush"] as Brush, - MessageType = MessageBoxVM.MessageTypes.Error, + HeaderBrush = Application.Current.Resources["TangoMessageBoxHeaderErrorBrush"] as Brush, }); } - /// /// Shows an information message box. /// @@ -160,7 +159,7 @@ namespace Tango.PPC.UI.Notifications Icon = TouchIconKind.AlertCircleOutline, Title = "Information", Brush = Application.Current.Resources["TangoMessageBoxInfoBrush"] as Brush, - MessageType = MessageBoxVM.MessageTypes.Info, + HeaderBrush = Application.Current.Resources["TangoMessageBoxHeaderInfoBrush"] as Brush, }); } @@ -177,7 +176,7 @@ namespace Tango.PPC.UI.Notifications Icon = TouchIconKind.AlertCircleOutline, Title = "Warning", Brush = Application.Current.Resources["TangoMessageBoxWarningBrush"] as Brush, - MessageType = MessageBoxVM.MessageTypes.Warning, + HeaderBrush = Application.Current.Resources["TangoMessageBoxHeaderWarningBrush"] as Brush, }); } @@ -195,7 +194,7 @@ namespace Tango.PPC.UI.Notifications Title = "Confirm", HasCancel = true, Brush = Application.Current.Resources["TangoMessageBoxQuestionBrush"] as Brush, - MessageType = MessageBoxVM.MessageTypes.Question, + HeaderBrush = Application.Current.Resources["TangoMessageBoxHeaderQuestionBrush"] as Brush, }); } @@ -212,7 +211,7 @@ namespace Tango.PPC.UI.Notifications Icon = TouchIconKind.Check, Title = "Success", Brush = Application.Current.Resources["TangoMessageBoxSuccessBrush"] as Brush, - MessageType = MessageBoxVM.MessageTypes.Success, + HeaderBrush = Application.Current.Resources["TangoMessageBoxHeaderSuccessBrush"] as Brush, }); } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Resources/Colors.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Resources/Colors.xaml index 2b89aac82..f0e872285 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Resources/Colors.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Resources/Colors.xaml @@ -7,5 +7,10 @@ + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml index 3d475d912..a0e7223c7 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml @@ -25,7 +25,7 @@ - + diff --git a/Software/Visual_Studio/Tango.ColorConversion/DefaultColorConverter.cs b/Software/Visual_Studio/Tango.ColorConversion/DefaultColorConverter.cs index f6fe9c74e..00df9f0de 100644 --- a/Software/Visual_Studio/Tango.ColorConversion/DefaultColorConverter.cs +++ b/Software/Visual_Studio/Tango.ColorConversion/DefaultColorConverter.cs @@ -68,7 +68,7 @@ namespace Tango.ColorConversion throw new ArgumentNullException("Specified RML is a null reference."); } - if (rml.Cct == null) + if (rml.Cct == null || rml.Cct.Data == null) { throw new InvalidOperationException($"No CCT found for RML {rml.Name}. Could not create a conversion input."); } diff --git a/Software/Visual_Studio/Tango.Integration/Operation/MachineStatuses.cs b/Software/Visual_Studio/Tango.Integration/Operation/MachineStatuses.cs index 8884b33a3..059c1f859 100644 --- a/Software/Visual_Studio/Tango.Integration/Operation/MachineStatuses.cs +++ b/Software/Visual_Studio/Tango.Integration/Operation/MachineStatuses.cs @@ -13,7 +13,7 @@ namespace Tango.Integration.Operation Disconnected, [Description("Standby")] Standby, - [Description("Dye Job")] + [Description("Ready To Dye")] ReadyToDye, [Description("Getting Ready")] GettingReady, diff --git a/Software/Visual_Studio/Tango.Touch/Controls/MessageBoxVM.cs b/Software/Visual_Studio/Tango.Touch/Controls/MessageBoxVM.cs index 55dc72bf9..06ae6f2a4 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/MessageBoxVM.cs +++ b/Software/Visual_Studio/Tango.Touch/Controls/MessageBoxVM.cs @@ -15,15 +15,7 @@ namespace Tango.Touch.Controls /// /// Represents the available message notification types. /// - public enum MessageTypes - { - Info, - Success, - Warning, - Error, - Question, - } - public MessageTypes MessageType { get; set; } = MessageTypes.Info; + public Brush HeaderBrush { get; set; } public String Title { get; set; } diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchPanel.xaml b/Software/Visual_Studio/Tango.Touch/Controls/TouchPanel.xaml index 0b72e8b85..1082bcf3b 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchPanel.xaml +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchPanel.xaml @@ -228,54 +228,7 @@ - - - - + diff --git a/Software/Visual_Studio/Tango.Touch/Resources/Fonts.xaml b/Software/Visual_Studio/Tango.Touch/Resources/Fonts.xaml index 0d01c6777..cbe0e3f0b 100644 --- a/Software/Visual_Studio/Tango.Touch/Resources/Fonts.xaml +++ b/Software/Visual_Studio/Tango.Touch/Resources/Fonts.xaml @@ -23,6 +23,6 @@ 26 18 - Flexo Medium - 22 + 27 + 50 \ No newline at end of file -- cgit v1.3.1 From 0c97dba8c1443ee39029136c52bc3861702888e2 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Thu, 22 Aug 2019 11:58:11 +0300 Subject: Added cartridge insertion validation handling. Implemented a better keep alive mechanism. --- .../Diagnostics/CartridgeValidationRequest.proto | 2 - .../Diagnostics/CartridgeValidationResponse.proto | 4 +- .../Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj | 2 +- .../PPC/Tango.PPC.Common/Resources/Merged.xaml | 1 + .../Dialogs/CartridgeValidationView.xaml | 67 +++++++++++++++++++++ .../Dialogs/CartridgeValidationView.xaml.cs | 28 +++++++++ .../Dialogs/CartridgeValidationViewVM.cs | 37 ++++++++++++ .../Tango.PPC.UI/Images/cartridge_validation.png | Bin 0 -> 44260 bytes .../Notifications/DefaultNotificationProvider.cs | 2 +- .../PPC/Tango.PPC.UI/Tango.PPC.UI.csproj | 11 +++- .../PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs | 29 +++++++++ .../Tango.Emulations/Emulators/MachineEmulator.cs | 10 +++ .../ExternalBridge/ExternalBridgeService.cs | 2 + .../ExternalBridge/ExternalBridgeTcpClient.cs | 1 + .../Operation/CartridgeValidationEventArgs.cs | 50 +++++++++++++++ .../Operation/IMachineOperator.cs | 5 ++ .../Tango.Integration/Operation/MachineOperator.cs | 47 +++++++++++++++ .../Tango.Integration/Tango.Integration.csproj | 3 +- .../Diagnostics/CartridgeValidationRequest.cs | 48 ++------------- .../Diagnostics/CartridgeValidationResponse.cs | 53 +++++++--------- .../Tango.Touch/Styles/TouchButton.xaml | 6 ++ .../Visual_Studio/Tango.Transport/ITransporter.cs | 5 ++ .../Tango.Transport/TransporterBase.cs | 21 ++++++- Software/Visual_Studio/Tango.sln | 12 ++-- .../Tango.MachineEM.UI/ViewModels/MainViewVM.cs | 20 ++++++ .../Tango.MachineEM.UI/Views/MainView.xaml | 8 ++- 26 files changed, 383 insertions(+), 91 deletions(-) create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/CartridgeValidationView.xaml create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/CartridgeValidationView.xaml.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/CartridgeValidationViewVM.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Images/cartridge_validation.png create mode 100644 Software/Visual_Studio/Tango.Integration/Operation/CartridgeValidationEventArgs.cs (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs') diff --git a/Software/PMR/Messages/Diagnostics/CartridgeValidationRequest.proto b/Software/PMR/Messages/Diagnostics/CartridgeValidationRequest.proto index 6ea8ba407..432643e67 100644 --- a/Software/PMR/Messages/Diagnostics/CartridgeValidationRequest.proto +++ b/Software/PMR/Messages/Diagnostics/CartridgeValidationRequest.proto @@ -1,6 +1,5 @@ syntax = "proto3"; -import "Cartridge.proto"; import "CartridgeAction.proto"; package Tango.PMR.Diagnostics; @@ -8,6 +7,5 @@ option java_package = "com.twine.tango.pmr.diagnostics"; message CartridgeValidationRequest { - Cartridge Cartridge = 1; CartridgeAction Action = 2; } \ No newline at end of file diff --git a/Software/PMR/Messages/Diagnostics/CartridgeValidationResponse.proto b/Software/PMR/Messages/Diagnostics/CartridgeValidationResponse.proto index f3212faa6..5656c7987 100644 --- a/Software/PMR/Messages/Diagnostics/CartridgeValidationResponse.proto +++ b/Software/PMR/Messages/Diagnostics/CartridgeValidationResponse.proto @@ -1,12 +1,10 @@ syntax = "proto3"; -import "Cartridge.proto"; - package Tango.PMR.Diagnostics; option java_package = "com.twine.tango.pmr.diagnostics"; message CartridgeValidationResponse { bool IsValid = 1; - Cartridge Cartridge = 2; + int32 Index = 2; } \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj index 8ed2ff80e..26fd06d2d 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj @@ -472,7 +472,7 @@ - + \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Resources/Merged.xaml b/Software/Visual_Studio/PPC/Tango.PPC.Common/Resources/Merged.xaml index b5b9f9b23..04021d6b6 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Resources/Merged.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Resources/Merged.xaml @@ -49,6 +49,7 @@ + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/CartridgeValidationView.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/CartridgeValidationView.xaml.cs new file mode 100644 index 000000000..dbfb990b6 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/CartridgeValidationView.xaml.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace Tango.PPC.UI.Dialogs +{ + /// + /// Interaction logic for TechnicianModeLoginView.xaml + /// + public partial class CartridgeValidationView : UserControl + { + public CartridgeValidationView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/CartridgeValidationViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/CartridgeValidationViewVM.cs new file mode 100644 index 000000000..f901723a4 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/CartridgeValidationViewVM.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL.Entities; +using Tango.SharedUI; + +namespace Tango.PPC.UI.Dialogs +{ + public class CartridgeValidationViewVM : DialogViewVM + { + private List _idsPacks; + public List IDSPacks + { + get { return _idsPacks; } + set { _idsPacks = value; RaisePropertyChangedAuto(); } + } + + private IdsPack _selectedIDSPack; + public IdsPack SelectedIDSPack + { + get { return _selectedIDSPack; } + set { _selectedIDSPack = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); } + } + + public CartridgeValidationViewVM() + { + IDSPacks = new List(); + } + + protected override bool CanOK() + { + return base.CanOK() && SelectedIDSPack != null; + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/cartridge_validation.png b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/cartridge_validation.png new file mode 100644 index 000000000..373cb78c1 Binary files /dev/null and b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/cartridge_validation.png differ diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs index 5062df1d6..1c71b080d 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs @@ -388,7 +388,7 @@ namespace Tango.PPC.UI.Notifications throw new NullReferenceException("The view " + viewType.ToString() + " is not of type framework element."); } - return ShowDialog(datacontext, Activator.CreateInstance(viewType) as FrameworkElement); + return ShowDialog(datacontext, view); } /// diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj b/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj index 389f5d59b..c2025b733 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj @@ -122,9 +122,13 @@ + + CartridgeValidationView.xaml + ScreenLockView.xaml + TechnicianModeLoginView.xaml @@ -194,6 +198,10 @@ Designer MSBuild:Compile + + MSBuild:Compile + Designer + MSBuild:Compile Designer @@ -311,6 +319,7 @@ + @@ -546,7 +555,7 @@ del "$(TargetDir)firmware_package.tfp" - + \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs index a4f550a39..01a47539e 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs @@ -6,6 +6,7 @@ using System.Threading.Tasks; using System.Windows.Threading; using Tango.Core.DI; using Tango.Integration.ExternalBridge; +using Tango.Integration.Operation; using Tango.PPC.Common; using Tango.PPC.Common.Application; using Tango.PPC.Common.Authentication; @@ -14,6 +15,7 @@ using Tango.PPC.Common.Modules; using Tango.PPC.Common.Navigation; using Tango.PPC.Common.Notifications; using Tango.PPC.Common.WatchDog; +using Tango.PPC.UI.Dialogs; using Tango.SharedUI; namespace Tango.PPC.UI.ViewModels @@ -49,6 +51,13 @@ namespace Tango.PPC.UI.ViewModels /// public override void OnApplicationStarted() { + + } + + public override void OnApplicationReady() + { + base.OnApplicationReady(); + MachineProvider.MachineOperator.CartridgeValidationRequestReceived += MachineOperator_CartridgeValidationRequestReceived; } #region Event Handlers @@ -63,6 +72,26 @@ namespace Tango.PPC.UI.ViewModels CurrentDateTime = DateTime.Now; } + private void MachineOperator_CartridgeValidationRequestReceived(object sender, CartridgeValidationEventArgs e) + { + InvokeUI(async () => + { + var vm = await NotificationProvider.ShowDialog(new CartridgeValidationViewVM() + { + IDSPacks = MachineProvider.Machine.Configuration.NoneEmptyIdsPacks.ToList(), + }); + + if (vm.DialogResult) + { + e.Approve(vm.SelectedIDSPack.PackIndex); + } + else + { + e.Decline(); + } + }); + } + #endregion } } diff --git a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs index 0a219b824..dea2ddb69 100644 --- a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs +++ b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs @@ -1312,6 +1312,16 @@ namespace Tango.Emulations.Emulators #region Public Methods + public async Task ValidateCartridge() + { + var response = await Transporter.SendRequest(new CartridgeValidationRequest() + { + Action = CartridgeAction.Inserted, + + }, TimeSpan.FromSeconds(10)); + + return response.Message.Index; + } #endregion } diff --git a/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeService.cs b/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeService.cs index 648046bd2..b7921aac3 100644 --- a/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeService.cs +++ b/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeService.cs @@ -145,6 +145,8 @@ namespace Tango.Integration.ExternalBridge _tcpServer.ClientConnected += _tcpServer_ClientConnected; LogManager.NewLog += LogManager_NewLog; + + KeepAliveTimeout = TimeSpan.FromSeconds(5); } /// diff --git a/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeTcpClient.cs b/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeTcpClient.cs index ef00133df..9adc1f223 100644 --- a/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeTcpClient.cs +++ b/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeTcpClient.cs @@ -251,6 +251,7 @@ namespace Tango.Integration.ExternalBridge SerialNumber = serialNumber; Machine = ObservablesStaticCollections.Instance.Machines.SingleOrDefault(x => x.SerialNumber == serialNumber); IPAddress = ipAddress; + KeepAliveTimeout = TimeSpan.FromSeconds(5); UseKeepAlive = false; EnableDiagnostics = true; } diff --git a/Software/Visual_Studio/Tango.Integration/Operation/CartridgeValidationEventArgs.cs b/Software/Visual_Studio/Tango.Integration/Operation/CartridgeValidationEventArgs.cs new file mode 100644 index 000000000..6ef6e43c6 --- /dev/null +++ b/Software/Visual_Studio/Tango.Integration/Operation/CartridgeValidationEventArgs.cs @@ -0,0 +1,50 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.PMR.Diagnostics; + +namespace Tango.Integration.Operation +{ + /// + /// Represents a cartridge validation request event arguments. + /// + /// + public class CartridgeValidationEventArgs : EventArgs + { + private Action _approveAction; + private Action _declineAction; + + /// + /// Initializes a new instance of the class. + /// + /// The request. + /// The approve action. + public CartridgeValidationEventArgs(CartridgeValidationRequest request, Action approveAction,Action declineAction) + { + Request = request; + _approveAction = approveAction; + _declineAction = declineAction; + } + + /// + /// Gets the request. + /// + public CartridgeValidationRequest Request { get; private set; } + + /// + /// Sends approved response for the specified cartridge index. + /// + /// The cartridge index. + public void Approve(int cartridgeIndex) + { + _approveAction(cartridgeIndex); + } + + public void Decline() + { + _declineAction(); + } + } +} diff --git a/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs index 89c947764..ae303563b 100644 --- a/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs +++ b/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs @@ -167,6 +167,11 @@ namespace Tango.Integration.Operation /// event EventHandler MachineStatusChanged; + /// + /// Occurs when a new cartridge validation request has been received. + /// + event EventHandler CartridgeValidationRequestReceived; + /// /// Gets or sets a value indicating whether direct the embedded device to send diagnostics messages. /// diff --git a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs index 3fd24b20b..0c842d0da 100644 --- a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs +++ b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs @@ -137,6 +137,11 @@ namespace Tango.Integration.Operation /// public event EventHandler MachineStatusChanged; + /// + /// Occurs when a new cartridge validation request has been received. + /// + public event EventHandler CartridgeValidationRequestReceived; + /// /// Occurs when a request has been sent. /// @@ -776,6 +781,20 @@ namespace Tango.Integration.Operation ResponseReceived?.Invoke(this, response); } + /// + /// Called when a new request has been received. + /// + /// The request. + protected override void OnRequestReceived(MessageContainer container) + { + base.OnRequestReceived(container); + + if (container.Type == MessageType.CartridgeValidationRequest) + { + OnCartridgeValidationRequestReceived(container.Token, MessageFactory.ExtractMessageFromContainer(container)); + } + } + /// /// Called when the response has been sent /// @@ -803,6 +822,34 @@ namespace Tango.Integration.Operation StatusChanged?.Invoke(this, status); } + /// + /// Called when the cartridge validation request has been received. + /// + /// The request. + protected virtual void OnCartridgeValidationRequestReceived(String token, CartridgeValidationRequest request) + { + CartridgeValidationEventArgs e = new CartridgeValidationEventArgs(request, (index) => + { + //Approve + SendResponse(new CartridgeValidationResponse() + { + IsValid = true, + Index = index, + }, token).Wait(); + + }, () => + { + //Decline + SendResponse(new CartridgeValidationResponse() + { + + }, token).Wait(); + + }); + + CartridgeValidationRequestReceived?.Invoke(this, e); + } + #endregion #region Override Methods diff --git a/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj b/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj index bbd9f8c0d..62ff18fb6 100644 --- a/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj +++ b/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj @@ -99,6 +99,7 @@ + @@ -192,7 +193,7 @@ - + \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.PMR/Diagnostics/CartridgeValidationRequest.cs b/Software/Visual_Studio/Tango.PMR/Diagnostics/CartridgeValidationRequest.cs index 149c2b6cb..5dc0fa044 100644 --- a/Software/Visual_Studio/Tango.PMR/Diagnostics/CartridgeValidationRequest.cs +++ b/Software/Visual_Studio/Tango.PMR/Diagnostics/CartridgeValidationRequest.cs @@ -23,16 +23,14 @@ namespace Tango.PMR.Diagnostics { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( "CiBDYXJ0cmlkZ2VWYWxpZGF0aW9uUmVxdWVzdC5wcm90bxIVVGFuZ28uUE1S", - "LkRpYWdub3N0aWNzGg9DYXJ0cmlkZ2UucHJvdG8aFUNhcnRyaWRnZUFjdGlv", - "bi5wcm90byKJAQoaQ2FydHJpZGdlVmFsaWRhdGlvblJlcXVlc3QSMwoJQ2Fy", - "dHJpZGdlGAEgASgLMiAuVGFuZ28uUE1SLkRpYWdub3N0aWNzLkNhcnRyaWRn", - "ZRI2CgZBY3Rpb24YAiABKA4yJi5UYW5nby5QTVIuRGlhZ25vc3RpY3MuQ2Fy", - "dHJpZGdlQWN0aW9uQiEKH2NvbS50d2luZS50YW5nby5wbXIuZGlhZ25vc3Rp", - "Y3NiBnByb3RvMw==")); + "LkRpYWdub3N0aWNzGhVDYXJ0cmlkZ2VBY3Rpb24ucHJvdG8iVAoaQ2FydHJp", + "ZGdlVmFsaWRhdGlvblJlcXVlc3QSNgoGQWN0aW9uGAIgASgOMiYuVGFuZ28u", + "UE1SLkRpYWdub3N0aWNzLkNhcnRyaWRnZUFjdGlvbkIhCh9jb20udHdpbmUu", + "dGFuZ28ucG1yLmRpYWdub3N0aWNzYgZwcm90bzM=")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { global::Tango.PMR.Diagnostics.CartridgeReflection.Descriptor, global::Tango.PMR.Diagnostics.CartridgeActionReflection.Descriptor, }, + new pbr::FileDescriptor[] { global::Tango.PMR.Diagnostics.CartridgeActionReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Diagnostics.CartridgeValidationRequest), global::Tango.PMR.Diagnostics.CartridgeValidationRequest.Parser, new[]{ "Cartridge", "Action" }, null, null, null) + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Diagnostics.CartridgeValidationRequest), global::Tango.PMR.Diagnostics.CartridgeValidationRequest.Parser, new[]{ "Action" }, null, null, null) })); } #endregion @@ -63,7 +61,6 @@ namespace Tango.PMR.Diagnostics { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public CartridgeValidationRequest(CartridgeValidationRequest other) : this() { - Cartridge = other.cartridge_ != null ? other.Cartridge.Clone() : null; action_ = other.action_; } @@ -72,17 +69,6 @@ namespace Tango.PMR.Diagnostics { return new CartridgeValidationRequest(this); } - /// Field number for the "Cartridge" field. - public const int CartridgeFieldNumber = 1; - private global::Tango.PMR.Diagnostics.Cartridge cartridge_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Tango.PMR.Diagnostics.Cartridge Cartridge { - get { return cartridge_; } - set { - cartridge_ = value; - } - } - /// Field number for the "Action" field. public const int ActionFieldNumber = 2; private global::Tango.PMR.Diagnostics.CartridgeAction action_ = 0; @@ -107,7 +93,6 @@ namespace Tango.PMR.Diagnostics { if (ReferenceEquals(other, this)) { return true; } - if (!object.Equals(Cartridge, other.Cartridge)) return false; if (Action != other.Action) return false; return true; } @@ -115,7 +100,6 @@ namespace Tango.PMR.Diagnostics { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (cartridge_ != null) hash ^= Cartridge.GetHashCode(); if (Action != 0) hash ^= Action.GetHashCode(); return hash; } @@ -127,10 +111,6 @@ namespace Tango.PMR.Diagnostics { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { - if (cartridge_ != null) { - output.WriteRawTag(10); - output.WriteMessage(Cartridge); - } if (Action != 0) { output.WriteRawTag(16); output.WriteEnum((int) Action); @@ -140,9 +120,6 @@ namespace Tango.PMR.Diagnostics { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (cartridge_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Cartridge); - } if (Action != 0) { size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Action); } @@ -154,12 +131,6 @@ namespace Tango.PMR.Diagnostics { if (other == null) { return; } - if (other.cartridge_ != null) { - if (cartridge_ == null) { - cartridge_ = new global::Tango.PMR.Diagnostics.Cartridge(); - } - Cartridge.MergeFrom(other.Cartridge); - } if (other.Action != 0) { Action = other.Action; } @@ -173,13 +144,6 @@ namespace Tango.PMR.Diagnostics { default: input.SkipLastField(); break; - case 10: { - if (cartridge_ == null) { - cartridge_ = new global::Tango.PMR.Diagnostics.Cartridge(); - } - input.ReadMessage(cartridge_); - break; - } case 16: { action_ = (global::Tango.PMR.Diagnostics.CartridgeAction) input.ReadEnum(); break; diff --git a/Software/Visual_Studio/Tango.PMR/Diagnostics/CartridgeValidationResponse.cs b/Software/Visual_Studio/Tango.PMR/Diagnostics/CartridgeValidationResponse.cs index 7463f0270..e128809df 100644 --- a/Software/Visual_Studio/Tango.PMR/Diagnostics/CartridgeValidationResponse.cs +++ b/Software/Visual_Studio/Tango.PMR/Diagnostics/CartridgeValidationResponse.cs @@ -23,14 +23,13 @@ namespace Tango.PMR.Diagnostics { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( "CiFDYXJ0cmlkZ2VWYWxpZGF0aW9uUmVzcG9uc2UucHJvdG8SFVRhbmdvLlBN", - "Ui5EaWFnbm9zdGljcxoPQ2FydHJpZGdlLnByb3RvImMKG0NhcnRyaWRnZVZh", - "bGlkYXRpb25SZXNwb25zZRIPCgdJc1ZhbGlkGAEgASgIEjMKCUNhcnRyaWRn", - "ZRgCIAEoCzIgLlRhbmdvLlBNUi5EaWFnbm9zdGljcy5DYXJ0cmlkZ2VCIQof", - "Y29tLnR3aW5lLnRhbmdvLnBtci5kaWFnbm9zdGljc2IGcHJvdG8z")); + "Ui5EaWFnbm9zdGljcyI9ChtDYXJ0cmlkZ2VWYWxpZGF0aW9uUmVzcG9uc2US", + "DwoHSXNWYWxpZBgBIAEoCBINCgVJbmRleBgCIAEoBUIhCh9jb20udHdpbmUu", + "dGFuZ28ucG1yLmRpYWdub3N0aWNzYgZwcm90bzM=")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { global::Tango.PMR.Diagnostics.CartridgeReflection.Descriptor, }, + new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Diagnostics.CartridgeValidationResponse), global::Tango.PMR.Diagnostics.CartridgeValidationResponse.Parser, new[]{ "IsValid", "Cartridge" }, null, null, null) + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Diagnostics.CartridgeValidationResponse), global::Tango.PMR.Diagnostics.CartridgeValidationResponse.Parser, new[]{ "IsValid", "Index" }, null, null, null) })); } #endregion @@ -62,7 +61,7 @@ namespace Tango.PMR.Diagnostics { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public CartridgeValidationResponse(CartridgeValidationResponse other) : this() { isValid_ = other.isValid_; - Cartridge = other.cartridge_ != null ? other.Cartridge.Clone() : null; + index_ = other.index_; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -81,14 +80,14 @@ namespace Tango.PMR.Diagnostics { } } - /// Field number for the "Cartridge" field. - public const int CartridgeFieldNumber = 2; - private global::Tango.PMR.Diagnostics.Cartridge cartridge_; + /// Field number for the "Index" field. + public const int IndexFieldNumber = 2; + private int index_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Tango.PMR.Diagnostics.Cartridge Cartridge { - get { return cartridge_; } + public int Index { + get { return index_; } set { - cartridge_ = value; + index_ = value; } } @@ -106,7 +105,7 @@ namespace Tango.PMR.Diagnostics { return true; } if (IsValid != other.IsValid) return false; - if (!object.Equals(Cartridge, other.Cartridge)) return false; + if (Index != other.Index) return false; return true; } @@ -114,7 +113,7 @@ namespace Tango.PMR.Diagnostics { public override int GetHashCode() { int hash = 1; if (IsValid != false) hash ^= IsValid.GetHashCode(); - if (cartridge_ != null) hash ^= Cartridge.GetHashCode(); + if (Index != 0) hash ^= Index.GetHashCode(); return hash; } @@ -129,9 +128,9 @@ namespace Tango.PMR.Diagnostics { output.WriteRawTag(8); output.WriteBool(IsValid); } - if (cartridge_ != null) { - output.WriteRawTag(18); - output.WriteMessage(Cartridge); + if (Index != 0) { + output.WriteRawTag(16); + output.WriteInt32(Index); } } @@ -141,8 +140,8 @@ namespace Tango.PMR.Diagnostics { if (IsValid != false) { size += 1 + 1; } - if (cartridge_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Cartridge); + if (Index != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Index); } return size; } @@ -155,11 +154,8 @@ namespace Tango.PMR.Diagnostics { if (other.IsValid != false) { IsValid = other.IsValid; } - if (other.cartridge_ != null) { - if (cartridge_ == null) { - cartridge_ = new global::Tango.PMR.Diagnostics.Cartridge(); - } - Cartridge.MergeFrom(other.Cartridge); + if (other.Index != 0) { + Index = other.Index; } } @@ -175,11 +171,8 @@ namespace Tango.PMR.Diagnostics { IsValid = input.ReadBool(); break; } - case 18: { - if (cartridge_ == null) { - cartridge_ = new global::Tango.PMR.Diagnostics.Cartridge(); - } - input.ReadMessage(cartridge_); + case 16: { + Index = input.ReadInt32(); break; } } diff --git a/Software/Visual_Studio/Tango.Touch/Styles/TouchButton.xaml b/Software/Visual_Studio/Tango.Touch/Styles/TouchButton.xaml index d8d843b78..2fd056b6d 100644 --- a/Software/Visual_Studio/Tango.Touch/Styles/TouchButton.xaml +++ b/Software/Visual_Studio/Tango.Touch/Styles/TouchButton.xaml @@ -47,6 +47,12 @@ + + + + + +