diff options
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels')
| -rw-r--r-- | Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs | 44 |
1 files changed, 31 insertions, 13 deletions
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 60c2e65f9..55dd370d1 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 @@ -644,6 +644,16 @@ namespace Tango.MachineStudio.Developer.ViewModels /// Gets or sets the reload machines command. /// </summary> public RelayCommand ReloadMachinesCommand { get; set; } + + /// <summary> + /// Gets or sets the back to job command. + /// </summary> + public RelayCommand BackToJobCommand { get; set; } + + /// <summary> + /// Gets or sets to running job command. + /// </summary> + public RelayCommand ToRunningJobCommand { get; set; } #endregion #region Constructors @@ -717,6 +727,9 @@ namespace Tango.MachineStudio.Developer.ViewModels return null; } }); + + BackToJobCommand = new RelayCommand(BackToJob); + ToRunningJobCommand = new RelayCommand(ToRunningJob); } #endregion @@ -1310,6 +1323,16 @@ namespace Tango.MachineStudio.Developer.ViewModels } } + private void BackToJob() + { + _navigation.NavigateTo(DeveloperNavigationView.JobView); + } + + private void ToRunningJob() + { + _navigation.NavigateTo(DeveloperNavigationView.RunningJobView); + } + #endregion #region RML @@ -1357,7 +1380,7 @@ namespace Tango.MachineStudio.Developer.ViewModels LogManager.Log("Invalidating liquid factors, process parameters and process group history..."); LiquidTypesRmls = ActiveJob.Machine.Configuration.NoneEmptyIdsPacks.Where(x => !x.IsEmpty).OrderBy(x => x.PackIndex).Select(x => x.LiquidType).SelectMany(x => x.LiquidTypesRmls).Where(x => x.Rml.Guid == SelectedRML.Guid).ToList(); - _activeJobDbContext.ProcessParametersTablesGroups.Where(x => x.RmlGuid == SelectedRML.Guid).Include(x => x.ProcessParametersTables).ToList(); + _activeJobDbContext.Adapter.GetRmlProcessParametersTablesGroups(SelectedRML.Guid); RmlProcessParametersTableGroup = SelectedRML.ProcessParametersTablesGroups.ToList().SingleOrDefault(x => x.Active); @@ -1366,7 +1389,7 @@ namespace Tango.MachineStudio.Developer.ViewModels if (RmlProcessParametersTableGroup != null) { RmlProcessParametersTableGroup = RmlProcessParametersTableGroup.Clone(); - RmlProcessParametersTableGroup.ProcessParametersTables = RmlProcessParametersTableGroup.ProcessParametersTables.OrderBy(x => x.TableIndex).ToObservableCollection(); + RmlProcessParametersTableGroup.ProcessParametersTables = RmlProcessParametersTableGroup.ProcessParametersTables.OrderBy(x => x.TableIndex).ToSynchronizedObservableCollection(); } @@ -1445,7 +1468,7 @@ namespace Tango.MachineStudio.Developer.ViewModels } group.Active = true; - group.ProcessParametersTables = tables.ToObservableCollection(); + group.ProcessParametersTables = tables.ToSynchronizedObservableCollection(); group.Rml = SelectedRML; group.Name = response; group.SaveDate = DateTime.UtcNow; @@ -1509,7 +1532,7 @@ namespace Tango.MachineStudio.Developer.ViewModels SpoolTypes = _activeJobDbContext.SpoolTypes.ToObservableCollection(); LogManager.Log("Setting active job..."); - ActiveJob = _activeJobDbContext.Jobs.Include(x => x.Rml).Include(x => x.Segments).Include(x => x.Segments.Select(y => y.BrushStops)).SingleOrDefault(x => x.Guid == SelectedMachineJob.Guid); + ActiveJob = _activeJobDbContext.Adapter.GetJob(SelectedMachineJob.Guid); _activeJobDbContext.Ccts.Where(x => x.RmlGuid == ActiveJob.RmlGuid).ToList(); _activeJobDbContext.Cats.Where(x => x.RmlGuid == ActiveJob.RmlGuid).ToList(); @@ -1646,18 +1669,13 @@ namespace Tango.MachineStudio.Developer.ViewModels using (_notification.PushTaskItem("Loading selected machine...")) { await _machineDbContext.Jobs.Where(x => x.MachineGuid == SelectedMachine.Guid).Include(x => x.User).Include(x => x.User.Contact).LoadAsync(); - await _machineDbContext.Configurations.SingleOrDefaultAsync(x => x.Guid == SelectedMachine.ConfigurationGuid); await _machineDbContext.ColorSpaces.LoadAsync(); - SelectedMachine.Configuration.IdsPacks.EnableCrossThreadOperations(); - - await _machineDbContext.IdsPacks.OrderBy(x => x.PackIndex).Where(x => x.ConfigurationGuid == SelectedMachine.ConfigurationGuid). - Include(x => x.CartridgeType). - Include(x => x.DispenserType). - Include(x => x.LiquidType). - Include(x => x.IdsPackFormula). - Include(x => x.MidTankType).LoadAsync(); + await Task.Factory.StartNew(() => + { + _machineDbContext.Adapter.GetConfiguration(x => x.Guid == SelectedMachine.ConfigurationGuid); + }); RaisePropertyChanged(nameof(SelectedMachine)); |
