From 91082afaed2e859e42bad9b06739075689e71b3e Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Sun, 21 Oct 2018 12:01:25 +0300 Subject: Machine Studio v3.5.52 --- .../MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml.cs | 9 ++++++++- .../Tango.MachineStudio.UI/Properties/AssemblyInfo.cs | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI') diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml.cs index 9989aa091..feb1e41b3 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml.cs @@ -41,7 +41,14 @@ namespace Tango.MachineStudio.UI { InitializeComponent(); - _is_testing = TestHelper.IsRunningUnderTestStudio(); + try + { + _is_testing = TestHelper.IsRunningUnderTestStudio(); + } + catch (Exception ex) + { + LogManager.Log(ex, LogCategory.Warning, "An error occurred while trying to get the parent process of machine studio."); + } if (!_is_testing) { 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 075832b06..d4690c6b5 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("3.5.51.18238")] +[assembly: AssemblyVersion("3.5.52.18238")] [assembly: ComVisible(false)] \ No newline at end of file -- cgit v1.3.1 From eed57807589a6de896c27e988e2d0e8d1358faa4 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Tue, 23 Oct 2018 15:41:42 +0300 Subject: Added storage api proto files. --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 15400960 -> 15400960 bytes .../com.google.eclipse.protobuf.Protobuf.prefs | 2 +- Software/PMR/Messages/Common/MessageType.proto | 8 + Software/PMR/Messages/IO/CreateRequest.proto | 12 + Software/PMR/Messages/IO/CreateResponse.proto | 9 + Software/PMR/Messages/IO/DeleteRequest.proto | 9 + Software/PMR/Messages/IO/DeleteResponse.proto | 9 + Software/PMR/Messages/IO/FileAttribute.proto | 15 + Software/PMR/Messages/IO/FileInfo.proto | 16 ++ Software/PMR/Messages/IO/GetFilesRequest.proto | 9 + Software/PMR/Messages/IO/GetFilesResponse.proto | 11 + .../PMR/Messages/IO/GetStorageInfoRequest.proto | 10 + .../PMR/Messages/IO/GetStorageInfoResponse.proto | 9 + .../Properties/AssemblyInfo.cs | 2 +- .../ViewModels/MachineConnectionViewVM.cs | 33 +++ .../ViewModels/MainViewVM.cs | 62 +++-- .../Views/MachineConnectionView.xaml | 32 ++- .../Tango.Integration/Operation/StorageManager.cs | 144 ++++++++++ .../Tango.Integration/Tango.Integration.csproj | 3 +- .../Visual_Studio/Tango.PMR/Common/MessageType.cs | 18 +- .../Visual_Studio/Tango.PMR/IO/CreateRequest.cs | 188 +++++++++++++ .../Visual_Studio/Tango.PMR/IO/CreateResponse.cs | 130 +++++++++ .../Visual_Studio/Tango.PMR/IO/DeleteRequest.cs | 159 +++++++++++ .../Visual_Studio/Tango.PMR/IO/DeleteResponse.cs | 130 +++++++++ .../Visual_Studio/Tango.PMR/IO/FileAttribute.cs | 52 ++++ Software/Visual_Studio/Tango.PMR/IO/FileInfo.cs | 302 +++++++++++++++++++++ .../Visual_Studio/Tango.PMR/IO/GetFilesRequest.cs | 159 +++++++++++ .../Visual_Studio/Tango.PMR/IO/GetFilesResponse.cs | 152 +++++++++++ .../Tango.PMR/IO/GetStorageInfoRequest.cs | 188 +++++++++++++ .../Tango.PMR/IO/GetStorageInfoResponse.cs | 131 +++++++++ Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj | 12 +- 32 files changed, 1970 insertions(+), 46 deletions(-) create mode 100644 Software/PMR/Messages/IO/CreateRequest.proto create mode 100644 Software/PMR/Messages/IO/CreateResponse.proto create mode 100644 Software/PMR/Messages/IO/DeleteRequest.proto create mode 100644 Software/PMR/Messages/IO/DeleteResponse.proto create mode 100644 Software/PMR/Messages/IO/FileAttribute.proto create mode 100644 Software/PMR/Messages/IO/FileInfo.proto create mode 100644 Software/PMR/Messages/IO/GetFilesRequest.proto create mode 100644 Software/PMR/Messages/IO/GetFilesResponse.proto create mode 100644 Software/PMR/Messages/IO/GetStorageInfoRequest.proto create mode 100644 Software/PMR/Messages/IO/GetStorageInfoResponse.proto create mode 100644 Software/Visual_Studio/Tango.Integration/Operation/StorageManager.cs create mode 100644 Software/Visual_Studio/Tango.PMR/IO/CreateRequest.cs create mode 100644 Software/Visual_Studio/Tango.PMR/IO/CreateResponse.cs create mode 100644 Software/Visual_Studio/Tango.PMR/IO/DeleteRequest.cs create mode 100644 Software/Visual_Studio/Tango.PMR/IO/DeleteResponse.cs create mode 100644 Software/Visual_Studio/Tango.PMR/IO/FileAttribute.cs create mode 100644 Software/Visual_Studio/Tango.PMR/IO/FileInfo.cs create mode 100644 Software/Visual_Studio/Tango.PMR/IO/GetFilesRequest.cs create mode 100644 Software/Visual_Studio/Tango.PMR/IO/GetFilesResponse.cs create mode 100644 Software/Visual_Studio/Tango.PMR/IO/GetStorageInfoRequest.cs create mode 100644 Software/Visual_Studio/Tango.PMR/IO/GetStorageInfoResponse.cs (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index b0688ab3a..612f1a5ad 100644 Binary files a/Software/DB/Tango.mdf and b/Software/DB/Tango.mdf differ diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf index 8a39b9fa7..eeb01f600 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/PMR/Messages/.settings/com.google.eclipse.protobuf.Protobuf.prefs b/Software/PMR/Messages/.settings/com.google.eclipse.protobuf.Protobuf.prefs index 07b0fe894..5b666a0bb 100644 --- a/Software/PMR/Messages/.settings/com.google.eclipse.protobuf.Protobuf.prefs +++ b/Software/PMR/Messages/.settings/com.google.eclipse.protobuf.Protobuf.prefs @@ -1,4 +1,4 @@ eclipse.preferences.version=1 -paths.directoryPaths=${workspace_loc\:/${project}/Common},${workspace_loc\:/${project}/Jobs},${workspace_loc\:/${project}/Printing},${workspace_loc\:/${project}/ColorLab},${workspace_loc\:/${project}/Diagnostics},${workspace_loc\:/${project}/Debugging},${workspace_loc\:/${project}/Hardware},${workspace_loc\:/${project}/Embroidery},${workspace_loc\:/${project}/Connection},${workspace_loc\:/${project}/Integration} +paths.directoryPaths=${workspace_loc\:/${project}/Common},${workspace_loc\:/${project}/Jobs},${workspace_loc\:/${project}/Printing},${workspace_loc\:/${project}/ColorLab},${workspace_loc\:/${project}/Diagnostics},${workspace_loc\:/${project}/Debugging},${workspace_loc\:/${project}/Hardware},${workspace_loc\:/${project}/Embroidery},${workspace_loc\:/${project}/Connection},${workspace_loc\:/${project}/Integration},${workspace_loc\:/${project}/IO} paths.filesInMultipleDirectories=true paths.filesInOneDirectoryOnly=false diff --git a/Software/PMR/Messages/Common/MessageType.proto b/Software/PMR/Messages/Common/MessageType.proto index 55524dffc..c19bbc2d8 100644 --- a/Software/PMR/Messages/Common/MessageType.proto +++ b/Software/PMR/Messages/Common/MessageType.proto @@ -209,4 +209,12 @@ enum MessageType ExecuteProcessResponse = 7005; KillProcessRequest = 7006; KillProcessResponse = 7007; + CreateRequest = 7008; + CreateResponse = 7009; + DeleteRequest = 7010; + DeleteResponse = 7011; + GetStorageInfoRequest = 7012; + GetStorageInfoResponse = 7013; + GetFilesRequest = 7014; + GetFilesResponse = 7015; } diff --git a/Software/PMR/Messages/IO/CreateRequest.proto b/Software/PMR/Messages/IO/CreateRequest.proto new file mode 100644 index 000000000..236ec7f2b --- /dev/null +++ b/Software/PMR/Messages/IO/CreateRequest.proto @@ -0,0 +1,12 @@ +syntax = "proto3"; + +import "FileAttribute.proto"; + +package Tango.PMR.IO; +option java_package = "com.twine.tango.pmr.io"; + +message CreateRequest +{ + FileAttribute Attribute = 1; + string Path = 2; +} \ No newline at end of file diff --git a/Software/PMR/Messages/IO/CreateResponse.proto b/Software/PMR/Messages/IO/CreateResponse.proto new file mode 100644 index 000000000..afaa2c430 --- /dev/null +++ b/Software/PMR/Messages/IO/CreateResponse.proto @@ -0,0 +1,9 @@ +syntax = "proto3"; + +package Tango.PMR.IO; +option java_package = "com.twine.tango.pmr.io"; + +message CreateResponse +{ + +} \ No newline at end of file diff --git a/Software/PMR/Messages/IO/DeleteRequest.proto b/Software/PMR/Messages/IO/DeleteRequest.proto new file mode 100644 index 000000000..c385910f1 --- /dev/null +++ b/Software/PMR/Messages/IO/DeleteRequest.proto @@ -0,0 +1,9 @@ +syntax = "proto3"; + +package Tango.PMR.IO; +option java_package = "com.twine.tango.pmr.io"; + +message DeleteRequest +{ + string Path = 2; +} \ No newline at end of file diff --git a/Software/PMR/Messages/IO/DeleteResponse.proto b/Software/PMR/Messages/IO/DeleteResponse.proto new file mode 100644 index 000000000..76b0285ec --- /dev/null +++ b/Software/PMR/Messages/IO/DeleteResponse.proto @@ -0,0 +1,9 @@ +syntax = "proto3"; + +package Tango.PMR.IO; +option java_package = "com.twine.tango.pmr.io"; + +message DeleteResponse +{ + +} \ No newline at end of file diff --git a/Software/PMR/Messages/IO/FileAttribute.proto b/Software/PMR/Messages/IO/FileAttribute.proto new file mode 100644 index 000000000..baec75401 --- /dev/null +++ b/Software/PMR/Messages/IO/FileAttribute.proto @@ -0,0 +1,15 @@ +syntax = "proto3"; + +package Tango.PMR.IO; +option java_package = "com.twine.tango.pmr.io"; + +enum FileAttribute +{ + Unspecified = 0; + Archive = 0x20; + Directory = 0x10; + Hidden = 0x02; + ReadOnly = 0x01; + System = 0x04; + VolumeLabel = 0x08; +} \ No newline at end of file diff --git a/Software/PMR/Messages/IO/FileInfo.proto b/Software/PMR/Messages/IO/FileInfo.proto new file mode 100644 index 000000000..0a6581d02 --- /dev/null +++ b/Software/PMR/Messages/IO/FileInfo.proto @@ -0,0 +1,16 @@ +syntax = "proto3"; + +import "FileAttribute.proto"; + +package Tango.PMR.IO; +option java_package = "com.twine.tango.pmr.io"; + +message FileInfo +{ + string Name = 1; + string FullPath = 2; + int32 Length = 3; + int32 LastModifiedDate = 4; + int32 LastModifiedTime = 5; + FileAttribute Attribute = 6; +} \ No newline at end of file diff --git a/Software/PMR/Messages/IO/GetFilesRequest.proto b/Software/PMR/Messages/IO/GetFilesRequest.proto new file mode 100644 index 000000000..b9ae3b77b --- /dev/null +++ b/Software/PMR/Messages/IO/GetFilesRequest.proto @@ -0,0 +1,9 @@ +syntax = "proto3"; + +package Tango.PMR.IO; +option java_package = "com.twine.tango.pmr.io"; + +message GetFilesRequest +{ + string Path = 2; +} \ No newline at end of file diff --git a/Software/PMR/Messages/IO/GetFilesResponse.proto b/Software/PMR/Messages/IO/GetFilesResponse.proto new file mode 100644 index 000000000..c8cf50d60 --- /dev/null +++ b/Software/PMR/Messages/IO/GetFilesResponse.proto @@ -0,0 +1,11 @@ +syntax = "proto3"; + +import "FileInfo.proto"; + +package Tango.PMR.IO; +option java_package = "com.twine.tango.pmr.io"; + +message GetFilesResponse +{ + repeated FileInfo Items = 1; +} \ No newline at end of file diff --git a/Software/PMR/Messages/IO/GetStorageInfoRequest.proto b/Software/PMR/Messages/IO/GetStorageInfoRequest.proto new file mode 100644 index 000000000..edd287cc8 --- /dev/null +++ b/Software/PMR/Messages/IO/GetStorageInfoRequest.proto @@ -0,0 +1,10 @@ +syntax = "proto3"; + +package Tango.PMR.IO; +option java_package = "com.twine.tango.pmr.io"; + +message GetStorageInfoRequest +{ + int32 Capacity = 1; + int32 FreeSpace = 2; +} \ No newline at end of file diff --git a/Software/PMR/Messages/IO/GetStorageInfoResponse.proto b/Software/PMR/Messages/IO/GetStorageInfoResponse.proto new file mode 100644 index 000000000..80ef374bf --- /dev/null +++ b/Software/PMR/Messages/IO/GetStorageInfoResponse.proto @@ -0,0 +1,9 @@ +syntax = "proto3"; + +package Tango.PMR.IO; +option java_package = "com.twine.tango.pmr.io"; + +message GetStorageInfoResponse +{ + +} \ No newline at end of file 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 d4690c6b5..908a9fd38 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("3.5.52.18238")] +[assembly: AssemblyVersion("3.5.53.18238")] [assembly: ComVisible(false)] \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineConnectionViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineConnectionViewVM.cs index 51b7168ed..7737911e0 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineConnectionViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineConnectionViewVM.cs @@ -52,6 +52,8 @@ namespace Tango.MachineStudio.UI.ViewModels /// The scanner. public MachineConnectionViewVM(ExternalBridgeScanner scanner) { + EnableDiagnostics = true; + UploadHardwareConfiguration = true; Scanner = scanner; ConnectCommand = new RelayCommand(Connect, (x) => SelectedMachine != null); } @@ -97,5 +99,36 @@ namespace Tango.MachineStudio.UI.ViewModels Scanner.AvailableMachines.Add(_emulator); Scanner.Start(); } + + private bool _enableDiagnostics; + /// + /// Gets or sets a value indicating whether to enable diagnostics after connection. + /// + public bool EnableDiagnostics + { + get { return _enableDiagnostics; } + set { _enableDiagnostics = value; RaisePropertyChangedAuto(); } + } + + private bool _uploadHardwareConfiguration; + /// + /// Gets or sets a value indicating whether to upload hardware configuration after connection. + /// + public bool UploadHardwareConfiguration + { + get { return _uploadHardwareConfiguration; } + set { _uploadHardwareConfiguration = value; RaisePropertyChangedAuto(); } + } + + private bool _enableKeepAlive; + /// + /// Gets or sets a value indicating whether to use the keep alive mechanism. + /// + public bool EnableKeepAlive + { + get { return _enableKeepAlive; } + set { _enableKeepAlive = value; RaisePropertyChangedAuto(); } + } + } } 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 49a8ca807..9b625a6ee 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs @@ -445,6 +445,11 @@ namespace Tango.MachineStudio.UI.ViewModels } } + x.SelectedMachine.EnableDiagnostics = x.EnableDiagnostics; + x.SelectedMachine.EnableEmbeddedDebugging = x.EnableDiagnostics; + x.SelectedMachine.EnableEventsNotification = x.EnableDiagnostics; + x.SelectedMachine.UseKeepAlive = x.EnableKeepAlive; + if (x.SelectedMachine.RequiresAuthentication) { _notificationProvider.ShowModalDialog(async (login) => @@ -453,11 +458,6 @@ namespace Tango.MachineStudio.UI.ViewModels { try { - if (x.SelectedMachine.EnableDiagnostics) - { - x.SelectedMachine.EnableEmbeddedDebugging = true; - } - await x.SelectedMachine.As().Connect(new PMR.Integration.ExternalBridgeLoginRequest() { AppID = "Machine Studio", @@ -479,6 +479,11 @@ namespace Tango.MachineStudio.UI.ViewModels PostMessage(new MachineConnectionChangedMessage() { Machine = x.SelectedMachine }); _eventLogger.Log(String.Format("Successfully connected to machine {0} via TCP", x.SelectedMachine.SerialNumber)); + if (x.UploadHardwareConfiguration) + { + UploadHardwareConfiguration(); + } + } catch (ResponseErrorException ex) { @@ -507,11 +512,6 @@ namespace Tango.MachineStudio.UI.ViewModels { try { - if (x.SelectedMachine.EnableDiagnostics) - { - x.SelectedMachine.EnableEmbeddedDebugging = true; - } - await x.SelectedMachine.Connect(); x.SelectedMachine.SerialNumber = vm.SelectedMachine.SerialNumber; ApplicationManager.SetConnectedMachine(x.SelectedMachine); @@ -520,6 +520,11 @@ namespace Tango.MachineStudio.UI.ViewModels _eventLogger.Log(String.Format("Successfully connected to machine {0} via USB", x.SelectedMachine.SerialNumber)); _settings.LastVirtualMachineSerialNumber = vm.SelectedMachine.SerialNumber; _settings.Save(); + + if (x.UploadHardwareConfiguration) + { + UploadHardwareConfiguration(); + } } catch (Exception ex) { @@ -560,22 +565,7 @@ namespace Tango.MachineStudio.UI.ViewModels { using (NotificationProvider.PushTaskItem("Uploading hardware configuration...")) { - try - { - using (ObservablesContext db = ObservablesContext.CreateDefault()) - { - var config = db.Adapter.GetConfiguration(s => s.Guid == ApplicationManager.Machine.ConfigurationGuid); - var hw = db.Adapter.GetHardwareVersionByMachine(ApplicationManager.Machine.Guid); - - await ApplicationManager.ConnectedMachine.UploadHardwareConfiguration(hw, config); - } - NotificationProvider.ShowInfo("Hardware configuration uploaded successfully."); - } - catch (Exception ex) - { - LogManager.Log(ex, "Error uploading hardware configuration."); - NotificationProvider.ShowError("Error uploading hardware configuration." + Environment.NewLine + ex.Message); - } + UploadHardwareConfiguration(); } } } @@ -623,6 +613,26 @@ namespace Tango.MachineStudio.UI.ViewModels InvalidateRelayCommands(); } + private async void UploadHardwareConfiguration() + { + try + { + using (ObservablesContext db = ObservablesContext.CreateDefault()) + { + var config = db.Adapter.GetConfiguration(s => s.Guid == ApplicationManager.Machine.ConfigurationGuid); + var hw = db.Adapter.GetHardwareVersionByMachine(ApplicationManager.Machine.Guid); + + await ApplicationManager.ConnectedMachine.UploadHardwareConfiguration(hw, config); + } + NotificationProvider.ShowInfo("Hardware configuration uploaded successfully."); + } + catch (Exception ex) + { + LogManager.Log(ex, "Error uploading hardware configuration."); + NotificationProvider.ShowError("Error uploading hardware configuration." + Environment.NewLine + ex.Message); + } + } + /// /// Navigates to the home screen. /// diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineConnectionView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineConnectionView.xaml index 180a2a8e0..9794404b9 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineConnectionView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineConnectionView.xaml @@ -10,7 +10,7 @@ xmlns:emulations="clr-namespace:Tango.Emulations.ExternalBridge;assembly=Tango.Emulations" xmlns:local="clr-namespace:Tango.MachineStudio.UI.Views" mc:Ignorable="d" - d:DesignHeight="300" d:DesignWidth="300" Width="600" Height="400" Background="White" DataContext="{Binding MachineConnectionViewVM, Source={StaticResource Locator}}"> + d:DesignHeight="300" d:DesignWidth="300" Width="630" Height="400" Background="White" DataContext="{Binding MachineConnectionViewVM, Source={StaticResource Locator}}"> @@ -57,10 +57,6 @@ - - - Diagnostics/Debugging - @@ -79,10 +75,6 @@ - - - Diagnostics - @@ -98,10 +90,6 @@ - - - Diagnostics - @@ -123,6 +111,24 @@ + + + + + Diagnostics, Debug & Events + + + + + Upload HW Configuration + + + + + Keep Alive + + + diff --git a/Software/Visual_Studio/Tango.Integration/Operation/StorageManager.cs b/Software/Visual_Studio/Tango.Integration/Operation/StorageManager.cs new file mode 100644 index 000000000..f6b7e8d28 --- /dev/null +++ b/Software/Visual_Studio/Tango.Integration/Operation/StorageManager.cs @@ -0,0 +1,144 @@ +using Google.Protobuf; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core; +using Tango.Logging; +using Tango.PMR.IO; + +namespace Tango.Integration.Operation +{ + public class StorageManager : ExtendedObject + { + private IMachineOperator _operator; + + public StorageManager(IMachineOperator machineOperator) + { + _operator = machineOperator; + } + + private void EnsureOperator() + { + if (_operator.State != Transport.TransportComponentState.Connected) + { + throw new InvalidOperationException("Error executing storage command. Machine operator is not connected."); + } + } + + #region Private Methods + + /// + /// Logs the request sent. + /// + /// The message. + protected void LogRequestSent(IMessage message) + { + LogManager.Log(String.Format("Sending request '{0}'...{1}{2}", message.GetType().Name, Environment.NewLine, message.ToJsonString())); + } + + /// + /// Logs the request failed. + /// + /// The message. + protected void LogRequestFailed(IMessage message, Exception ex) + { + LogManager.Log(String.Format("Request failed '{0}'...{1}{2}{1}{3}", message.GetType().Name, Environment.NewLine, message.ToJsonString(), ex.ToString()), LogCategory.Error); + } + + /// + /// Logs the response received. + /// + /// The message. + protected void LogResponseReceived(IMessage message) + { + LogManager.Log(String.Format("Response received '{0}'...{1}{2}", message.GetType().Name, Environment.NewLine, message.ToJsonString())); + } + + #endregion + + public async Task Create(FileAttribute attr, String path, String name) + { + EnsureOperator(); + + CreateResponse response = null; + CreateRequest request = new CreateRequest() + { + Attribute = attr, + Path = path + "/" + name, + }; + + try + { + response = await _operator.SendRequest(request); + } + catch (Exception ex) + { + LogRequestFailed(request, ex); + throw ex; + } + } + + public async Task Delete(String path) + { + EnsureOperator(); + + DeleteResponse response = null; + DeleteRequest request = new DeleteRequest() + { + Path = path, + }; + + try + { + response = await _operator.SendRequest(request); + } + catch (Exception ex) + { + LogRequestFailed(request, ex); + throw ex; + } + } + + public async Task GetStorageInfo() + { + EnsureOperator(); + + GetStorageInfoResponse response = null; + GetStorageInfoRequest request = new GetStorageInfoRequest(); + + try + { + response = await _operator.SendRequest(request); + } + catch (Exception ex) + { + LogRequestFailed(request, ex); + throw ex; + } + + return response; + } + + public async Task> GetFiles(String path) + { + EnsureOperator(); + + GetFilesResponse response = null; + GetFilesRequest request = new GetFilesRequest(); + + try + { + response = await _operator.SendRequest(request); + } + catch (Exception ex) + { + LogRequestFailed(request, ex); + throw ex; + } + + return response.Items.ToList(); + } + } +} diff --git a/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj b/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj index 4606cf651..b6b1999cd 100644 --- a/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj +++ b/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj @@ -101,6 +101,7 @@ + @@ -151,7 +152,7 @@ - + \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.PMR/Common/MessageType.cs b/Software/Visual_Studio/Tango.PMR/Common/MessageType.cs index 94f4eba19..fa916a3a3 100644 --- a/Software/Visual_Studio/Tango.PMR/Common/MessageType.cs +++ b/Software/Visual_Studio/Tango.PMR/Common/MessageType.cs @@ -22,7 +22,7 @@ namespace Tango.PMR.Common { static MessageTypeReflection() { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( - "ChFNZXNzYWdlVHlwZS5wcm90bxIQVGFuZ28uUE1SLkNvbW1vbirdJwoLTWVz", + "ChFNZXNzYWdlVHlwZS5wcm90bxIQVGFuZ28uUE1SLkNvbW1vbiqVKQoLTWVz", "c2FnZVR5cGUSCAoETm9uZRAAEhEKDUVycm9yUmVzcG9uc2UQARIUChBDYWxj", "dWxhdGVSZXF1ZXN0EAMSFQoRQ2FsY3VsYXRlUmVzcG9uc2UQBBITCg9Qcm9n", "cmVzc1JlcXVlc3QQBRIUChBQcm9ncmVzc1Jlc3BvbnNlEAYSHAoYU3R1YkNh", @@ -135,8 +135,12 @@ namespace Tango.PMR.Common { "cG9uc2UQ2TYSGwoWRmlsZUNodW5rVXBsb2FkUmVxdWVzdBDaNhIcChdGaWxl", "Q2h1bmtVcGxvYWRSZXNwb25zZRDbNhIaChVFeGVjdXRlUHJvY2Vzc1JlcXVl", "c3QQ3DYSGwoWRXhlY3V0ZVByb2Nlc3NSZXNwb25zZRDdNhIXChJLaWxsUHJv", - "Y2Vzc1JlcXVlc3QQ3jYSGAoTS2lsbFByb2Nlc3NSZXNwb25zZRDfNkIcChpj", - "b20udHdpbmUudGFuZ28ucG1yLmNvbW1vbmIGcHJvdG8z")); + "Y2Vzc1JlcXVlc3QQ3jYSGAoTS2lsbFByb2Nlc3NSZXNwb25zZRDfNhISCg1D", + "cmVhdGVSZXF1ZXN0EOA2EhMKDkNyZWF0ZVJlc3BvbnNlEOE2EhIKDURlbGV0", + "ZVJlcXVlc3QQ4jYSEwoORGVsZXRlUmVzcG9uc2UQ4zYSGgoVR2V0U3RvcmFn", + "ZUluZm9SZXF1ZXN0EOQ2EhsKFkdldFN0b3JhZ2VJbmZvUmVzcG9uc2UQ5TYS", + "FAoPR2V0RmlsZXNSZXF1ZXN0EOY2EhUKEEdldEZpbGVzUmVzcG9uc2UQ5zZC", + "HAoaY29tLnR3aW5lLnRhbmdvLnBtci5jb21tb25iBnByb3RvMw==")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Tango.PMR.Common.MessageType), }, null)); @@ -351,6 +355,14 @@ namespace Tango.PMR.Common { [pbr::OriginalName("ExecuteProcessResponse")] ExecuteProcessResponse = 7005, [pbr::OriginalName("KillProcessRequest")] KillProcessRequest = 7006, [pbr::OriginalName("KillProcessResponse")] KillProcessResponse = 7007, + [pbr::OriginalName("CreateRequest")] CreateRequest = 7008, + [pbr::OriginalName("CreateResponse")] CreateResponse = 7009, + [pbr::OriginalName("DeleteRequest")] DeleteRequest = 7010, + [pbr::OriginalName("DeleteResponse")] DeleteResponse = 7011, + [pbr::OriginalName("GetStorageInfoRequest")] GetStorageInfoRequest = 7012, + [pbr::OriginalName("GetStorageInfoResponse")] GetStorageInfoResponse = 7013, + [pbr::OriginalName("GetFilesRequest")] GetFilesRequest = 7014, + [pbr::OriginalName("GetFilesResponse")] GetFilesResponse = 7015, } #endregion diff --git a/Software/Visual_Studio/Tango.PMR/IO/CreateRequest.cs b/Software/Visual_Studio/Tango.PMR/IO/CreateRequest.cs new file mode 100644 index 000000000..7ea620d55 --- /dev/null +++ b/Software/Visual_Studio/Tango.PMR/IO/CreateRequest.cs @@ -0,0 +1,188 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: CreateRequest.proto +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Tango.PMR.IO { + + /// Holder for reflection information generated from CreateRequest.proto + public static partial class CreateRequestReflection { + + #region Descriptor + /// File descriptor for CreateRequest.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static CreateRequestReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "ChNDcmVhdGVSZXF1ZXN0LnByb3RvEgxUYW5nby5QTVIuSU8aE0ZpbGVBdHRy", + "aWJ1dGUucHJvdG8iTQoNQ3JlYXRlUmVxdWVzdBIuCglBdHRyaWJ1dGUYASAB", + "KA4yGy5UYW5nby5QTVIuSU8uRmlsZUF0dHJpYnV0ZRIMCgRQYXRoGAIgASgJ", + "QhgKFmNvbS50d2luZS50YW5nby5wbXIuaW9iBnByb3RvMw==")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { global::Tango.PMR.IO.FileAttributeReflection.Descriptor, }, + new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.IO.CreateRequest), global::Tango.PMR.IO.CreateRequest.Parser, new[]{ "Attribute", "Path" }, null, null, null) + })); + } + #endregion + + } + #region Messages + public sealed partial class CreateRequest : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CreateRequest()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tango.PMR.IO.CreateRequestReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateRequest(CreateRequest other) : this() { + attribute_ = other.attribute_; + path_ = other.path_; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateRequest Clone() { + return new CreateRequest(this); + } + + /// Field number for the "Attribute" field. + public const int AttributeFieldNumber = 1; + private global::Tango.PMR.IO.FileAttribute attribute_ = 0; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Tango.PMR.IO.FileAttribute Attribute { + get { return attribute_; } + set { + attribute_ = value; + } + } + + /// Field number for the "Path" field. + public const int PathFieldNumber = 2; + private string path_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Path { + get { return path_; } + set { + path_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as CreateRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(CreateRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Attribute != other.Attribute) return false; + if (Path != other.Path) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Attribute != 0) hash ^= Attribute.GetHashCode(); + if (Path.Length != 0) hash ^= Path.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Attribute != 0) { + output.WriteRawTag(8); + output.WriteEnum((int) Attribute); + } + if (Path.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Path); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Attribute != 0) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Attribute); + } + if (Path.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Path); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(CreateRequest other) { + if (other == null) { + return; + } + if (other.Attribute != 0) { + Attribute = other.Attribute; + } + if (other.Path.Length != 0) { + Path = other.Path; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 8: { + attribute_ = (global::Tango.PMR.IO.FileAttribute) input.ReadEnum(); + break; + } + case 18: { + Path = input.ReadString(); + break; + } + } + } + } + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/Software/Visual_Studio/Tango.PMR/IO/CreateResponse.cs b/Software/Visual_Studio/Tango.PMR/IO/CreateResponse.cs new file mode 100644 index 000000000..8f68f7806 --- /dev/null +++ b/Software/Visual_Studio/Tango.PMR/IO/CreateResponse.cs @@ -0,0 +1,130 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: CreateResponse.proto +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Tango.PMR.IO { + + /// Holder for reflection information generated from CreateResponse.proto + public static partial class CreateResponseReflection { + + #region Descriptor + /// File descriptor for CreateResponse.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static CreateResponseReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "ChRDcmVhdGVSZXNwb25zZS5wcm90bxIMVGFuZ28uUE1SLklPIhAKDkNyZWF0", + "ZVJlc3BvbnNlQhgKFmNvbS50d2luZS50YW5nby5wbXIuaW9iBnByb3RvMw==")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { }, + new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.IO.CreateResponse), global::Tango.PMR.IO.CreateResponse.Parser, null, null, null, null) + })); + } + #endregion + + } + #region Messages + public sealed partial class CreateResponse : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CreateResponse()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tango.PMR.IO.CreateResponseReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateResponse(CreateResponse other) : this() { + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateResponse Clone() { + return new CreateResponse(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as CreateResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(CreateResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(CreateResponse other) { + if (other == null) { + return; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + } + } + } + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/Software/Visual_Studio/Tango.PMR/IO/DeleteRequest.cs b/Software/Visual_Studio/Tango.PMR/IO/DeleteRequest.cs new file mode 100644 index 000000000..8afea70c7 --- /dev/null +++ b/Software/Visual_Studio/Tango.PMR/IO/DeleteRequest.cs @@ -0,0 +1,159 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: DeleteRequest.proto +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Tango.PMR.IO { + + /// Holder for reflection information generated from DeleteRequest.proto + public static partial class DeleteRequestReflection { + + #region Descriptor + /// File descriptor for DeleteRequest.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static DeleteRequestReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "ChNEZWxldGVSZXF1ZXN0LnByb3RvEgxUYW5nby5QTVIuSU8iHQoNRGVsZXRl", + "UmVxdWVzdBIMCgRQYXRoGAIgASgJQhgKFmNvbS50d2luZS50YW5nby5wbXIu", + "aW9iBnByb3RvMw==")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { }, + new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.IO.DeleteRequest), global::Tango.PMR.IO.DeleteRequest.Parser, new[]{ "Path" }, null, null, null) + })); + } + #endregion + + } + #region Messages + public sealed partial class DeleteRequest : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DeleteRequest()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tango.PMR.IO.DeleteRequestReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DeleteRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DeleteRequest(DeleteRequest other) : this() { + path_ = other.path_; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DeleteRequest Clone() { + return new DeleteRequest(this); + } + + /// Field number for the "Path" field. + public const int PathFieldNumber = 2; + private string path_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Path { + get { return path_; } + set { + path_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as DeleteRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(DeleteRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Path != other.Path) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Path.Length != 0) hash ^= Path.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Path.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Path); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Path.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Path); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(DeleteRequest other) { + if (other == null) { + return; + } + if (other.Path.Length != 0) { + Path = other.Path; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 18: { + Path = input.ReadString(); + break; + } + } + } + } + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/Software/Visual_Studio/Tango.PMR/IO/DeleteResponse.cs b/Software/Visual_Studio/Tango.PMR/IO/DeleteResponse.cs new file mode 100644 index 000000000..29af47fd9 --- /dev/null +++ b/Software/Visual_Studio/Tango.PMR/IO/DeleteResponse.cs @@ -0,0 +1,130 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: DeleteResponse.proto +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Tango.PMR.IO { + + /// Holder for reflection information generated from DeleteResponse.proto + public static partial class DeleteResponseReflection { + + #region Descriptor + /// File descriptor for DeleteResponse.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static DeleteResponseReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "ChREZWxldGVSZXNwb25zZS5wcm90bxIMVGFuZ28uUE1SLklPIhAKDkRlbGV0", + "ZVJlc3BvbnNlQhgKFmNvbS50d2luZS50YW5nby5wbXIuaW9iBnByb3RvMw==")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { }, + new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.IO.DeleteResponse), global::Tango.PMR.IO.DeleteResponse.Parser, null, null, null, null) + })); + } + #endregion + + } + #region Messages + public sealed partial class DeleteResponse : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DeleteResponse()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tango.PMR.IO.DeleteResponseReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DeleteResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DeleteResponse(DeleteResponse other) : this() { + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DeleteResponse Clone() { + return new DeleteResponse(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as DeleteResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(DeleteResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(DeleteResponse other) { + if (other == null) { + return; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + } + } + } + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/Software/Visual_Studio/Tango.PMR/IO/FileAttribute.cs b/Software/Visual_Studio/Tango.PMR/IO/FileAttribute.cs new file mode 100644 index 000000000..efbbbfd48 --- /dev/null +++ b/Software/Visual_Studio/Tango.PMR/IO/FileAttribute.cs @@ -0,0 +1,52 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: FileAttribute.proto +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Tango.PMR.IO { + + /// Holder for reflection information generated from FileAttribute.proto + public static partial class FileAttributeReflection { + + #region Descriptor + /// File descriptor for FileAttribute.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static FileAttributeReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "ChNGaWxlQXR0cmlidXRlLnByb3RvEgxUYW5nby5QTVIuSU8qcwoNRmlsZUF0", + "dHJpYnV0ZRIPCgtVbnNwZWNpZmllZBAAEgsKB0FyY2hpdmUQIBINCglEaXJl", + "Y3RvcnkQEBIKCgZIaWRkZW4QAhIMCghSZWFkT25seRABEgoKBlN5c3RlbRAE", + "Eg8KC1ZvbHVtZUxhYmVsEAhCGAoWY29tLnR3aW5lLnRhbmdvLnBtci5pb2IG", + "cHJvdG8z")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { }, + new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Tango.PMR.IO.FileAttribute), }, null)); + } + #endregion + + } + #region Enums + public enum FileAttribute { + [pbr::OriginalName("Unspecified")] Unspecified = 0, + [pbr::OriginalName("Archive")] Archive = 32, + [pbr::OriginalName("Directory")] Directory = 16, + [pbr::OriginalName("Hidden")] Hidden = 2, + [pbr::OriginalName("ReadOnly")] ReadOnly = 1, + [pbr::OriginalName("System")] System = 4, + [pbr::OriginalName("VolumeLabel")] VolumeLabel = 8, + } + + #endregion + +} + +#endregion Designer generated code diff --git a/Software/Visual_Studio/Tango.PMR/IO/FileInfo.cs b/Software/Visual_Studio/Tango.PMR/IO/FileInfo.cs new file mode 100644 index 000000000..d6c1b7fbd --- /dev/null +++ b/Software/Visual_Studio/Tango.PMR/IO/FileInfo.cs @@ -0,0 +1,302 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: FileInfo.proto +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Tango.PMR.IO { + + /// Holder for reflection information generated from FileInfo.proto + public static partial class FileInfoReflection { + + #region Descriptor + /// File descriptor for FileInfo.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static FileInfoReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "Cg5GaWxlSW5mby5wcm90bxIMVGFuZ28uUE1SLklPGhNGaWxlQXR0cmlidXRl", + "LnByb3RvIp4BCghGaWxlSW5mbxIMCgROYW1lGAEgASgJEhAKCEZ1bGxQYXRo", + "GAIgASgJEg4KBkxlbmd0aBgDIAEoBRIYChBMYXN0TW9kaWZpZWREYXRlGAQg", + "ASgFEhgKEExhc3RNb2RpZmllZFRpbWUYBSABKAUSLgoJQXR0cmlidXRlGAYg", + "ASgOMhsuVGFuZ28uUE1SLklPLkZpbGVBdHRyaWJ1dGVCGAoWY29tLnR3aW5l", + "LnRhbmdvLnBtci5pb2IGcHJvdG8z")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { global::Tango.PMR.IO.FileAttributeReflection.Descriptor, }, + new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.IO.FileInfo), global::Tango.PMR.IO.FileInfo.Parser, new[]{ "Name", "FullPath", "Length", "LastModifiedDate", "LastModifiedTime", "Attribute" }, null, null, null) + })); + } + #endregion + + } + #region Messages + public sealed partial class FileInfo : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new FileInfo()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tango.PMR.IO.FileInfoReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public FileInfo() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public FileInfo(FileInfo other) : this() { + name_ = other.name_; + fullPath_ = other.fullPath_; + length_ = other.length_; + lastModifiedDate_ = other.lastModifiedDate_; + lastModifiedTime_ = other.lastModifiedTime_; + attribute_ = other.attribute_; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public FileInfo Clone() { + return new FileInfo(this); + } + + /// Field number for the "Name" field. + public const int NameFieldNumber = 1; + private string name_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Name { + get { return name_; } + set { + name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "FullPath" field. + public const int FullPathFieldNumber = 2; + private string fullPath_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string FullPath { + get { return fullPath_; } + set { + fullPath_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Length" field. + public const int LengthFieldNumber = 3; + private int length_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Length { + get { return length_; } + set { + length_ = value; + } + } + + /// Field number for the "LastModifiedDate" field. + public const int LastModifiedDateFieldNumber = 4; + private int lastModifiedDate_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int LastModifiedDate { + get { return lastModifiedDate_; } + set { + lastModifiedDate_ = value; + } + } + + /// Field number for the "LastModifiedTime" field. + public const int LastModifiedTimeFieldNumber = 5; + private int lastModifiedTime_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int LastModifiedTime { + get { return lastModifiedTime_; } + set { + lastModifiedTime_ = value; + } + } + + /// Field number for the "Attribute" field. + public const int AttributeFieldNumber = 6; + private global::Tango.PMR.IO.FileAttribute attribute_ = 0; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Tango.PMR.IO.FileAttribute Attribute { + get { return attribute_; } + set { + attribute_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as FileInfo); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(FileInfo other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Name != other.Name) return false; + if (FullPath != other.FullPath) return false; + if (Length != other.Length) return false; + if (LastModifiedDate != other.LastModifiedDate) return false; + if (LastModifiedTime != other.LastModifiedTime) return false; + if (Attribute != other.Attribute) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Name.Length != 0) hash ^= Name.GetHashCode(); + if (FullPath.Length != 0) hash ^= FullPath.GetHashCode(); + if (Length != 0) hash ^= Length.GetHashCode(); + if (LastModifiedDate != 0) hash ^= LastModifiedDate.GetHashCode(); + if (LastModifiedTime != 0) hash ^= LastModifiedTime.GetHashCode(); + if (Attribute != 0) hash ^= Attribute.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Name.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Name); + } + if (FullPath.Length != 0) { + output.WriteRawTag(18); + output.WriteString(FullPath); + } + if (Length != 0) { + output.WriteRawTag(24); + output.WriteInt32(Length); + } + if (LastModifiedDate != 0) { + output.WriteRawTag(32); + output.WriteInt32(LastModifiedDate); + } + if (LastModifiedTime != 0) { + output.WriteRawTag(40); + output.WriteInt32(LastModifiedTime); + } + if (Attribute != 0) { + output.WriteRawTag(48); + output.WriteEnum((int) Attribute); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Name.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); + } + if (FullPath.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(FullPath); + } + if (Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Length); + } + if (LastModifiedDate != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(LastModifiedDate); + } + if (LastModifiedTime != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(LastModifiedTime); + } + if (Attribute != 0) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Attribute); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(FileInfo other) { + if (other == null) { + return; + } + if (other.Name.Length != 0) { + Name = other.Name; + } + if (other.FullPath.Length != 0) { + FullPath = other.FullPath; + } + if (other.Length != 0) { + Length = other.Length; + } + if (other.LastModifiedDate != 0) { + LastModifiedDate = other.LastModifiedDate; + } + if (other.LastModifiedTime != 0) { + LastModifiedTime = other.LastModifiedTime; + } + if (other.Attribute != 0) { + Attribute = other.Attribute; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 10: { + Name = input.ReadString(); + break; + } + case 18: { + FullPath = input.ReadString(); + break; + } + case 24: { + Length = input.ReadInt32(); + break; + } + case 32: { + LastModifiedDate = input.ReadInt32(); + break; + } + case 40: { + LastModifiedTime = input.ReadInt32(); + break; + } + case 48: { + attribute_ = (global::Tango.PMR.IO.FileAttribute) input.ReadEnum(); + break; + } + } + } + } + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/Software/Visual_Studio/Tango.PMR/IO/GetFilesRequest.cs b/Software/Visual_Studio/Tango.PMR/IO/GetFilesRequest.cs new file mode 100644 index 000000000..1696713ac --- /dev/null +++ b/Software/Visual_Studio/Tango.PMR/IO/GetFilesRequest.cs @@ -0,0 +1,159 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: GetFilesRequest.proto +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Tango.PMR.IO { + + /// Holder for reflection information generated from GetFilesRequest.proto + public static partial class GetFilesRequestReflection { + + #region Descriptor + /// File descriptor for GetFilesRequest.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static GetFilesRequestReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "ChVHZXRGaWxlc1JlcXVlc3QucHJvdG8SDFRhbmdvLlBNUi5JTyIfCg9HZXRG", + "aWxlc1JlcXVlc3QSDAoEUGF0aBgCIAEoCUIYChZjb20udHdpbmUudGFuZ28u", + "cG1yLmlvYgZwcm90bzM=")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { }, + new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.IO.GetFilesRequest), global::Tango.PMR.IO.GetFilesRequest.Parser, new[]{ "Path" }, null, null, null) + })); + } + #endregion + + } + #region Messages + public sealed partial class GetFilesRequest : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new GetFilesRequest()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tango.PMR.IO.GetFilesRequestReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public GetFilesRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public GetFilesRequest(GetFilesRequest other) : this() { + path_ = other.path_; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public GetFilesRequest Clone() { + return new GetFilesRequest(this); + } + + /// Field number for the "Path" field. + public const int PathFieldNumber = 2; + private string path_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Path { + get { return path_; } + set { + path_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as GetFilesRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(GetFilesRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Path != other.Path) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Path.Length != 0) hash ^= Path.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Path.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Path); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Path.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Path); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(GetFilesRequest other) { + if (other == null) { + return; + } + if (other.Path.Length != 0) { + Path = other.Path; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 18: { + Path = input.ReadString(); + break; + } + } + } + } + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/Software/Visual_Studio/Tango.PMR/IO/GetFilesResponse.cs b/Software/Visual_Studio/Tango.PMR/IO/GetFilesResponse.cs new file mode 100644 index 000000000..f6193d9b4 --- /dev/null +++ b/Software/Visual_Studio/Tango.PMR/IO/GetFilesResponse.cs @@ -0,0 +1,152 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: GetFilesResponse.proto +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Tango.PMR.IO { + + /// Holder for reflection information generated from GetFilesResponse.proto + public static partial class GetFilesResponseReflection { + + #region Descriptor + /// File descriptor for GetFilesResponse.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static GetFilesResponseReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "ChZHZXRGaWxlc1Jlc3BvbnNlLnByb3RvEgxUYW5nby5QTVIuSU8aDkZpbGVJ", + "bmZvLnByb3RvIjkKEEdldEZpbGVzUmVzcG9uc2USJQoFSXRlbXMYASADKAsy", + "Fi5UYW5nby5QTVIuSU8uRmlsZUluZm9CGAoWY29tLnR3aW5lLnRhbmdvLnBt", + "ci5pb2IGcHJvdG8z")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { global::Tango.PMR.IO.FileInfoReflection.Descriptor, }, + new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.IO.GetFilesResponse), global::Tango.PMR.IO.GetFilesResponse.Parser, new[]{ "Items" }, null, null, null) + })); + } + #endregion + + } + #region Messages + public sealed partial class GetFilesResponse : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new GetFilesResponse()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tango.PMR.IO.GetFilesResponseReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public GetFilesResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public GetFilesResponse(GetFilesResponse other) : this() { + items_ = other.items_.Clone(); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public GetFilesResponse Clone() { + return new GetFilesResponse(this); + } + + /// Field number for the "Items" field. + public const int ItemsFieldNumber = 1; + private static readonly pb::FieldCodec _repeated_items_codec + = pb::FieldCodec.ForMessage(10, global::Tango.PMR.IO.FileInfo.Parser); + private readonly pbc::RepeatedField items_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField Items { + get { return items_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as GetFilesResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(GetFilesResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if(!items_.Equals(other.items_)) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + hash ^= items_.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + items_.WriteTo(output, _repeated_items_codec); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + size += items_.CalculateSize(_repeated_items_codec); + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(GetFilesResponse other) { + if (other == null) { + return; + } + items_.Add(other.items_); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 10: { + items_.AddEntriesFrom(input, _repeated_items_codec); + break; + } + } + } + } + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/Software/Visual_Studio/Tango.PMR/IO/GetStorageInfoRequest.cs b/Software/Visual_Studio/Tango.PMR/IO/GetStorageInfoRequest.cs new file mode 100644 index 000000000..ae06664ae --- /dev/null +++ b/Software/Visual_Studio/Tango.PMR/IO/GetStorageInfoRequest.cs @@ -0,0 +1,188 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: GetStorageInfoRequest.proto +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Tango.PMR.IO { + + /// Holder for reflection information generated from GetStorageInfoRequest.proto + public static partial class GetStorageInfoRequestReflection { + + #region Descriptor + /// File descriptor for GetStorageInfoRequest.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static GetStorageInfoRequestReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "ChtHZXRTdG9yYWdlSW5mb1JlcXVlc3QucHJvdG8SDFRhbmdvLlBNUi5JTyI8", + "ChVHZXRTdG9yYWdlSW5mb1JlcXVlc3QSEAoIQ2FwYWNpdHkYASABKAUSEQoJ", + "RnJlZVNwYWNlGAIgASgFQhgKFmNvbS50d2luZS50YW5nby5wbXIuaW9iBnBy", + "b3RvMw==")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { }, + new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.IO.GetStorageInfoRequest), global::Tango.PMR.IO.GetStorageInfoRequest.Parser, new[]{ "Capacity", "FreeSpace" }, null, null, null) + })); + } + #endregion + + } + #region Messages + public sealed partial class GetStorageInfoRequest : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new GetStorageInfoRequest()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tango.PMR.IO.GetStorageInfoRequestReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public GetStorageInfoRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public GetStorageInfoRequest(GetStorageInfoRequest other) : this() { + capacity_ = other.capacity_; + freeSpace_ = other.freeSpace_; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public GetStorageInfoRequest Clone() { + return new GetStorageInfoRequest(this); + } + + /// Field number for the "Capacity" field. + public const int CapacityFieldNumber = 1; + private int capacity_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Capacity { + get { return capacity_; } + set { + capacity_ = value; + } + } + + /// Field number for the "FreeSpace" field. + public const int FreeSpaceFieldNumber = 2; + private int freeSpace_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int FreeSpace { + get { return freeSpace_; } + set { + freeSpace_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as GetStorageInfoRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(GetStorageInfoRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Capacity != other.Capacity) return false; + if (FreeSpace != other.FreeSpace) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Capacity != 0) hash ^= Capacity.GetHashCode(); + if (FreeSpace != 0) hash ^= FreeSpace.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Capacity != 0) { + output.WriteRawTag(8); + output.WriteInt32(Capacity); + } + if (FreeSpace != 0) { + output.WriteRawTag(16); + output.WriteInt32(FreeSpace); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Capacity != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Capacity); + } + if (FreeSpace != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(FreeSpace); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(GetStorageInfoRequest other) { + if (other == null) { + return; + } + if (other.Capacity != 0) { + Capacity = other.Capacity; + } + if (other.FreeSpace != 0) { + FreeSpace = other.FreeSpace; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 8: { + Capacity = input.ReadInt32(); + break; + } + case 16: { + FreeSpace = input.ReadInt32(); + break; + } + } + } + } + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/Software/Visual_Studio/Tango.PMR/IO/GetStorageInfoResponse.cs b/Software/Visual_Studio/Tango.PMR/IO/GetStorageInfoResponse.cs new file mode 100644 index 000000000..13152184d --- /dev/null +++ b/Software/Visual_Studio/Tango.PMR/IO/GetStorageInfoResponse.cs @@ -0,0 +1,131 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: GetStorageInfoResponse.proto +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Tango.PMR.IO { + + /// Holder for reflection information generated from GetStorageInfoResponse.proto + public static partial class GetStorageInfoResponseReflection { + + #region Descriptor + /// File descriptor for GetStorageInfoResponse.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static GetStorageInfoResponseReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "ChxHZXRTdG9yYWdlSW5mb1Jlc3BvbnNlLnByb3RvEgxUYW5nby5QTVIuSU8i", + "GAoWR2V0U3RvcmFnZUluZm9SZXNwb25zZUIYChZjb20udHdpbmUudGFuZ28u", + "cG1yLmlvYgZwcm90bzM=")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { }, + new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.IO.GetStorageInfoResponse), global::Tango.PMR.IO.GetStorageInfoResponse.Parser, null, null, null, null) + })); + } + #endregion + + } + #region Messages + public sealed partial class GetStorageInfoResponse : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new GetStorageInfoResponse()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tango.PMR.IO.GetStorageInfoResponseReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public GetStorageInfoResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public GetStorageInfoResponse(GetStorageInfoResponse other) : this() { + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public GetStorageInfoResponse Clone() { + return new GetStorageInfoResponse(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as GetStorageInfoResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(GetStorageInfoResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(GetStorageInfoResponse other) { + if (other == null) { + return; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + } + } + } + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj b/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj index 3d899e2bc..87a071833 100644 --- a/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj +++ b/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj @@ -168,12 +168,22 @@ + + + + + + + + + + @@ -230,7 +240,7 @@ - + \ No newline at end of file -- cgit v1.3.1 From a4f4b3be2917b13667217cf826c21e8bd644a8c4 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Wed, 24 Oct 2018 11:38:25 +0300 Subject: Machine Studio v3.5.54 --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 15400960 -> 15400960 bytes .../Build/Shortcuts/Machine Emulator.lnk | Bin 1471 -> 1471 bytes .../Build/Shortcuts/Machine Studio.lnk | Bin 1532 -> 1532 bytes .../Build/Shortcuts/Proto Compiler GUI.lnk | Bin 1464 -> 1464 bytes .../Build/Shortcuts/Stubs Execution GUI.lnk | Bin 1547 -> 1470 bytes .../Build/Shortcuts/Transport Router.lnk | Bin 1578 -> 1509 bytes .../ColorLabModuleSettings.cs | 15 +++ .../Tango.MachineStudio.ColorLab.csproj | 3 +- .../ViewModels/MainViewVM.cs | 146 +++++++++++++++------ .../Properties/AssemblyInfo.cs | 2 +- .../Tango.BL/ObservablesContextExtension.cs | 2 +- .../Tango.UnitTesting/RemoteRunner_TST.cs | 2 +- .../Tango.BuildExtensions/RemoteDebugCommand.cs | 2 +- 14 files changed, 124 insertions(+), 48 deletions(-) create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ColorLabModuleSettings.cs (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index 612f1a5ad..f14509fff 100644 Binary files a/Software/DB/Tango.mdf and b/Software/DB/Tango.mdf differ diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf index eeb01f600..e3144956b 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/Visual_Studio/Build/Shortcuts/Machine Emulator.lnk b/Software/Visual_Studio/Build/Shortcuts/Machine Emulator.lnk index 1703261ab..809dc39a4 100644 Binary files a/Software/Visual_Studio/Build/Shortcuts/Machine Emulator.lnk and b/Software/Visual_Studio/Build/Shortcuts/Machine Emulator.lnk differ diff --git a/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk b/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk index 5eeb24ff5..aaa476b0b 100644 Binary files a/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk and b/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk differ diff --git a/Software/Visual_Studio/Build/Shortcuts/Proto Compiler GUI.lnk b/Software/Visual_Studio/Build/Shortcuts/Proto Compiler GUI.lnk index ad0bef18d..349e9582e 100644 Binary files a/Software/Visual_Studio/Build/Shortcuts/Proto Compiler GUI.lnk and b/Software/Visual_Studio/Build/Shortcuts/Proto Compiler GUI.lnk differ diff --git a/Software/Visual_Studio/Build/Shortcuts/Stubs Execution GUI.lnk b/Software/Visual_Studio/Build/Shortcuts/Stubs Execution GUI.lnk index 4e589813f..9f3dea7c6 100644 Binary files a/Software/Visual_Studio/Build/Shortcuts/Stubs Execution GUI.lnk and b/Software/Visual_Studio/Build/Shortcuts/Stubs Execution GUI.lnk differ diff --git a/Software/Visual_Studio/Build/Shortcuts/Transport Router.lnk b/Software/Visual_Studio/Build/Shortcuts/Transport Router.lnk index 4be815508..197c90696 100644 Binary files a/Software/Visual_Studio/Build/Shortcuts/Transport Router.lnk and b/Software/Visual_Studio/Build/Shortcuts/Transport Router.lnk differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ColorLabModuleSettings.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ColorLabModuleSettings.cs new file mode 100644 index 000000000..e2413f22b --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ColorLabModuleSettings.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Settings; + +namespace Tango.MachineStudio.ColorLab +{ + public class ColorLabModuleSettings : SettingsBase + { + public String LastMachineSerialNumber { get; set; } + public String LastRmlGuid { get; set; } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Tango.MachineStudio.ColorLab.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Tango.MachineStudio.ColorLab.csproj index 64caa2a1d..080d35f5e 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Tango.MachineStudio.ColorLab.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Tango.MachineStudio.ColorLab.csproj @@ -72,6 +72,7 @@ GlobalVersionInfo.cs + @@ -195,7 +196,7 @@ - + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/MainViewVM.cs index d264dd209..58b264d41 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/MainViewVM.cs @@ -20,6 +20,7 @@ using Tango.MachineStudio.Common.Controls; using Tango.MachineStudio.Common.Notifications; using Tango.PMR; using Tango.PMR.ColorLab; +using Tango.Settings; using Tango.SharedUI; using Tango.SharedUI.Controls; @@ -283,9 +284,9 @@ namespace Tango.MachineStudio.ColorLab.ViewModels #region Application Ready - public override void OnApplicationReady() + public async override void OnApplicationReady() { - Task.Factory.StartNew(() => + await Task.Factory.StartNew(() => { _dbContext = ObservablesContext.CreateDefault(); @@ -293,6 +294,25 @@ namespace Tango.MachineStudio.ColorLab.ViewModels ColorSpaces = _dbContext.ColorSpaces.ToObservableCollection(); Rmls = _dbContext.Rmls.ToObservableCollection(); }); + + var settings = SettingsManager.Default.GetOrCreate(); + + try + { + if (settings.LastMachineSerialNumber != null) + { + SelectedMachine = Machines.SingleOrDefault(x => x.SerialNumber == settings.LastMachineSerialNumber); + + if (settings.LastRmlGuid != null) + { + SelectedRML = Rmls.SingleOrDefault(x => x.Guid == settings.LastRmlGuid); + } + } + } + catch (Exception ex) + { + LogManager.Log(ex, "Error loading last selected machine or RML."); + } } #endregion @@ -303,48 +323,55 @@ namespace Tango.MachineStudio.ColorLab.ViewModels { Task.Factory.StartNew(() => { - if (LiquidsCalibrationData == null || CCT.ForwardData == null) return; - - ConversionInput input = new ConversionInput(); - input.ColorSpace = SourceColor.IsLab ? PMR.ColorLab.ColorSpace.Lab : PMR.ColorLab.ColorSpace.Rgb; - input.DeltaChroma = DeltaChroma; - input.DeltaL = DeltaL; - input.ForwardData = ByteString.CopyFrom(CCT.ForwardData); - - input.InputCoordinates = new InputCoordinates(); - input.InputCoordinates.Red = (int)SourceColor.Red; - input.InputCoordinates.Green = (int)SourceColor.Green; - input.InputCoordinates.Blue = (int)SourceColor.Blue; - input.InputCoordinates.L = SourceColor.L; - input.InputCoordinates.A = SourceColor.A; - input.InputCoordinates.B = SourceColor.B; - input.ThreadL = 92.1815; //SelectedRML.MediaColor.L; - input.ThreadA = 2.2555; //SelectedRML.MediaColor.A; - input.ThreadB = -10.9325; //SelectedRML.MediaColor.B; - - foreach (var vm in LiquidsCalibrationData) + try { - InputLiquid inputLiquid = new InputLiquid(); + if (LiquidsCalibrationData == null || CCT.ForwardData == null) return; + + ConversionInput input = new ConversionInput(); + input.ColorSpace = SourceColor.IsLab ? PMR.ColorLab.ColorSpace.Lab : PMR.ColorLab.ColorSpace.Rgb; + input.DeltaChroma = DeltaChroma; + input.DeltaL = DeltaL; + input.ForwardData = ByteString.CopyFrom(CCT.ForwardData); + + input.InputCoordinates = new InputCoordinates(); + input.InputCoordinates.Red = (int)SourceColor.Red; + input.InputCoordinates.Green = (int)SourceColor.Green; + input.InputCoordinates.Blue = (int)SourceColor.Blue; + input.InputCoordinates.L = SourceColor.L; + input.InputCoordinates.A = SourceColor.A; + input.InputCoordinates.B = SourceColor.B; + input.ThreadL = 92.1815; //SelectedRML.MediaColor.L; + input.ThreadA = 2.2555; //SelectedRML.MediaColor.A; + input.ThreadB = -10.9325; //SelectedRML.MediaColor.B; + + foreach (var vm in LiquidsCalibrationData) + { + InputLiquid inputLiquid = new InputLiquid(); - //TODO: Use the real calibration data... - //CalibrationData calData = new CalibrationData(); - //calData.LiquidType = (PMR.ColorLab.LiquidType)vm.IdsPack.LiquidType.Code; - //calData.CalibrationPoints.AddRange(vm.CalibrationPoints.Select(x => new CalibrationPoint() { X = x.X, Y = x.Y })); + CalibrationData calData = new CalibrationData(); + calData.LiquidType = (PMR.ColorLab.LiquidType)vm.IdsPack.LiquidType.Code; + calData.CalibrationPoints.AddRange(vm.CalibrationPoints.Select(x => new CalibrationPoint() { X = x.X, Y = x.Y })); - inputLiquid.CalibrationData = Cat.CreateDemoCalibrationData((PMR.ColorLab.LiquidType)vm.LiquidType.Code); + inputLiquid.CalibrationData = calData; - inputLiquid.LiquidType = (PMR.ColorLab.LiquidType)vm.LiquidType.Code; - inputLiquid.MaxNanoliterPerCentimeter = LiquidTypesRmls.SingleOrDefault(x => x.LiquidType.Code == vm.LiquidType.Code).MaxNlPerCm; + inputLiquid.LiquidType = (PMR.ColorLab.LiquidType)vm.LiquidType.Code; + inputLiquid.MaxNanoliterPerCentimeter = LiquidTypesRmls.SingleOrDefault(x => x.LiquidType.Code == vm.LiquidType.Code).MaxNlPerCm; - input.InputCoordinates.InputLiquids.Add(inputLiquid); - } + input.InputCoordinates.InputLiquids.Add(inputLiquid); + } - var output = TangoColorConverter.GetSuggestions(input); + var output = TangoColorConverter.GetSuggestions(input); - IsOutOfGamut = output.OutOfGamut; + IsOutOfGamut = output.OutOfGamut; - HiveSuggestions = TangoColorConverter.CreateHiveSuggestions(output); + HiveSuggestions = TangoColorConverter.CreateHiveSuggestions(output); + } + catch (Exception ex) + { + LogManager.Log(ex, "Error in color conversion."); + _notification.ShowError($"An error occurred while trying to convert from source color to Volume.\n" + ex.Message); + } }); } @@ -497,7 +524,7 @@ namespace Tango.MachineStudio.ColorLab.ViewModels if (LiquidsCalibrationData == null || _prevent_inverse_conversion) return; //TODO: This is temporary because of out of range volumes. - if (LiquidVolumes.Where(x => x.IdsPack.IdsPackFormula.Code == IdsPackFormulas.StandardColor.ToInt32()).Sum(x => x.Volume) > 200) + if (LiquidVolumes.Where(x => x.IdsPack.IdsPackFormula.Code == IdsPackFormulas.StandardColor.ToInt32()).Sum(x => x.Volume) > 100) { IsVolumesOutOfRange = true; return; @@ -522,13 +549,11 @@ namespace Tango.MachineStudio.ColorLab.ViewModels { InputLiquid inputLiquid = new InputLiquid(); - //TODO: Use the real calibration data... - - //CalibrationData calData = new CalibrationData(); - //calData.LiquidType = (PMR.ColorLab.LiquidType)vm.IdsPack.LiquidType.Code; - //calData.CalibrationPoints.AddRange(vm.CalibrationPoints.Select(x => new CalibrationPoint() { X = x.X, Y = x.Y })); + CalibrationData calData = new CalibrationData(); + calData.LiquidType = (PMR.ColorLab.LiquidType)vm.IdsPack.LiquidType.Code; + calData.CalibrationPoints.AddRange(vm.CalibrationPoints.Select(x => new CalibrationPoint() { X = x.X, Y = x.Y })); - inputLiquid.CalibrationData = Cat.CreateDemoCalibrationData((PMR.ColorLab.LiquidType)vm.LiquidType.Code); + inputLiquid.CalibrationData = calData; inputLiquid.LiquidType = (PMR.ColorLab.LiquidType)vm.LiquidType.Code; inputLiquid.MaxNanoliterPerCentimeter = LiquidTypesRmls.SingleOrDefault(x => x.LiquidType.Code == vm.LiquidType.Code).MaxNlPerCm; @@ -549,7 +574,7 @@ namespace Tango.MachineStudio.ColorLab.ViewModels catch (Exception ex) { LogManager.Log(ex, "Error in inversed color conversion!"); - _notification.ShowError("Error in inversed color conversion!"); + _notification.ShowError("An error occurred while trying to convert from Volume to RGB.\n" + ex.Message); } } @@ -563,6 +588,8 @@ namespace Tango.MachineStudio.ColorLab.ViewModels { IsFree = false; + List default_calibration_to_notify = new List(); + await Task.Factory.StartNew(() => { using (_notification.PushTaskItem("Loading RML data...")) @@ -590,6 +617,17 @@ namespace Tango.MachineStudio.ColorLab.ViewModels var calData = cat.GetCalibrationData(); vm.CalibrationPoints = calData.CalibrationPoints.Select(x => new CalibrationDataPointVM(x)).ToObservableCollection(); } + else + { + var liquidTypeRml = LiquidTypesRmls.SingleOrDefault(x => x.LiquidType == idsPack.LiquidType && x.Rml == SelectedRML); + + if (liquidTypeRml != null) + { + default_calibration_to_notify.Add(idsPack); + var calData = liquidTypeRml.GetCalibrationData(); + vm.CalibrationPoints = calData.CalibrationPoints.Select(x => new CalibrationDataPointVM(x)).ToObservableCollection(); + } + } InvokeUINow(() => { @@ -606,9 +644,31 @@ namespace Tango.MachineStudio.ColorLab.ViewModels CCT.Rml = SelectedRML; _isNewCCT = true; } + + var settings = SettingsManager.Default.GetOrCreate(); + settings.LastMachineSerialNumber = SelectedMachine.SerialNumber; + settings.LastRmlGuid = SelectedRML.Guid; + settings.Save(); } }); + + //TODO: not sure is this is really needed.. + + //if (default_calibration_to_notify.Count > 0) + //{ + // String message = "The following calibration tables were loaded from the selected RML default calibration." + Environment.NewLine; + + // foreach (var pack in default_calibration_to_notify) + // { + // message += SelectedRML.Name + " >> " + pack.LiquidType.Name + "." + Environment.NewLine; + // } + + // _notification.ShowWarning(message); + //} + + + IsFree = true; } } 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 908a9fd38..43c1d155c 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("3.5.53.18238")] +[assembly: AssemblyVersion("3.5.54.18238")] [assembly: ComVisible(false)] \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.BL/ObservablesContextExtension.cs b/Software/Visual_Studio/Tango.BL/ObservablesContextExtension.cs index 59c944a72..3ee8ecc9f 100644 --- a/Software/Visual_Studio/Tango.BL/ObservablesContextExtension.cs +++ b/Software/Visual_Studio/Tango.BL/ObservablesContextExtension.cs @@ -158,7 +158,7 @@ namespace Tango.BL //Good chance to update "LAST_UPDATED" field! modified.LastUpdated = DateTime.UtcNow; - foreach (var toNotify in ObservableEntitiesContainer.RegisteredEntities.Where(x => x.Guid == modified.Guid).ToList()) + foreach (var toNotify in ObservableEntitiesContainer.RegisteredEntities.ToList().Where(x => x.Guid == modified.Guid).ToList()) { _pending_notifications.Add(new ObservableModifiedEventArgs(this, modified, toNotify)); } diff --git a/Software/Visual_Studio/Tango.UnitTesting/RemoteRunner_TST.cs b/Software/Visual_Studio/Tango.UnitTesting/RemoteRunner_TST.cs index 35248c862..9b2251a51 100644 --- a/Software/Visual_Studio/Tango.UnitTesting/RemoteRunner_TST.cs +++ b/Software/Visual_Studio/Tango.UnitTesting/RemoteRunner_TST.cs @@ -42,7 +42,7 @@ namespace Tango.UnitTesting String uploadFileName = "RemoteRunnerExeTest.zip"; String executeFileName = "RemoteRunnerExeTest.exe"; - FileInfo exeFile = new FileInfo(Helper.GetResourcePath(uploadFileName)); + System.IO.FileInfo exeFile = new System.IO.FileInfo(Helper.GetResourcePath(uploadFileName)); var uploadResponse = transporter.SendRequest(new FileUploadRequest() { diff --git a/Software/Visual_Studio/VSIX/Tango.BuildExtensions/RemoteDebugCommand.cs b/Software/Visual_Studio/VSIX/Tango.BuildExtensions/RemoteDebugCommand.cs index a5ded9906..09b07d382 100644 --- a/Software/Visual_Studio/VSIX/Tango.BuildExtensions/RemoteDebugCommand.cs +++ b/Software/Visual_Studio/VSIX/Tango.BuildExtensions/RemoteDebugCommand.cs @@ -221,7 +221,7 @@ namespace Tango.BuildExtensions SetVSProgress("Packaging project..."); ZipFile.CreateFromDirectory(folder, zipFile.Path); - FileInfo zipFileInfo = new FileInfo(zipFile); + System.IO.FileInfo zipFileInfo = new System.IO.FileInfo(zipFile); CloseVSProgress(); -- cgit v1.3.1 From 1e24679bf65e42e5df96113bd1eef371036f0940 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Wed, 24 Oct 2018 16:18:39 +0300 Subject: Implemented job resume!! --- Software/DB/PPC/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/PPC/Tango_log.ldf | Bin 20578304 -> 20578304 bytes Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 15400960 -> 15400960 bytes Software/PMR/Messages/Common/ErrorCode.proto | 12 +- Software/PMR/Messages/Common/MessageType.proto | 4 + .../PMR/Messages/Printing/CurrentJobRequest.proto | 9 + .../PMR/Messages/Printing/CurrentJobResponse.proto | 12 ++ Software/PMR/Messages/Printing/JobTicket.proto | 17 +- .../Printing/ResumeCurrentJobRequest.proto | 9 + .../Printing/ResumeCurrentJobResponse.proto | 12 ++ .../Build/Shortcuts/Machine Emulator.lnk | Bin 1471 -> 1455 bytes .../Build/Shortcuts/Machine Studio.lnk | Bin 1532 -> 1516 bytes .../Build/Shortcuts/Proto Compiler GUI.lnk | Bin 1464 -> 1448 bytes .../ViewModels/MainViewVM.cs | 51 +++++- .../Navigation/INavigationManager.cs | 2 + .../Modules/DefaultStudioModuleLoader.cs | 5 +- .../Navigation/DefaultNavigationManager.cs | 12 ++ .../Notifications/DefaultNotificationProvider.cs | 38 +++- .../DefaultStudioApplicationManager.cs | 17 +- .../ViewModels/MainViewVM.cs | 2 + .../Tango.MachineStudio.UI/Views/MainView.xaml | 20 ++- .../Editors/AutoCompleteTextBox.cs | 9 +- .../Tango.Emulations/Emulators/MachineEmulator.cs | 88 ++++++++-- .../Operation/IMachineOperator.cs | 10 ++ .../Tango.Integration/Operation/MachineOperator.cs | 141 +++++++++++++++ .../Operation/ResumingJobEventArgs.cs | 26 +++ .../Tango.Integration/Tango.Integration.csproj | 3 +- .../Visual_Studio/Tango.PMR/Common/ErrorCode.cs | 10 +- .../Visual_Studio/Tango.PMR/Common/MessageType.cs | 47 ++--- .../Tango.PMR/Printing/CurrentJobRequest.cs | 131 ++++++++++++++ .../Tango.PMR/Printing/CurrentJobResponse.cs | 195 +++++++++++++++++++++ .../Visual_Studio/Tango.PMR/Printing/JobTicket.cs | 95 ++++++---- .../Tango.PMR/Printing/ResumeCurrentJobRequest.cs | 131 ++++++++++++++ .../Tango.PMR/Printing/ResumeCurrentJobResponse.cs | 195 +++++++++++++++++++++ Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj | 6 +- 36 files changed, 1204 insertions(+), 105 deletions(-) create mode 100644 Software/PMR/Messages/Printing/CurrentJobRequest.proto create mode 100644 Software/PMR/Messages/Printing/CurrentJobResponse.proto create mode 100644 Software/PMR/Messages/Printing/ResumeCurrentJobRequest.proto create mode 100644 Software/PMR/Messages/Printing/ResumeCurrentJobResponse.proto create mode 100644 Software/Visual_Studio/Tango.Integration/Operation/ResumingJobEventArgs.cs create mode 100644 Software/Visual_Studio/Tango.PMR/Printing/CurrentJobRequest.cs create mode 100644 Software/Visual_Studio/Tango.PMR/Printing/CurrentJobResponse.cs create mode 100644 Software/Visual_Studio/Tango.PMR/Printing/ResumeCurrentJobRequest.cs create mode 100644 Software/Visual_Studio/Tango.PMR/Printing/ResumeCurrentJobResponse.cs (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI') diff --git a/Software/DB/PPC/Tango.mdf b/Software/DB/PPC/Tango.mdf index 05382b4cb..35e6fba43 100644 Binary files a/Software/DB/PPC/Tango.mdf and b/Software/DB/PPC/Tango.mdf differ diff --git a/Software/DB/PPC/Tango_log.ldf b/Software/DB/PPC/Tango_log.ldf index 34218c424..fb57f7692 100644 Binary files a/Software/DB/PPC/Tango_log.ldf and b/Software/DB/PPC/Tango_log.ldf differ diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index f14509fff..9383eee3c 100644 Binary files a/Software/DB/Tango.mdf and b/Software/DB/Tango.mdf differ diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf index e3144956b..995b71bf5 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/PMR/Messages/Common/ErrorCode.proto b/Software/PMR/Messages/Common/ErrorCode.proto index 51774e6e9..cbdcfec25 100644 --- a/Software/PMR/Messages/Common/ErrorCode.proto +++ b/Software/PMR/Messages/Common/ErrorCode.proto @@ -24,9 +24,11 @@ enum ErrorCode //Job Failure JOB_UNSPECIFIED_ERROR = 2000; JOB_THREAD_BREAK = 2001; - JOB_WINDER_DANCER_FAIL = 2002; - JOB_POOLER_DANCER_FAIL = 2003; - JOB_FEEDER_DANCER_FAIL = 2004; - JOB_OUT_OF_DYE = 2005; - JOB_OTHER_ALARM = 2006; + JOB_WINDER_DANCER_FAIL = 2002; + JOB_POOLER_DANCER_FAIL = 2003; + JOB_FEEDER_DANCER_FAIL = 2004; + JOB_OUT_OF_DYE = 2005; + JOB_OTHER_ALARM = 2006; + NO_JOB_IN_PROGRESS = 2007; //Occurs when ResumeCurrentJobRequest was called but no job is in progress. + } diff --git a/Software/PMR/Messages/Common/MessageType.proto b/Software/PMR/Messages/Common/MessageType.proto index c19bbc2d8..c9a55552d 100644 --- a/Software/PMR/Messages/Common/MessageType.proto +++ b/Software/PMR/Messages/Common/MessageType.proto @@ -175,6 +175,10 @@ enum MessageType AbortJobResponse = 3003; UploadProcessParametersRequest = 3004; UploadProcessParametersResponse = 3005; + CurrentJobRequest = 3006; + CurrentJobResponse = 3007; + ResumeCurrentJobRequest = 3008; + ResumeCurrentJobResponse = 3009; diff --git a/Software/PMR/Messages/Printing/CurrentJobRequest.proto b/Software/PMR/Messages/Printing/CurrentJobRequest.proto new file mode 100644 index 000000000..1e5f57531 --- /dev/null +++ b/Software/PMR/Messages/Printing/CurrentJobRequest.proto @@ -0,0 +1,9 @@ +syntax = "proto3"; + +package Tango.PMR.Printing; +option java_package = "com.twine.tango.pmr.printing"; + +message CurrentJobRequest +{ + +} \ No newline at end of file diff --git a/Software/PMR/Messages/Printing/CurrentJobResponse.proto b/Software/PMR/Messages/Printing/CurrentJobResponse.proto new file mode 100644 index 000000000..5fe94db13 --- /dev/null +++ b/Software/PMR/Messages/Printing/CurrentJobResponse.proto @@ -0,0 +1,12 @@ +syntax = "proto3"; + +import "JobTicket.proto"; + +package Tango.PMR.Printing; +option java_package = "com.twine.tango.pmr.printing"; + +message CurrentJobResponse +{ + bool IsJobInProgress = 1; + JobTicket JobTicket = 2; +} \ No newline at end of file diff --git a/Software/PMR/Messages/Printing/JobTicket.proto b/Software/PMR/Messages/Printing/JobTicket.proto index ace279747..9d15d9433 100644 --- a/Software/PMR/Messages/Printing/JobTicket.proto +++ b/Software/PMR/Messages/Printing/JobTicket.proto @@ -10,17 +10,18 @@ option java_package = "com.twine.tango.pmr.printing"; message JobTicket { - string Name = 1; + string guid = 1; + string Name = 2; - bool EnableInterSegment = 2; - double InterSegmentLength = 3; + bool EnableInterSegment = 3; + double InterSegmentLength = 4; - double Length = 4; + double Length = 5; - ProcessParameters ProcessParameters = 5; + ProcessParameters ProcessParameters = 6; - JobWindingMethod WindingMethod = 6; - JobSpool Spool = 7; + JobWindingMethod WindingMethod = 7; + JobSpool Spool = 8; - repeated JobSegment Segments = 8; + repeated JobSegment Segments = 9; } \ No newline at end of file diff --git a/Software/PMR/Messages/Printing/ResumeCurrentJobRequest.proto b/Software/PMR/Messages/Printing/ResumeCurrentJobRequest.proto new file mode 100644 index 000000000..0ab3d7b62 --- /dev/null +++ b/Software/PMR/Messages/Printing/ResumeCurrentJobRequest.proto @@ -0,0 +1,9 @@ +syntax = "proto3"; + +package Tango.PMR.Printing; +option java_package = "com.twine.tango.pmr.printing"; + +message ResumeCurrentJobRequest +{ + +} \ No newline at end of file diff --git a/Software/PMR/Messages/Printing/ResumeCurrentJobResponse.proto b/Software/PMR/Messages/Printing/ResumeCurrentJobResponse.proto new file mode 100644 index 000000000..08c3ffcca --- /dev/null +++ b/Software/PMR/Messages/Printing/ResumeCurrentJobResponse.proto @@ -0,0 +1,12 @@ +syntax = "proto3"; + +import "JobStatus.proto"; + +package Tango.PMR.Printing; +option java_package = "com.twine.tango.pmr.printing"; + +message ResumeCurrentJobResponse +{ + JobStatus Status = 1; + bool Canceled = 2; +} \ No newline at end of file diff --git a/Software/Visual_Studio/Build/Shortcuts/Machine Emulator.lnk b/Software/Visual_Studio/Build/Shortcuts/Machine Emulator.lnk index 809dc39a4..0b55f9468 100644 Binary files a/Software/Visual_Studio/Build/Shortcuts/Machine Emulator.lnk and b/Software/Visual_Studio/Build/Shortcuts/Machine Emulator.lnk differ diff --git a/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk b/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk index aaa476b0b..96378d6e7 100644 Binary files a/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk and b/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk differ diff --git a/Software/Visual_Studio/Build/Shortcuts/Proto Compiler GUI.lnk b/Software/Visual_Studio/Build/Shortcuts/Proto Compiler GUI.lnk index 349e9582e..8996e8019 100644 Binary files a/Software/Visual_Studio/Build/Shortcuts/Proto Compiler GUI.lnk and b/Software/Visual_Studio/Build/Shortcuts/Proto Compiler GUI.lnk differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs index 07686165b..efdb8982d 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs @@ -45,6 +45,7 @@ using Tango.AutoComplete.Editors; using System.Data.Entity; using System.Runtime.ExceptionServices; using Tango.BL.Builders; +using Tango.MachineStudio.Common.Navigation; namespace Tango.MachineStudio.Developer.ViewModels { @@ -63,6 +64,7 @@ namespace Tango.MachineStudio.Developer.ViewModels private TimeSpan _runningJobEstimatedDuration; private JobHandler _jobHandler; private DeveloperNavigationManager _navigation; + private INavigationManager _msNavigation; private bool _blockInvalidateCommands; private IAuthenticationProvider _authentication; private ObservablesContext _machineDbContext; @@ -685,7 +687,7 @@ namespace Tango.MachineStudio.Developer.ViewModels /// /// The application manager. /// The notification provider. - public MainViewVM(IStudioApplicationManager applicationManager, INotificationProvider notificationProvider, IDiagnosticsFrameProvider diagnosticsFrameProvider, IVideoCaptureProvider videoCaptureProvider, DeveloperNavigationManager navigation, IAuthenticationProvider authentication, IEventLogger eventLogger, ISpeechProvider speech) + public MainViewVM(IStudioApplicationManager applicationManager, INotificationProvider notificationProvider, IDiagnosticsFrameProvider diagnosticsFrameProvider, IVideoCaptureProvider videoCaptureProvider, DeveloperNavigationManager navigation, INavigationManager navigationManager, IAuthenticationProvider authentication, IEventLogger eventLogger, ISpeechProvider speech) { CanWork = true; EnableColorConversion = true; @@ -695,6 +697,7 @@ namespace Tango.MachineStudio.Developer.ViewModels _notification = notificationProvider; _speech = speech; _navigation = navigation; + _msNavigation = navigationManager; ApplicationManager = applicationManager; VideoCaptureProvider = videoCaptureProvider; _eventLogger = eventLogger; @@ -720,11 +723,11 @@ namespace Tango.MachineStudio.Developer.ViewModels RemoveBrushStopCommand = new RelayCommand(RemoveSelectedBrushStops, () => SelectedBrushStop != null && CanWork); SaveJobCommand = new RelayCommand(SaveActiveJob, () => SelectedMachine != null && CanWork); DiscardJobCommand = new RelayCommand(BackToJobs, () => SelectedMachine != null && CanWork); - StartJobCommand = new RelayCommand(StartJob, () => ActiveJob != null && CanWork && !IsJobRunning && MachineOperator != null && !MachineOperator.MachineEventsStateProvider.Events.ToList().Exists(x => x.ActionTypes.Contains(BL.Enumerations.ActionTypes.PreventJobExecution))); + StartJobCommand = new RelayCommand(() => StartJob(), () => ActiveJob != null && CanWork && !IsJobRunning && MachineOperator != null && !MachineOperator.MachineEventsStateProvider.Events.ToList().Exists(x => x.ActionTypes.Contains(BL.Enumerations.ActionTypes.PreventJobExecution))); StartJobAndRecordCommand = new RelayCommand(StartJobAndRecord, () => _dataCaptureVM != null && !_dataCaptureVM.Recorder.IsRecording && !_dataCaptureVM.Player.IsPlaying && ActiveJob != null && !IsJobRunning && MachineOperator != null && !MachineOperator.MachineEventsStateProvider.Events.ToList().Exists(x => x.ActionTypes.Contains(BL.Enumerations.ActionTypes.PreventJobExecution))); StopJobCommand = new RelayCommand(StopJob, () => IsJobRunning && CanWork); CloseJobCompletionStatusCommand = new RelayCommand(CloseJobCompletionStatusBar); - LoadJobCommand = new RelayCommand(LoadSelectedJob, () => SelectedMachineJob != null && CanWork); + LoadJobCommand = new RelayCommand(() => LoadSelectedJob(), () => SelectedMachineJob != null && CanWork); DuplicateJobCommand = new RelayCommand(DuplicateSelectedJobs, () => SelectedMachineJob != null && CanWork); DuplicateSegmentCommand = new RelayCommand(DuplicateSelectedSegments, () => SelectedSegment != null && CanWork); DuplicateBrushStopCommand = new RelayCommand(DuplicateSelectedBrushStops, () => SelectedBrushStop != null && CanWork); @@ -912,6 +915,33 @@ namespace Tango.MachineStudio.Developer.ViewModels MachineOperator.MachineEventsStateProvider.NewEvents -= MachineEventsStateProvider_NewEvents; MachineOperator.MachineEventsStateProvider.NewEvents += MachineEventsStateProvider_NewEvents; + + MachineOperator.ResumingJob -= MachineOperator_ResumingJob; + MachineOperator.ResumingJob += MachineOperator_ResumingJob; + } + } + + private void MachineOperator_ResumingJob(object sender, ResumingJobEventArgs e) + { + if (_notification.ShowQuestion("Machine studio has detected a job in progress. Would you like to try and continue from there you were?")) + { + var job = _machineDbContext.Jobs.SingleOrDefault(x => x.Guid == e.JobGuid); + + if (job != null) + { + _msNavigation.NavigateToModule(); + SelectedMachine = _machineDbContext.Machines.SingleOrDefault(x => x.Guid == job.MachineGuid); + SelectedMachineJob = SelectedMachine.Jobs.SingleOrDefault(x => x.Guid == job.Guid); + LoadSelectedJob(() => + { + StartJob(e.Approve); + }); + } + else + { + LogManager.Log($"Could not resume job. The running job with guid '{e.JobGuid}' was not found."); + _notification.ShowError("Could not resume job. The running job was not found."); + } } } @@ -1205,7 +1235,7 @@ namespace Tango.MachineStudio.Developer.ViewModels /// /// Starts the job. /// - private void StartJob() + private void StartJob(Func resumeFunc = null) { LogManager.Log(String.Format("Starting job {0}...", ActiveJob.Name)); if (MachineOperator == null || MachineOperator.State != TransportComponentState.Connected) @@ -1242,7 +1272,14 @@ namespace Tango.MachineStudio.Developer.ViewModels { LogManager.Log("Sending job to machine operator..."); - _jobHandler = MachineOperator.Print(ActiveJob, SelectedProcessParametersTable); + if (resumeFunc == null) + { + _jobHandler = MachineOperator.Print(ActiveJob, SelectedProcessParametersTable); + } + else + { + _jobHandler = resumeFunc(ActiveJob); + } _eventLogger.Log(String.Format("Job '{0}' started...", ActiveJob.Name)); @@ -1573,7 +1610,7 @@ namespace Tango.MachineStudio.Developer.ViewModels /// /// Loads the selected job. /// - private async void LoadSelectedJob() + private async void LoadSelectedJob(Action onCompleted = null) { if (SelectedMachineJob != null) { @@ -1662,6 +1699,8 @@ namespace Tango.MachineStudio.Developer.ViewModels } CanWork = true; + + onCompleted?.Invoke(); } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Navigation/INavigationManager.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Navigation/INavigationManager.cs index e20940c8d..6bd4d8829 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Navigation/INavigationManager.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Navigation/INavigationManager.cs @@ -101,6 +101,8 @@ namespace Tango.MachineStudio.Common.Navigation Task NavigateWithObject(TPass obj, bool pushToHistory = true) where TModule : IStudioModule; + void NavigateToModule() where T : IStudioModule; + /// /// Clears the navigation back history. /// diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Modules/DefaultStudioModuleLoader.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Modules/DefaultStudioModuleLoader.cs index 0def3c943..28f56e521 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Modules/DefaultStudioModuleLoader.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Modules/DefaultStudioModuleLoader.cs @@ -44,7 +44,10 @@ namespace Tango.MachineStudio.UI.Modules /// The e. private void _authenticationProvider_CurrentUserChanged(object sender, User e) { - LoadModules(); + if (e != null) + { + LoadModules(); + } } private SynchronizedObservableCollection _allModules; diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Navigation/DefaultNavigationManager.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Navigation/DefaultNavigationManager.cs index 899ba846e..13ec6161d 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Navigation/DefaultNavigationManager.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Navigation/DefaultNavigationManager.cs @@ -5,6 +5,7 @@ using System.Text; using System.Threading.Tasks; using Tango.Core; using Tango.Core.Commands; +using Tango.Core.DI; using Tango.MachineStudio.Common; using Tango.MachineStudio.Common.Modules; using Tango.MachineStudio.Common.Navigation; @@ -384,5 +385,16 @@ namespace Tango.MachineStudio.UI.Navigation RaisePropertyChanged(nameof(CanNavigateBack)); } + + public void NavigateToModule() where T : IStudioModule + { + var loader = TangoIOC.Default.GetInstance(); + var module = loader.UserModules.SingleOrDefault(x => x.GetType() == typeof(T)); + + if (module != null) + { + TangoIOC.Default.GetInstance().StartModule(module); + } + } } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DefaultNotificationProvider.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DefaultNotificationProvider.cs index 6cff1ba17..80509e6c0 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DefaultNotificationProvider.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DefaultNotificationProvider.cs @@ -11,6 +11,7 @@ using System.Windows.Media; using Tango.Core; using System.Collections.ObjectModel; using Tango.SharedUI; +using System.Collections.Concurrent; namespace Tango.MachineStudio.UI.Notifications { @@ -21,6 +22,8 @@ namespace Tango.MachineStudio.UI.Notifications /// public class DefaultNotificationProvider : ExtendedObject, INotificationProvider { + private int _message_count = 0; + /// /// The view types /// @@ -79,6 +82,8 @@ namespace Tango.MachineStudio.UI.Notifications { MainWindow.Instance.shadowGrid.Visibility = Visibility.Visible; + _message_count++; + var result = new MessageBoxWindow() { Owner = Application.Current.MainWindow, @@ -89,7 +94,13 @@ namespace Tango.MachineStudio.UI.Notifications }.ShowDialog(); - MainWindow.Instance.shadowGrid.Visibility = Visibility.Hidden; + _message_count--; + + if (_message_count == 0) + { + MainWindow.Instance.shadowGrid.Visibility = Visibility.Hidden; + } + return result; } @@ -377,8 +388,11 @@ namespace Tango.MachineStudio.UI.Notifications /// The task item. public void PushTaskItem(TaskItem taskItem) { - TaskItems.Add(taskItem); - CurrentTaskItem = taskItem; + InvokeUI(() => + { + TaskItems.Add(taskItem); + CurrentTaskItem = taskItem; + }); } /// @@ -400,14 +414,20 @@ namespace Tango.MachineStudio.UI.Notifications /// The task item. public void PopTaskItem(TaskItem taskItem) { - TaskItems.Remove(taskItem); - - if (TaskItems.Count > 0) + Task.Delay(1000).ContinueWith((x) => { - CurrentTaskItem = TaskItems.Last(); - } + InvokeUI(() => + { + TaskItems.Remove(taskItem); - RaisePropertyChanged(nameof(HasTaskItems)); + if (TaskItems.Count > 0) + { + CurrentTaskItem = TaskItems.Last(); + } + + RaisePropertyChanged(nameof(HasTaskItems)); + }); + }); } /// diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs index 8be7f486a..3864708fc 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs @@ -25,6 +25,7 @@ using Tango.MachineStudio.UI.ViewModels; using Tango.MachineStudio.Common.Notifications; using Tango.MachineStudio.UI.Views; using Tango.Integration.Operation; +using Tango.MachineStudio.UI.Windows; namespace Tango.MachineStudio.UI.StudioApplication { @@ -39,6 +40,7 @@ namespace Tango.MachineStudio.UI.StudioApplication private IStudioModuleLoader _moduleLoader; private INotificationProvider _notification; private List _openedWindows; + private List _notified_view_models; /// /// Initializes a new instance of the class. @@ -50,6 +52,7 @@ namespace Tango.MachineStudio.UI.StudioApplication _navigationManager = navigationManager; _notification = notification; _openedWindows = new List(); + _notified_view_models = new List(); Application.Current.MainWindow.ContentRendered += (_, __) => { @@ -286,6 +289,11 @@ namespace Tango.MachineStudio.UI.StudioApplication window.Closed += (x, y) => { _openedWindows.Remove(window); }; } + public bool IsModuleInNewWindow(IStudioModule module) + { + return _openedWindows.Exists(x => (x as ModuleWindow).ModuleContext.Module == module); + } + /// /// Gets the core libraries version. /// @@ -324,7 +332,14 @@ namespace Tango.MachineStudio.UI.StudioApplication /// public void NotifyApplicationReady() { - TangoIOC.Default.GetAllInstancesByBase().ToList().ForEach(x => x.OnApplicationReady()); + TangoIOC.Default.GetAllInstancesByBase().ToList().ForEach(x => + { + if (!_notified_view_models.Contains(x)) + { + x.OnApplicationReady(); + _notified_view_models.Add(x); + } + }); } /// 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 9b625a6ee..31e297cd1 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs @@ -649,6 +649,8 @@ namespace Tango.MachineStudio.UI.ViewModels { IsMenuOpened = false; + if ((_applicationManager as DefaultStudioApplicationManager).IsModuleInNewWindow(module)) return; + if (module != null) { LogManager.Log(String.Format("Starting module '{0}'...", module.Name)); diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml index 7edfa50c6..f66e247a9 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml @@ -467,7 +467,7 @@ - +