aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels')
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs18
1 files changed, 16 insertions, 2 deletions
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 ed93b4308..9c4c2281d 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,6 +39,7 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
private ActionTimer _machines_action_timer;
private ActionTimer _dispensers_action_timer;
private MachineDTO _machineBeforeSave;
+ private List<Site> _all_sites;
#region Properties
@@ -609,11 +610,15 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
}
}
}
+ ActiveMachine.OrganizationChanged -= ActiveMachine_OrganizationChanged;
+ ActiveMachine.OrganizationChanged += ActiveMachine_OrganizationChanged;
- var sites = await ActiveMachineAdapter.Context.Sites.ToListAsync();
- sites.Insert(0, new Site() { Name = "NONE", ID = -1 });
+ _all_sites = await ActiveMachineAdapter.Context.Sites.ToListAsync();
+ var sites = ActiveMachine.Organization != null ? _all_sites.Where(x => x.OrganizationGuid == ActiveMachine.OrganizationGuid).ToList() : new List<Site>();
+ sites.Insert(0, new Site() { Name = "NONE", ID = -1 });
Sites = sites;
+
SelectedSite = Sites.SingleOrDefault(x => x.Guid == ActiveMachine.SiteGuid);
ColorCalibrationViewVM = new ColorCalibrationViewVM(_notification, ActiveMachine, _activeMachineAdapter.Context)
@@ -997,5 +1002,14 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
});
}
}
+
+ private void ActiveMachine_OrganizationChanged(object sender, Organization e)
+ {
+ var sites = ActiveMachine.Organization != null ? _all_sites.Where(x => x.OrganizationGuid == ActiveMachine.OrganizationGuid).ToList() : new List<Site>();
+ sites.Insert(0, new Site() { Name = "NONE", ID = -1 });
+ Sites = sites;
+
+ SelectedSite = Sites.SingleOrDefault(x => x.Guid == ActiveMachine.SiteGuid);
+ }
}
}