From 00cfb0906e164487efed62bd6a65cdf681952bd1 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Wed, 1 Aug 2018 11:47:10 +0300 Subject: Implemented reloading of color lab module and research module when machine designer changes machine ! --- .../ViewModels/MainViewVM.cs | 27 ++++++++++++++++++---- 1 file changed, 22 insertions(+), 5 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs') 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 9ac78ccec..569359066 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 @@ -180,8 +180,8 @@ namespace Tango.MachineStudio.Developer.ViewModels if (_selectedMachine != null) { - _selectedMachine.Modified -= SelectedMachine_Saved; - _selectedMachine.Modified += SelectedMachine_Saved; + _selectedMachine.Modified -= SelectedMachine_Modified; + _selectedMachine.Modified += SelectedMachine_Modified; } } } @@ -627,6 +627,11 @@ namespace Tango.MachineStudio.Developer.ViewModels /// Gets or sets the display job embroidery file command. /// public RelayCommand DisplayJobEmbroideryFileCommand { get; set; } + + /// + /// Gets or sets the reload machines command. + /// + public RelayCommand ReloadMachinesCommand { get; set; } #endregion #region Constructors @@ -703,6 +708,7 @@ namespace Tango.MachineStudio.Developer.ViewModels PushProcessParametersCommand = new RelayCommand(PushProcessParameters, () => SelectedRML != null && SelectedRML.ProcessParametersTablesGroups.Count > 0 && SelectedProcessParametersTable != null && MachineOperator != null); ImportEmbroideryFileCommand = new RelayCommand(ImportEmbroideryFile, () => SelectedMachine != null); DisplayJobEmbroideryFileCommand = new RelayCommand(DisplayJobEmbroideryFile); + ReloadMachinesCommand = new RelayCommand(ReloadMachine); ApplicationManager.ConnectedMachineChanged += ApplicationManager_ConnectedMachineChanged; @@ -850,10 +856,21 @@ namespace Tango.MachineStudio.Developer.ViewModels /// /// The source of the event. /// The instance containing the event data. - private void SelectedMachine_Saved(object sender, EventArgs e) + private void SelectedMachine_Modified(object sender, ObservableModifiedEventArgs e) { - InvalidateLiquidFactorsAndProcessTables(); - SelectedMachine.Reload(_machineDbContext); + if (e.IsOtherContext) + { + InvokeUI(() => + { + SelectedMachine.Reload(_machineDbContext); + InvalidateLiquidFactorsAndProcessTables(); + + if (SelectedSegment != null) + { + OnSelectedSegmentChanged(); + } + }); + } } /// -- cgit v1.3.1