From a4761335999936b8e1bd0091861b3b08ad3f6343 Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Mon, 20 Jan 2020 13:11:40 +0200 Subject: Fixed main menu style. Fixed issues with machine prototype creation. Implemented "make prototype". --- .../Views/MachineDetailsView.xaml | 2 +- .../Views/MachineSettingsView.xaml | 45 ++++++++++++++-------- 2 files changed, 29 insertions(+), 18 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineDetailsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineDetailsView.xaml index bcca83ca5..b3cef3083 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineDetailsView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineDetailsView.xaml @@ -23,7 +23,7 @@ - + - Device COM Port - - Auto Login @@ -109,7 +120,7 @@ - + -- cgit v1.3.1 From 2dce6d8d825850b942d8065877bdc2d3af9cf499 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Tue, 21 Jan 2020 17:27:52 +0200 Subject: Implemented new machine clone and creation. Implemented auto dispenser generation. --- .../ViewModels/MachineCreationDialogVM.cs | 45 +++++++++ .../ViewModels/MainViewVM.cs | 101 ++++++++++++++++++--- .../Views/MachineCreationDialog.xaml | 47 ++++++++-- .../Views/MachineDetailsView.xaml | 12 ++- .../Tango.BL/Entities/MachineVersion.cs | 6 +- 5 files changed, 187 insertions(+), 24 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MachineCreationDialogVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MachineCreationDialogVM.cs index 0f6ab3314..4584d3508 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MachineCreationDialogVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MachineCreationDialogVM.cs @@ -13,5 +13,50 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels public List MachineVersions { get; set; } public MachineVersion SelectedMachineVersion { get; set; } + + private bool _isNewMachine; + public bool IsNewMachine + { + get { return _isNewMachine; } + set { _isNewMachine = value; RaisePropertyChangedAuto(); } + } + + private String _serialNumber; + public String SerialNumber + { + get { return _serialNumber; } + set { _serialNumber = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); } + } + + private String _name; + public String Name + { + get { return _name; } + set { _name = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); } + } + + private bool _generateDispensers; + public bool GenerateDispensers + { + get { return _generateDispensers; } + set { _generateDispensers = value; RaisePropertyChangedAuto(); } + } + + private double _dispenserFactor; + public double DispenserFactor + { + get { return _dispenserFactor; } + set { _dispenserFactor = value; RaisePropertyChangedAuto(); } + } + + public MachineCreationDialogVM() : base() + { + DispenserFactor = 2.34; + } + + protected override bool CanOK() + { + return base.CanOK() && !String.IsNullOrWhiteSpace(SerialNumber) && !String.IsNullOrWhiteSpace(Name); + } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs index 8b0401dc7..1bd790eb6 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs @@ -39,10 +39,16 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels private ActionTimer _machines_action_timer; private ActionTimer _dispensers_action_timer; private MachineDTO _machineBeforeSave; - private bool _isNewMachine; #region Properties + private bool _isNewMachine; + public bool IsNewMachine + { + get { return _isNewMachine; } + set { _isNewMachine = value; RaisePropertyChangedAuto(); } + } + private ObservablesStaticCollections _machinesAdapter; public ObservablesStaticCollections MachinesAdapter { @@ -441,9 +447,9 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels InvalidateRelayCommands(); } - private async void LoadSelectedMachine(bool newMachine = false, bool clone = false, MachineVersion selectedVersion = null) + private async void LoadSelectedMachine(bool newMachine = false, bool clone = false, MachineCreationDialogVM machineCreationDialogVM = null) { - _isNewMachine = false; + IsNewMachine = false; using (_notification.PushTaskItem("Loading machine details...")) { @@ -478,6 +484,8 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels bool initHwConfig = true; + Configuration machineConfigBeforeClone = null; + if (!newMachine) { ActiveMachine = (await new MachineBuilder(ActiveMachineAdapter.Context).Set(SelectedMachine.Guid).WithOrganization().WithConfiguration().WithSpools().BuildAsync()); @@ -486,10 +494,12 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels if (clone) { - _isNewMachine = true; + machineConfigBeforeClone = ActiveMachine.Configuration; + + IsNewMachine = true; ActiveMachine = ActiveMachine.Clone(); - ActiveMachine.Name = ""; - ActiveMachine.SerialNumber = ""; + ActiveMachine.Name = machineCreationDialogVM.Name; + ActiveMachine.SerialNumber = machineCreationDialogVM.SerialNumber; ActiveMachine.IsDeviceRegistered = false; ActiveMachine.DeviceId = null; ActiveMachine.DeviceName = null; @@ -498,12 +508,14 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels } else { - _isNewMachine = true; + IsNewMachine = true; - if (selectedVersion == null) + if (machineCreationDialogVM.SelectedMachineVersion == null) { ActiveMachine = new Machine(); ActiveMachine.Configuration = new Configuration(); + ActiveMachine.SerialNumber = machineCreationDialogVM.SerialNumber; + ActiveMachine.Name = machineCreationDialogVM.Name; ActiveMachineAdapter.Context.Machines.Add(ActiveMachine); } else @@ -511,7 +523,9 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels try { initHwConfig = false; - ActiveMachine = selectedVersion.CreatePrototypeMachine(ActiveMachineAdapter.Context); + ActiveMachine = machineCreationDialogVM.SelectedMachineVersion.CreatePrototypeMachine(ActiveMachineAdapter.Context); + ActiveMachine.SerialNumber = machineCreationDialogVM.SerialNumber; + ActiveMachine.Name = machineCreationDialogVM.Name; ActiveMachineAdapter.Context.Machines.Add(ActiveMachine); HardwareConfigurationViewVM = new HardwareConfigurationViewVM(_notification); @@ -527,6 +541,47 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels } } + if ((newMachine || clone) && machineCreationDialogVM.GenerateDispensers) + { + for (int i = 0; i < 8; i++) + { + Dispenser dispenser = new Dispenser(); + dispenser.SerialNumber = machineCreationDialogVM.SerialNumber + "-" + (i + 1); + + if (newMachine) + { + dispenser.NlPerPulse = machineCreationDialogVM.DispenserFactor; + dispenser.DispenserTypeGuid = ActiveMachineAdapter.DispenserTypes.First().Guid; + } + else + { + var packBefore = machineConfigBeforeClone.NoneEmptyIdsPacks.SingleOrDefault(x => x.PackIndex == i); + + if (packBefore != null) + { + dispenser.NlPerPulse = packBefore.Dispenser.NlPerPulse; + dispenser.DispenserTypeGuid = packBefore.Dispenser.DispenserType.Guid; + } + else + { + continue; + } + } + + dispenser.ProductionDate = DateTime.UtcNow; + + ActiveMachineAdapter.Context.Dispensers.Add(dispenser); + + var idsPack = ActiveMachine.Configuration.NoneEmptyIdsPacks.SingleOrDefault(x => x.PackIndex == i); + + if (idsPack != null) + { + idsPack.Dispenser = dispenser; + idsPack.DispenserGuid = dispenser.Guid; + } + } + } + Sites = await ActiveMachineAdapter.Context.Sites.ToListAsync(); Sites.Insert(0, new Site() { Name = "NONE", ID = -1 }); SelectedSite = Sites.SingleOrDefault(x => x.Guid == ActiveMachine.SiteGuid); @@ -722,7 +777,7 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels ActiveMachine.Configuration.SetHardwareConfiguration(hwConfig); await ActiveMachineAdapter.Context.SaveChangesAsync(); - if (_isNewMachine) + if (IsNewMachine) { _actionLogManager.InsertLog(BL.Enumerations.ActionLogType.MachineCreated, _authentication.CurrentUser, ActiveMachine.Name, ActiveMachine, "New machine created using Machine Studio."); } @@ -756,16 +811,23 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels private void AddNewMachine() { MachineCreationDialogVM vm = new MachineCreationDialogVM(); + vm.IsNewMachine = true; vm.MachineVersions = MachinesAdapter.MachineVersions.ToList(); _notification.ShowModalDialog(vm, (x) => { + if (MachinesAdapter.Context.Machines.Any(y => y.SerialNumber == vm.SerialNumber || y.Name.ToLower() == vm.Name.ToLower())) + { + _notification.ShowError("Machine serial number or name already exists."); + return; + } + if (vm.SelectedMachineVersion != null && String.IsNullOrWhiteSpace(vm.SelectedMachineVersion.PrototypeMachineData)) { _notification.ShowError("The selected version does not contain any prototype machine data."); return; } - LoadSelectedMachine(true, false, vm.SelectedMachineVersion); + LoadSelectedMachine(true, false, vm); }, () => { }); } @@ -779,8 +841,9 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels { IsFree = false; await SelectedMachine.DeleteCascadeAsync(MachinesAdapter.Context); - MachinesAdapter.Context.Machines.Remove(SelectedMachine); _actionLogManager.InsertLog(BL.Enumerations.ActionLogType.MachineDeleted, _authentication.CurrentUser, SelectedMachine.Name, SelectedMachine, "Machine deleted using Machine Studio."); + MachinesAdapter.Context.Machines.Remove(SelectedMachine); + MachinesAdapter.Machines.Remove(SelectedMachine); } catch (Exception ex) { @@ -844,7 +907,19 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels private void CloneMachine() { - LoadSelectedMachine(false, true); + MachineCreationDialogVM vm = new MachineCreationDialogVM(); + vm.IsNewMachine = false; + vm.MachineVersions = MachinesAdapter.MachineVersions.ToList(); + _notification.ShowModalDialog(vm, (x) => + { + if (MachinesAdapter.Context.Machines.Any(y => y.SerialNumber == vm.SerialNumber || y.Name.ToLower() == vm.Name.ToLower())) + { + _notification.ShowError("Machine serial number or name already exists."); + return; + } + + LoadSelectedMachine(false, true, vm); + }, () => { }); } private void AddNewSpool() diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineCreationDialog.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineCreationDialog.xaml index 2d380c0d2..417dfbc0b 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineCreationDialog.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineCreationDialog.xaml @@ -6,9 +6,15 @@ xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:vm="clr-namespace:Tango.MachineStudio.MachineDesigner.ViewModels" + xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" xmlns:local="clr-namespace:Tango.MachineStudio.MachineDesigner.Views" mc:Ignorable="d" - d:DesignHeight="400" d:DesignWidth="700" Height="400" Width="700" Background="{StaticResource WhiteBackgroundBrush}" d:DataContext="{d:DesignInstance Type=vm:MachineCreationDialogVM, IsDesignTimeCreatable=False}"> + d:DesignHeight="400" d:DesignWidth="700" Height="460" Width="750" Background="{StaticResource WhiteBackgroundBrush}" d:DataContext="{d:DesignInstance Type=vm:MachineCreationDialogVM, IsDesignTimeCreatable=False}"> + + + + + @@ -17,7 +23,18 @@ - NEW MACHINE + + + + + @@ -33,12 +50,30 @@ - - - Please specify the machine version in order to prototype the new machine with default machine settings and configuartion. + + + Please specify the machine version in order to prototype the new machine with default machine settings and configuration. - + + + Serial Number + + + Name + + + + + Automatically generate 8 dispensers for this machine + (-1-8) + + + + + Dispenser max nl/cm + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineDetailsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineDetailsView.xaml index b3cef3083..b2b770698 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineDetailsView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineDetailsView.xaml @@ -5,11 +5,17 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:Tango.MachineStudio.MachineDesigner.Views" xmlns:global="clr-namespace:Tango.MachineStudio.MachineDesigner" - xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" xmlns:vm="clr-namespace:Tango.MachineStudio.MachineDesigner.ViewModels" xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" mc:Ignorable="d" d:DesignHeight="1080" d:DesignWidth="1920" Background="Transparent" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}"> + + + + + @@ -61,10 +67,10 @@ - + - + diff --git a/Software/Visual_Studio/Tango.BL/Entities/MachineVersion.cs b/Software/Visual_Studio/Tango.BL/Entities/MachineVersion.cs index f9975cf32..3f386beb2 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/MachineVersion.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/MachineVersion.cs @@ -34,7 +34,8 @@ namespace Tango.BL.Entities .Ignore(() => machine.LoadedRmlGuid) .Ignore(() => machine.DeviceId) .Ignore(() => machine.DeviceName) - .Ignore(() => machine.IsDeviceRegistered), + .Ignore(() => machine.IsDeviceRegistered) + .Ignore(() => machine.SiteGuid), EntitySerializationFlags.IgnoreGuids | EntitySerializationFlags.IgnoreReferenceTypes); } @@ -56,7 +57,8 @@ namespace Tango.BL.Entities .Ignore(() => m.LoadedRmlGuid) .Ignore(() => m.DeviceId) .Ignore(() => m.DeviceName) - .Ignore(() => m.IsDeviceRegistered), + .Ignore(() => m.IsDeviceRegistered) + .Ignore(() => m.SiteGuid), EntitySerializationFlags.IgnoreGuids | EntitySerializationFlags.IgnoreReferenceTypes); -- cgit v1.3.1 From 287af6d4bed5333087cb9d702d20035b1ad9a326 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Wed, 22 Jan 2020 16:38:48 +0200 Subject: Implemented team viewer join group. Prevent multiple power up dialogs from showing. Implement auto available dispenser assignment for machine creation. Sorting for machines and dispensers in Machine designer. Implemented new PPC factory reset with team viewer and device name change. Fixed "Exit To Shell" to open real explorer. Redesigned restarting system view. Updated power off animation. Updated loading animation. --- .../ViewModels/MachineUpdatesViewVM.cs | 2 + .../ViewModels/MainViewVM.cs | 60 +++++++++++++++------ .../Views/MainView.xaml | 2 +- .../ViewModels/SystemViewVM.cs | 37 +++++++++---- .../MachineSetup/MachineSetupManager.cs | 37 ++++++++----- .../OS/DefaultOperationSystemManager.cs | 22 ++++++++ .../Tango.PPC.Common/OS/IOperationSystemManager.cs | 11 ++++ .../DefaultRemoteAssistanceProvider.cs | 31 ++++++----- .../RemoteAssistance/IRemoteAssistanceProvider.cs | 3 +- .../PPC/Tango.PPC.Common/Tango.PPC.Common.csproj | 2 +- .../Tango.PPC.Common/Web/MachineSetupResponse.cs | 1 + .../PPC/Tango.PPC.UI/Images/loading_anim.gif | Bin 0 -> 798338 bytes .../PPC/Tango.PPC.UI/Images/power_off_2.gif | Bin 0 -> 32040 bytes .../PPCApplication/DefaultPPCApplicationManager.cs | 2 +- .../PPC/Tango.PPC.UI/Tango.PPC.UI.csproj | 4 +- .../PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs | 9 ++++ .../PPC/Tango.PPC.UI/Views/LoadingView.xaml | 11 ++-- .../PPC/Tango.PPC.UI/Views/MachineSetupView.xaml | 2 +- .../PPC/Tango.PPC.UI/Views/PowerOffView.xaml | 2 +- .../Tango.PPC.UI/Views/RestartingSystemView.xaml | 40 ++++++++++---- .../Tango.BL/ObservablesStaticCollections.cs | 40 +++++++------- .../Controllers/PPCController.cs | 3 +- 22 files changed, 224 insertions(+), 97 deletions(-) create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Images/loading_anim.gif create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Images/power_off_2.gif (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MachineUpdatesViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MachineUpdatesViewVM.cs index 41bcc2a87..616ad0a47 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MachineUpdatesViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MachineUpdatesViewVM.cs @@ -110,6 +110,8 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels DisplayMachineSetups = true; DisplayDatabaseUpdates = true; DisplaySynchronizations = true; + DisplayOfflineUpdates = true; + DisplayFirmwareUpgrades = true; RefreshCommand = new RelayCommand(Refresh, () => IsFree); } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs index 1bd790eb6..bd08e3e7c 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs @@ -298,7 +298,7 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels { Task.Factory.StartNew(() => { - ActiveMachineAdapter.Dispensers = ActiveMachineAdapter.Context.Dispensers.Where(x => x.SerialNumber.ToLower().StartsWith(DispensersFilter.ToLower())).ToSynchronizedObservableCollection(); + ActiveMachineAdapter.Dispensers = ActiveMachineAdapter.Context.Dispensers.Where(x => x.SerialNumber.ToLower().StartsWith(DispensersFilter.ToLower())).OrderBy(x => x.SerialNumber).ToSynchronizedObservableCollection(); }); }); } @@ -545,32 +545,60 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels { for (int i = 0; i < 8; i++) { - Dispenser dispenser = new Dispenser(); - dispenser.SerialNumber = machineCreationDialogVM.SerialNumber + "-" + (i + 1); + var serial = machineCreationDialogVM.SerialNumber + "-" + (i + 1); + + var existingDispenser = await ActiveMachineAdapter.Context.Dispensers.Include(x => x.IdsPacks).SingleAsync(x => x.SerialNumber == serial); - if (newMachine) + if (existingDispenser != null) { - dispenser.NlPerPulse = machineCreationDialogVM.DispenserFactor; - dispenser.DispenserTypeGuid = ActiveMachineAdapter.DispenserTypes.First().Guid; + if (existingDispenser.IsInstalled) + { + _notification.ShowError($"Dispenser '{serial}' already exists. Cannot create machine."); + return; + } + else + { + if (!_notification.ShowErrorQuestion($"Dispenser '{serial}' already exists and is not installed. Do you wish to assign the existing dispenser to this machine?")) + { + return; + } + } } - else + + Dispenser dispenser = new Dispenser(); + + if (existingDispenser == null) { - var packBefore = machineConfigBeforeClone.NoneEmptyIdsPacks.SingleOrDefault(x => x.PackIndex == i); + dispenser.SerialNumber = serial; - if (packBefore != null) + if (newMachine) { - dispenser.NlPerPulse = packBefore.Dispenser.NlPerPulse; - dispenser.DispenserTypeGuid = packBefore.Dispenser.DispenserType.Guid; + dispenser.NlPerPulse = machineCreationDialogVM.DispenserFactor; + dispenser.DispenserTypeGuid = ActiveMachineAdapter.DispenserTypes.First().Guid; } else { - continue; + var packBefore = machineConfigBeforeClone.NoneEmptyIdsPacks.SingleOrDefault(x => x.PackIndex == i); + + if (packBefore != null) + { + dispenser.NlPerPulse = packBefore.Dispenser.NlPerPulse; + dispenser.DispenserTypeGuid = packBefore.Dispenser.DispenserType.Guid; + } + else + { + continue; + } } - } - dispenser.ProductionDate = DateTime.UtcNow; + dispenser.ProductionDate = DateTime.UtcNow; - ActiveMachineAdapter.Context.Dispensers.Add(dispenser); + ActiveMachineAdapter.Context.Dispensers.Add(dispenser); + } + else + { + dispenser = existingDispenser; + } var idsPack = ActiveMachine.Configuration.NoneEmptyIdsPacks.SingleOrDefault(x => x.PackIndex == i); @@ -950,7 +978,7 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels try { IsFree = false; - MachinesAdapter.Machines = MachinesAdapter.Context.Machines.Where(x => x.SerialNumber.StartsWith(Filter)).Include(x => x.Organization).Include(x => x.MachineVersion).ToSynchronizedObservableCollection(); + MachinesAdapter.Machines = MachinesAdapter.Context.Machines.Where(x => x.SerialNumber.StartsWith(Filter)).Include(x => x.Organization).Include(x => x.MachineVersion).OrderBy(x => x.SerialNumber).ToSynchronizedObservableCollection(); } catch { diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MainView.xaml index bc9b038dc..833086bf0 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MainView.xaml @@ -9,7 +9,7 @@ xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" mc:Ignorable="d" d:DesignHeight="1080" d:DesignWidth="1920" Background="Transparent" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}"> - + diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/SystemViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/SystemViewVM.cs index f3ffcda14..e0b8d278b 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/SystemViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/SystemViewVM.cs @@ -14,12 +14,14 @@ using Tango.PPC.Common; using Tango.PPC.Common.OS; using Tango.Settings; using System.Data.Entity; +using Tango.PPC.Common.UWF; namespace Tango.PPC.Technician.ViewModels { public class SystemViewVM : PPCViewModel { private IOperationSystemManager _os; + private IUnifiedWriteFilterManager _uwf; private Timer _statsTimer; private bool _resettingDevice; @@ -82,9 +84,10 @@ namespace Tango.PPC.Technician.ViewModels public RelayCommand ExitToExplorerCommand { get; set; } - public SystemViewVM(IOperationSystemManager os) + public SystemViewVM(IOperationSystemManager os, IUnifiedWriteFilterManager uwf) { _os = os; + _uwf = uwf; CPU = 0; RAM = 0; @@ -118,11 +121,30 @@ namespace Tango.PPC.Technician.ViewModels private async void FactoryReset() { - if (await NotificationProvider.ShowQuestion("Are you sure you want to reset this device and back to factory settings?")) + if (await NotificationProvider.ShowQuestion("Are you sure you want to reset this device back to factory settings?")) { Settings.ApplicationState = ApplicationStates.FactoryRestore; Settings.Save(); - ApplicationManager.Restart(); + try + { + NotificationProvider.SetGlobalBusyMessage("Disabling write filter protection..."); + await _uwf.Disable(); + await Task.Delay(2000); + NotificationProvider.ReleaseGlobalBusyMessage(); + await NavigationManager.NavigateTo(Common.Navigation.NavigationView.RestartingSystemView); + await Task.Delay(4000); + _os.Restart(); + } + catch (Exception ex) + { + LogManager.Log(ex, "Error executing factory reset."); + NotificationProvider.ReleaseGlobalBusyMessage(); + await NotificationProvider.ShowError($"Error executing factory reset.\n{ex.FlattenMessage()}"); + } + finally + { + NotificationProvider.ReleaseGlobalBusyMessage(); + } } } @@ -138,6 +160,8 @@ namespace Tango.PPC.Technician.ViewModels { if (await NotificationProvider.ShowQuestion("Are you sure you want to restart the device?")) { + await NavigationManager.NavigateTo(Common.Navigation.NavigationView.RestartingSystemView); + await Task.Delay(4000); _os.Restart(); } } @@ -146,12 +170,7 @@ namespace Tango.PPC.Technician.ViewModels { if (await NotificationProvider.ShowQuestion("Close the application and start OS shell?")) { - Process.Start(new ProcessStartInfo() - { - UseShellExecute = true, - FileName = "explorer.exe", - }); - + _os.OpenShell(); ApplicationManager.ShutDown(); } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs index 29daedb4c..2177efecc 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs @@ -235,10 +235,21 @@ namespace Tango.PPC.Common.MachineSetup Login(serialNumber).Wait(); + String deviceName = $"Tango-{serialNumber}-{settings.DeploymentSlot.ToString()}"; + LogManager.Log($"Settings device name: '{deviceName}'..."); + try + { + await _windows_manager.SetDeviceName(deviceName); + } + catch + { + throw new IOException("Error setting device name."); + } + MachineSetupRequest request = new MachineSetupRequest(); request.SerialNumber = serialNumber; request.DeviceID = await _windows_manager.GetDeviceId(); - request.DeviceName = await _windows_manager.GetDeviceName(); + request.DeviceName = deviceName; try { @@ -278,20 +289,20 @@ namespace Tango.PPC.Common.MachineSetup UpdateProgress("Activating operation system license", "Activating..."); await _windows_manager.Activate(setup_response.OSKey); } + } - if (setup_response.SetupRemoteAssistance) - { - LogManager.Log("Installing remote assistance..."); - UpdateProgress("Installing remote assistance", "Installing..."); - await _remoteAssistance.InstallRemoteAssistance(serialNumber, settings.DeploymentSlot.ToString()); - } + if (setup_response.SetupRemoteAssistance) + { + LogManager.Log("Installing remote assistance..."); + UpdateProgress("Installing remote assistance", "Installing..."); + await _remoteAssistance.InstallRemoteAssistance(serialNumber, setup_response.Organization, settings.DeploymentSlot.ToString()); + } - if (setup_response.SetupUWF) - { - LogManager.Log("Activating unified write filter..."); - UpdateProgress("Activating disk protection", "Activating..."); - await _uwf.Setup(); - } + if (setup_response.SetupUWF) + { + LogManager.Log("Activating unified write filter..."); + UpdateProgress("Activating disk protection", "Activating..."); + await _uwf.Setup(); } //Create temporary folders for packages. diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/OS/DefaultOperationSystemManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/OS/DefaultOperationSystemManager.cs index 2164a71c3..32fd74646 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/OS/DefaultOperationSystemManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/OS/DefaultOperationSystemManager.cs @@ -232,5 +232,27 @@ namespace Tango.PPC.Common.OS return Environment.MachineName; }); } + + /// + /// Sets the device host name. + /// + /// + public async Task SetDeviceName(String name) + { + var command = new CmdCommand("wmic", $"computersystem where caption='{Environment.MachineName}' rename '{name}'"); + await command.Run(); + } + + /// + /// Opens the operating system shell (explorer). + /// + public void OpenShell() + { + Process.Start(new ProcessStartInfo() + { + FileName = @"C:\Windows\Sysnative\cmd.exe", + Arguments = @"/c start /B explorer.exe" + }); + } } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/OS/IOperationSystemManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/OS/IOperationSystemManager.cs index 3e24ffe72..4faef33f9 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/OS/IOperationSystemManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/OS/IOperationSystemManager.cs @@ -56,6 +56,12 @@ namespace Tango.PPC.Common.OS /// Task GetDeviceName(); + /// + /// Sets the device host name. + /// + /// + Task SetDeviceName(String name); + /// /// Restarts the system. /// @@ -67,5 +73,10 @@ namespace Tango.PPC.Common.OS /// /// void Shutdown(); + + /// + /// Opens the operating system shell (explorer). + /// + void OpenShell(); } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/RemoteAssistance/DefaultRemoteAssistanceProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/RemoteAssistance/DefaultRemoteAssistanceProvider.cs index 65327e705..c266ba7c0 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/RemoteAssistance/DefaultRemoteAssistanceProvider.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/RemoteAssistance/DefaultRemoteAssistanceProvider.cs @@ -96,8 +96,12 @@ namespace Tango.PPC.Common.RemoteAssistance /// Installs the remote assistance. /// /// The machine serial number. + /// The remote assistance group. + /// The machine working environment. /// - public async Task InstallRemoteAssistance(String machineSerialNumber, String environment) + /// + /// The remote assistance service was installed but could not be found. + public async Task InstallRemoteAssistance(String machineSerialNumber, String group, String environment) { try { @@ -106,26 +110,21 @@ namespace Tango.PPC.Common.RemoteAssistance throw new FileNotFoundException($"The remote assistance installer file could not be found at {_installer_path}."); } - if (!(await IsRemoteAssistanceInstalled())) - { - CmdCommand command = new CmdCommand("msiexec.exe", $"/i \"{_installer_path}\" /qn CUSTOMCONFIGID=ke43ann APITOKEN=4765529-gon1LwO1N1TTrlLI21ji ASSIGNMENTOPTIONS=\" --reassign --alias {"TANGO-" + machineSerialNumber}-{environment} --grant-easy-access\""); - command.Timeout = TimeSpan.FromSeconds(30); - await command.Run(); + String q = "\""; + //CmdCommand command = new CmdCommand("msiexec.exe", $"/i \"{_installer_path}\" /qn CUSTOMCONFIGID=ke43ann APITOKEN=4765529-gon1LwO1N1TTrlLI21ji ASSIGNMENTOPTIONS=\" --reassign --alias {"TANGO-" + machineSerialNumber}-{environment} --grant-easy-access\""); + CmdCommand command = new CmdCommand("msiexec.exe", $"/i {q}{_installer_path}{q} /qn CUSTOMCONFIGID=ke43ann APITOKEN=4765529-gon1LwO1N1TTrlLI21ji ASSIGNMENTOPTIONS={q} --group {q}{q} {group} {q}{q} --reassign --alias TANGO-{machineSerialNumber}-{environment} --grant-easy-access{q}"); + command.Timeout = TimeSpan.FromSeconds(30); + await command.Run(); - bool exist = await IsRemoteAssistanceInstalled(); + bool exist = await IsRemoteAssistanceInstalled(); - if (exist) - { - await DisableRemoteAssistance(); - } - else - { - throw new ApplicationException("The remote assistance service was installed but could not be found."); - } + if (exist) + { + await DisableRemoteAssistance(); } else { - LogManager.Log("Remote assistance is already installed."); + throw new ApplicationException("The remote assistance service was installed but could not be found."); } } catch (Exception ex) diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/RemoteAssistance/IRemoteAssistanceProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/RemoteAssistance/IRemoteAssistanceProvider.cs index 3d3b4e532..3b7d489e6 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/RemoteAssistance/IRemoteAssistanceProvider.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/RemoteAssistance/IRemoteAssistanceProvider.cs @@ -32,8 +32,9 @@ namespace Tango.PPC.Common.RemoteAssistance /// Installs the remote assistance. /// /// The machine serial number. + /// The remote assistance group. /// The machine working environment. /// - Task InstallRemoteAssistance(String machineSerialNumber, String environment); + Task InstallRemoteAssistance(String machineSerialNumber, String group, String environment); } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj b/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj index 7142f461b..6eda39722 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj @@ -421,7 +421,7 @@ - + \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/MachineSetupResponse.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/MachineSetupResponse.cs index a642eddf2..f5d03c6ce 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/MachineSetupResponse.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/MachineSetupResponse.cs @@ -31,5 +31,6 @@ namespace Tango.PPC.Common.Web public bool SetupFPGA { get; set; } public bool IsDemo { get; set; } public String DeviceComPort { get; set; } + public String Organization { get; set; } } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/loading_anim.gif b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/loading_anim.gif new file mode 100644 index 000000000..793007cc4 Binary files /dev/null and b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/loading_anim.gif differ diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/power_off_2.gif b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/power_off_2.gif new file mode 100644 index 000000000..867107140 Binary files /dev/null and b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/power_off_2.gif differ diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs index 149fb549f..003938303 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs @@ -242,7 +242,7 @@ namespace Tango.PPC.UI.PPCApplication { LogManager.Log("Application started with '-update_ok' startup arguments. The application has been successfully updated."); - if (settings.ApplicationState == ApplicationStates.PreSetup) + if (settings.ApplicationState == ApplicationStates.PreSetup || settings.ApplicationState == ApplicationStates.FactoryRestore) { isAfterSetup = true; LogManager.Log("System restart is required."); diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj b/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj index eef669d4f..467b68d8b 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj @@ -428,6 +428,8 @@ + + @@ -691,7 +693,7 @@ if $(ConfigurationName) == Debug copy /Y "$(TargetDir)Packages" "$(TargetDir)" - + \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs index f78a7f334..5c518f60d 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs @@ -31,6 +31,7 @@ namespace Tango.PPC.UI.ViewModels public class MainViewVM : PPCViewModel { private DispatcherTimer _date_timer; + private bool _isPowerUpDialogShown; private DateTime _currentDateTime; /// @@ -100,6 +101,12 @@ namespace Tango.PPC.UI.ViewModels private async void MachineOperator_PowerUpStarted(object sender, EventArgs e) { + if (_isPowerUpDialogShown) + { + LogManager.Log("Power up detected but power up dialog is already shown. Skipping..."); + return; + } + LogManager.Log("Power up detected, showing power up screen..."); if (!Settings.DisplayPowerUpScreen) @@ -136,7 +143,9 @@ namespace Tango.PPC.UI.ViewModels InvokeUI(async () => { + _isPowerUpDialogShown = true; await NotificationProvider.ShowDialog(vm); + _isPowerUpDialogShown = false; await Task.Factory.StartNew(() => { diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LoadingView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LoadingView.xaml index 79d9cd54b..a917695af 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LoadingView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LoadingView.xaml @@ -10,9 +10,9 @@ xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" xmlns:local="clr-namespace:Tango.PPC.UI.Views" mc:Ignorable="d" - d:DesignHeight="1280" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:LoadingViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.LoadingView}"> + d:DesignHeight="1280" d:DesignWidth="800" Background="{StaticResource TangoPrimaryBackgroundBrush}" d:DataContext="{d:DesignInstance Type=vm:LoadingViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.LoadingView}"> - + - - - + + + diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineSetupView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineSetupView.xaml index 9437caac9..40b296d1e 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineSetupView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineSetupView.xaml @@ -25,7 +25,7 @@ - + diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/PowerOffView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/PowerOffView.xaml index 9762ef621..22952a827 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/PowerOffView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/PowerOffView.xaml @@ -11,7 +11,7 @@ d:DesignHeight="1280" d:DesignWidth="800" Background="{StaticResource TangoPrimaryBackgroundBrush}" d:DataContext="{d:DesignInstance Type=vm:PowerOffViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.PowerOffViewVM}"> - + Machine is turning Off Do not unplug machine while turning off ABORT diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/RestartingSystemView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/RestartingSystemView.xaml index 996b1788d..dd4d2f5d5 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/RestartingSystemView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/RestartingSystemView.xaml @@ -10,17 +10,37 @@ mc:Ignorable="d" d:DesignHeight="1280" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:RestartingSystemViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.RestartingSystemViewVM}" Background="{StaticResource TangoPrimaryBackgroundBrush}"> - - - - - Setup completed. - - - - Restarting the system for the last time... - + + + + + + + + + diff --git a/Software/Visual_Studio/Tango.BL/ObservablesStaticCollections.cs b/Software/Visual_Studio/Tango.BL/ObservablesStaticCollections.cs index 1b45e959d..c12b622a4 100644 --- a/Software/Visual_Studio/Tango.BL/ObservablesStaticCollections.cs +++ b/Software/Visual_Studio/Tango.BL/ObservablesStaticCollections.cs @@ -56,73 +56,73 @@ namespace Tango.BL { if (!_initialized) { - progressLog.Invoke("Loading static collections..."); + progressLog?.Invoke("Loading static collections..."); db = ObservablesContext.CreateDefault(); WindingMethods = db.WindingMethods.ToObservableCollection(); - progressLog.Invoke("Loading color spaces..."); + progressLog?.Invoke("Loading color spaces..."); ColorSpaces = db.ColorSpaces.ToObservableCollection(); - progressLog.Invoke("Loading spools..."); + progressLog?.Invoke("Loading spools..."); SpoolTypes = db.SpoolTypes.ToObservableCollection(); - progressLog.Invoke("Loading event..."); + progressLog?.Invoke("Loading event..."); EventTypes = db.EventTypes.ToObservableCollection(); - progressLog.Invoke("Loading blowers..."); + progressLog?.Invoke("Loading blowers..."); HardwareBlowerTypes = db.HardwareBlowerTypes.ToList().OrderByAlphaNumeric(x => x.Description).ToObservableCollection(); //HardwareBlowers = db.HardwareBlowers.ToObservableCollection(); - progressLog.Invoke("Loading break sensors..."); + progressLog?.Invoke("Loading break sensors..."); HardwareBreakSensorTypes = db.HardwareBreakSensorTypes.ToList().OrderByAlphaNumeric(x => x.Description).ToObservableCollection(); //HardwareBreakSensors = db.HardwareBreakSensors.ToObservableCollection(); - progressLog.Invoke("Loading dancers..."); + progressLog?.Invoke("Loading dancers..."); HardwareDancerTypes = db.HardwareDancerTypes.ToList().OrderByAlphaNumeric(x => x.Description).ToObservableCollection(); //HardwareDancers = db.HardwareDancers.ToObservableCollection(); - progressLog.Invoke("Loading motors..."); + progressLog?.Invoke("Loading motors..."); HardwareMotorTypes = db.HardwareMotorTypes.ToList().OrderByAlphaNumeric(x => x.Description).ToObservableCollection(); //HardwareMotors = db.HardwareMotors.ToObservableCollection(); - progressLog.Invoke("Loading pid controls..."); + progressLog?.Invoke("Loading pid controls..."); HardwarePidControlTypes = db.HardwarePidControlTypes.ToList().OrderByAlphaNumeric(x => x.Description).ToObservableCollection(); //HardwarePidControls = db.HardwarePidControls.ToObservableCollection(); - progressLog.Invoke("Loading speed sensors..."); + progressLog?.Invoke("Loading speed sensors..."); HardwareSpeedSensorTypes = db.HardwareSpeedSensorTypes.ToList().OrderByAlphaNumeric(x => x.Description).ToObservableCollection(); //HardwareSpeedSensors = db.HardwareSpeedSensors.ToObservableCollection(); - progressLog.Invoke("Loading winders..."); + progressLog?.Invoke("Loading winders..."); HardwareWinderTypes = db.HardwareWinderTypes.ToList().OrderByAlphaNumeric(x => x.Description).ToObservableCollection(); //HardwareWinders = db.HardwareWinders.ToObservableCollection(); - progressLog.Invoke("Loading tech controllers..."); + progressLog?.Invoke("Loading tech controllers..."); TechControllers = db.TechControllers.ToList().OrderByAlphaNumeric(x => x.Description).ToObservableCollection(); - progressLog.Invoke("Loading tech dispensers..."); + progressLog?.Invoke("Loading tech dispensers..."); TechDispensers = db.TechDispensers.ToList().OrderByAlphaNumeric(x => x.Description).ToObservableCollection(); - progressLog.Invoke("Loading tech io's..."); + progressLog?.Invoke("Loading tech io's..."); TechIos = db.TechIos.ToObservableCollection(); - progressLog.Invoke("Loading tech monitors..."); + progressLog?.Invoke("Loading tech monitors..."); TechMonitors = db.TechMonitors.ToList().OrderByAlphaNumeric(x => x.Description).ToObservableCollection(); - progressLog.Invoke("Loading tech valves..."); + progressLog?.Invoke("Loading tech valves..."); TechValves = db.TechValves.ToList().OrderByAlphaNumeric(x => x.Description).ToObservableCollection(); - progressLog.Invoke("Loading tech heaters..."); + progressLog?.Invoke("Loading tech heaters..."); TechHeaters = db.TechHeaters.ToList().OrderByAlphaNumeric(x => x.Description).ToObservableCollection(); - progressLog.Invoke("Loading machines..."); + progressLog?.Invoke("Loading machines..."); Machines = db.Machines.Include(x => x.Organization).ToObservableCollection(); - progressLog.Invoke("Loading users..."); + progressLog?.Invoke("Loading users..."); Users = db.Users.Where(x => !x.Deleted).Include(x => x.Contact).ToObservableCollection(); - progressLog.Invoke("Loading machine versions..."); + progressLog?.Invoke("Loading machine versions..."); MachineVersions = db.MachineVersions.ToObservableCollection(); //Load later... diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs index 1bb025217..6ac2e3657 100644 --- a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs +++ b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs @@ -71,7 +71,7 @@ namespace Tango.MachineService.Controllers { String machine_guid = RequestToken.Object.MachineGuid; - var machine = db.Machines.SingleOrDefault(x => x.Guid == machine_guid); + var machine = db.Machines.Include(x => x.Organization).SingleOrDefault(x => x.Guid == machine_guid); if (machine == null) { @@ -151,6 +151,7 @@ namespace Tango.MachineService.Controllers response.SetupUWF = machine.SetupUwf; response.SetupFirmware = machine.SetupFirmware; response.IsDemo = machine.IsDemo; + response.Organization = machine.Organization.Name; TangoUpdate tangoUpdate = new TangoUpdate(); tangoUpdate.ApplicationVersion = latest_machine_version.Version; -- cgit v1.3.1