aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer')
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs88
1 files changed, 59 insertions, 29 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 99d275744..8314238fd 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
@@ -562,6 +562,11 @@ namespace Tango.MachineStudio.Developer.ViewModels
/// </summary>
public RelayCommand DuplicateBrushStopCommand { get; set; }
+ /// <summary>
+ /// Gets or sets the push process parameters command.
+ /// </summary>
+ public RelayCommand PushProcessParametersCommand { get; set; }
+
#endregion
#region Constructors
@@ -613,7 +618,6 @@ namespace Tango.MachineStudio.Developer.ViewModels
EditMachineCommand = new RelayCommand(EditMachine, () => SelectedMachine != null);
EditRMLCommand = new RelayCommand(EditRML, () => SelectedRML != null);
ToggleSideBarCommand = new RelayCommand(() => IsSideBarOpened = !IsSideBarOpened);
- SaveProcessParametersCommand = new RelayCommand(SaveProcessParameters, () => SelectedRML != null && SelectedRML.ProcessParametersTablesGroups.Count > 0);
SaveLiquidFactorsCommand = new RelayCommand(SaveLiquidFactors, () => SelectedRML != null);
AddSegmentCommand = new RelayCommand(AddSegment, () => ActiveJob != null);
RemoveSegmentCommand = new RelayCommand(RemoveSelectedSegments, () => SelectedSegment != null);
@@ -623,13 +627,15 @@ namespace Tango.MachineStudio.Developer.ViewModels
RemoveBrushStopCommand = new RelayCommand(RemoveSelectedBrushStops, () => SelectedBrushStop != null);
SaveJobCommand = new RelayCommand(SaveActiveJob, () => SelectedMachine != null);
DiscardJobCommand = new RelayCommand(BackToJobs, () => SelectedMachine != null);
- StartJobCommand = new RelayCommand(StartJob, () => ActiveJob != null && !IsJobRunning);
+ StartJobCommand = new RelayCommand(StartJob, () => ActiveJob != null && !IsJobRunning && MachineOperator != null);
StopJobCommand = new RelayCommand(StopJob, () => IsJobRunning);
CloseJobCompletionStatusCommand = new RelayCommand(CloseJobCompletionStatusBar);
LoadJobCommand = new RelayCommand(LoadSelectedJob, () => SelectedMachineJob != null);
DuplicateJobCommand = new RelayCommand(DuplicateSelectedJobs, () => SelectedMachineJob != null);
DuplicateSegmentCommand = new RelayCommand(DuplicateSelectedSegments, () => SelectedSegment != null);
DuplicateBrushStopCommand = new RelayCommand(DuplicateSelectedBrushStops, () => SelectedBrushStop != null);
+ SaveProcessParametersCommand = new RelayCommand(SaveProcessParameters, () => SelectedRML != null && SelectedRML.ProcessParametersTablesGroups.Count > 0);
+ PushProcessParametersCommand = new RelayCommand(PushProcessParameters, () => SelectedRML != null && SelectedRML.ProcessParametersTablesGroups.Count > 0 && SelectedProcessParametersTable != null && MachineOperator != null);
ApplicationManager.ConnectedMachineChanged += ApplicationManager_ConnectedMachineChanged;
}
@@ -1048,6 +1054,57 @@ namespace Tango.MachineStudio.Developer.ViewModels
}
/// <summary>
+ /// Invalidates the liquid factors and process parameters tables.
+ /// </summary>
+ private void InvalidateLiquidFactorsAndProcessTables()
+ {
+ if (SelectedRML != null && SelectedMachine != null)
+ {
+ LogManager.Log("Invalidating liquid factors, process parameters and process group history...");
+ LiquidTypesRmls = SelectedMachine.Configuration.IdsPacks.OrderBy(x => x.PackIndex).Select(x => x.LiquidType).SelectMany(x => x.LiquidTypesRmls).Where(x => x.Rml.Guid == SelectedRML.Guid).ToList();
+ RmlProcessParametersTableGroup = SelectedRML.ProcessParametersTablesGroups.ToList().SingleOrDefault(x => x.Active);
+
+ var selectedHistory = RmlProcessParametersTableGroup;
+
+ if (RmlProcessParametersTableGroup != null)
+ {
+ RmlProcessParametersTableGroup = RmlProcessParametersTableGroup.CloneGroup();
+ RmlProcessParametersTableGroup.ProcessParametersTables = RmlProcessParametersTableGroup.ProcessParametersTables.OrderBy(x => x.TableIndex).ToObservableCollection();
+ }
+
+ GroupsHistory = SelectedRML.ProcessParametersTablesGroups.OrderByDescending(x => x.SaveDate).OrderBy(x => !x.Active).ToObservableCollection();
+
+ _selectedGroupHistory = selectedHistory;
+
+ RaisePropertyChangedAuto(nameof(SelectedGroupHistory));
+ }
+ }
+
+ #endregion
+
+ #region Process Parameters Management
+
+ /// <summary>
+ /// Uploads the selected process parameters table.
+ /// </summary>
+ private async void PushProcessParameters()
+ {
+ using (_notification.PushTaskItem("Uploading Process Parameters..."))
+ {
+ try
+ {
+ LogManager.Log(String.Format("Uploading process parameters table {0}...", SelectedProcessParametersTable.Name));
+ await MachineOperator.UploadProcessParameters(SelectedProcessParametersTable);
+ }
+ catch (Exception ex)
+ {
+ LogManager.LogFormat(ex, "Failed to upload process parameters table {0}", SelectedProcessParametersTable.Name);
+ _notification.ShowError("Failed to upload the selected process parameters." + Environment.NewLine + ex.Message);
+ }
+ }
+ }
+
+ /// <summary>
/// Saves the process parameters group.
/// </summary>
private async void SaveProcessParameters()
@@ -1087,33 +1144,6 @@ namespace Tango.MachineStudio.Developer.ViewModels
}
}
- /// <summary>
- /// Invalidates the liquid factors and process parameters tables.
- /// </summary>
- private void InvalidateLiquidFactorsAndProcessTables()
- {
- if (SelectedRML != null && SelectedMachine != null)
- {
- LogManager.Log("Invalidating liquid factors, process parameters and process group history...");
- LiquidTypesRmls = SelectedMachine.Configuration.IdsPacks.OrderBy(x => x.PackIndex).Select(x => x.LiquidType).SelectMany(x => x.LiquidTypesRmls).Where(x => x.Rml.Guid == SelectedRML.Guid).ToList();
- RmlProcessParametersTableGroup = SelectedRML.ProcessParametersTablesGroups.ToList().SingleOrDefault(x => x.Active);
-
- var selectedHistory = RmlProcessParametersTableGroup;
-
- if (RmlProcessParametersTableGroup != null)
- {
- RmlProcessParametersTableGroup = RmlProcessParametersTableGroup.CloneGroup();
- RmlProcessParametersTableGroup.ProcessParametersTables = RmlProcessParametersTableGroup.ProcessParametersTables.OrderBy(x => x.TableIndex).ToObservableCollection();
- }
-
- GroupsHistory = SelectedRML.ProcessParametersTablesGroups.OrderByDescending(x => x.SaveDate).OrderBy(x => !x.Active).ToObservableCollection();
-
- _selectedGroupHistory = selectedHistory;
-
- RaisePropertyChangedAuto(nameof(SelectedGroupHistory));
- }
- }
-
#endregion
#region Active Job Management