From cdba3267d2a47b3bff8cf3ec0219223e36e234ff Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Mon, 7 May 2018 15:36:03 +0300 Subject: Added machine studio modules order. Implemented delayed GetInstance for TangoIOC. --- .../Tango.MachineStudio.ColorLab/ColorLabModule.cs | 1 + .../Modules/Tango.MachineStudio.DB/DBModule.cs | 1 + .../DataCaptureModule.cs | 1 + .../Tango.MachineStudio.Developer/DeveloperModule.cs | 3 ++- .../ViewModels/MainViewVM.cs | 9 ++++++--- .../HardwareDesignerModule.cs | 5 +++-- .../Tango.MachineStudio.Logging/LoggingModule.cs | 1 + .../MachineDesignerModule.cs | 1 + .../Modules/Tango.MachineStudio.Stubs/StubsModule.cs | 1 + .../SynchronizationModule.cs | 1 + .../TechnicianModule.cs | 3 ++- .../UsersAndRolesModule.cs | 1 + .../StudioModuleAttribute.cs | 19 +++++++++++++++++++ .../Tango.MachineStudio.Common.csproj | 1 + .../Modules/DefaultStudioModuleLoader.cs | 2 ++ 15 files changed, 43 insertions(+), 7 deletions(-) create mode 100644 Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioModuleAttribute.cs (limited to 'Software/Visual_Studio/MachineStudio') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ColorLabModule.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ColorLabModule.cs index bdb7b136f..2805e5d60 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ColorLabModule.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ColorLabModule.cs @@ -12,6 +12,7 @@ using Tango.SharedUI.Helpers; namespace Tango.MachineStudio.ColorLab { + [StudioModule(7)] public class ColorLabModule : StudioModuleBase { public override string Name diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/DBModule.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/DBModule.cs index 4b2fe4074..7477c8d63 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/DBModule.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/DBModule.cs @@ -16,6 +16,7 @@ namespace Tango.MachineStudio.DB /// Represents a Machine Studio database module. /// /// + [StudioModule(8)] public class DBModule : StudioModuleBase { /// diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/DataCaptureModule.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/DataCaptureModule.cs index eb463e3c2..23d743aeb 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/DataCaptureModule.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/DataCaptureModule.cs @@ -17,6 +17,7 @@ namespace Tango.MachineStudio.DataCapture /// Represents the machine studio data capturing and playing module. /// /// + [StudioModule(4)] public class DataCaptureModule : StudioModuleBase { /// diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/DeveloperModule.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/DeveloperModule.cs index 166a3212a..be6b93726 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/DeveloperModule.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/DeveloperModule.cs @@ -17,12 +17,13 @@ namespace Tango.MachineStudio.Developer /// Represents the Machine Studio developer module. /// /// + [StudioModule(0)] public class DeveloperModule : StudioModuleBase { /// /// Gets the module name. /// - public override string Name => "Developer"; + public override string Name => "Research"; /// /// Gets the module description. 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 f557e2923..ab0df302e 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 @@ -652,8 +652,11 @@ namespace Tango.MachineStudio.Developer.ViewModels LogManager.Log("Initializing relay commands..."); - _dataCaptureVM = TangoIOC.Default.GetInstance(); - _dataCaptureVM.RelayCommandsInvalidated += (_, __) => StartJobAndRecordCommand.RaiseCanExecuteChanged(); + TangoIOC.Default.GetInstanceWhenAvailable((vm) => + { + _dataCaptureVM = vm; + _dataCaptureVM.RelayCommandsInvalidated += (_, __) => StartJobAndRecordCommand.RaiseCanExecuteChanged(); + }); //Initialize Commands... EditMachineCommand = new RelayCommand(EditMachine, () => SelectedMachine != null); @@ -669,7 +672,7 @@ namespace Tango.MachineStudio.Developer.ViewModels SaveJobCommand = new RelayCommand(SaveActiveJob, () => SelectedMachine != null); DiscardJobCommand = new RelayCommand(BackToJobs, () => SelectedMachine != null); StartJobCommand = new RelayCommand(StartJob, () => ActiveJob != null && !IsJobRunning && MachineOperator != null && !MachineOperator.MachineEventsStateProvider.Events.ToList().Exists(x => x.ActionTypes.Contains(BL.Enumerations.ActionTypes.PreventJobExecution))); - StartJobAndRecordCommand = new RelayCommand(StartJobAndRecord, () => !_dataCaptureVM.Recorder.IsRecording && !_dataCaptureVM.Player.IsPlaying && ActiveJob != null && !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); CloseJobCompletionStatusCommand = new RelayCommand(CloseJobCompletionStatusBar); LoadJobCommand = new RelayCommand(LoadSelectedJob, () => SelectedMachineJob != null); diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/HardwareDesignerModule.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/HardwareDesignerModule.cs index 4bd266f4c..4b67e6a72 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/HardwareDesignerModule.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/HardwareDesignerModule.cs @@ -13,13 +13,14 @@ using Tango.SharedUI.Helpers; namespace Tango.MachineStudio.HardwareDesigner { + [StudioModule(3)] public class HardwareDesignerModule : StudioModuleBase { public override string Name { get { - return "Hardware Designer"; + return "Hardware Versions"; } } @@ -27,7 +28,7 @@ namespace Tango.MachineStudio.HardwareDesigner { get { - return "Design a specific hardware version using a drag & drop interface. Hardware versions can be assigned to a machine configuration using the Machine Designer module."; + return "Select and configure hardware versions using the available hardware components. Hardware versions can be assigned to a machine configuration using the Machine Designer module."; } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/LoggingModule.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/LoggingModule.cs index b389c121e..ea3e01c39 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/LoggingModule.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/LoggingModule.cs @@ -12,6 +12,7 @@ using Tango.SharedUI.Helpers; namespace Tango.MachineStudio.Logging { + [StudioModule(5)] public class LoggingModule : StudioModuleBase { public override string Name diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/MachineDesignerModule.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/MachineDesignerModule.cs index 9b37303c7..35aea14a4 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/MachineDesignerModule.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/MachineDesignerModule.cs @@ -17,6 +17,7 @@ namespace Tango.MachineStudio.MachineDesigner /// Represents a machine designer Machine Studio module providing an interactive GUI for managing machine configurations. /// /// + [StudioModule(2)] public class MachineDesignerModule : StudioModuleBase { /// diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/StubsModule.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/StubsModule.cs index aa8041669..b0c5d643a 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/StubsModule.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/StubsModule.cs @@ -17,6 +17,7 @@ namespace Tango.MachineStudio.Stubs /// Represents a stubs execution Machine Studio module capable of executing stubs against the current connected machine using a C# script engine. /// /// + [StudioModule(10)] public class StubsModule : StudioModuleBase { /// diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/SynchronizationModule.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/SynchronizationModule.cs index 29fc95aec..862ee9a6a 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/SynchronizationModule.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/SynchronizationModule.cs @@ -17,6 +17,7 @@ namespace Tango.MachineStudio.Synchronization /// Represents a Machine Studio module capable of comparing and synchronizing machines data against Twine remote database. /// /// + [StudioModule(6)] public class SynchronizationModule : StudioModuleBase { /// diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechnicianModule.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechnicianModule.cs index 4ced0fb30..ae423c938 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechnicianModule.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechnicianModule.cs @@ -17,12 +17,13 @@ namespace Tango.MachineStudio.Technician /// Represents a machine studio technician module. /// /// + [StudioModule(1)] public class TechnicianModule : StudioModuleBase { /// /// Gets the module name. /// - public override string Name => "Technician"; + public override string Name => "Tech Board"; /// /// Gets the module description. diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/UsersAndRolesModule.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/UsersAndRolesModule.cs index ac471db06..21b41137d 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/UsersAndRolesModule.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/UsersAndRolesModule.cs @@ -12,6 +12,7 @@ using Tango.SharedUI.Helpers; namespace Tango.MachineStudio.UsersAndRoles { + [StudioModule(9)] public class UsersAndRolesModule : StudioModuleBase { public override string Name diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioModuleAttribute.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioModuleAttribute.cs new file mode 100644 index 000000000..b9212a9e3 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioModuleAttribute.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.MachineStudio.Common +{ + [AttributeUsage(AttributeTargets.Class)] + public class StudioModuleAttribute : Attribute + { + public int Index { get; set; } + + public StudioModuleAttribute(int index) + { + Index = index; + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj index ac6f84618..df1ee23dc 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj @@ -109,6 +109,7 @@ + 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 4afddae69..26a789d0f 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Modules/DefaultStudioModuleLoader.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Modules/DefaultStudioModuleLoader.cs @@ -125,6 +125,8 @@ namespace Tango.MachineStudio.UI.Modules _loaded = true; } + AllModules = AllModules.OrderBy(x => x.GetType().GetCustomAttribute().Index).ToObservableCollection(); + UserModules.Clear(); if (_authenticationProvider.CurrentUser != null) -- cgit v1.3.1