aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner')
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs20
1 files changed, 16 insertions, 4 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..d52daaea2 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,14 @@ 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();
+
+ Sites = ActiveMachine.Organization != null ? _all_sites.Where(x => ActiveMachine.Organization.Sites.All(y => y.OrganizationGuid == x.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)
@@ -651,7 +655,7 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
}
}
}
-
+
private async void Configuration_HardwareVersionChanged(object sender, HardwareVersion e)
{
var version = ActiveMachine.Configuration.HardwareVersion;
@@ -997,5 +1001,13 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
});
}
}
+
+ private void ActiveMachine_OrganizationChanged(object sender, Organization e)
+ {
+ var sites = ActiveMachine.Organization != null ? _all_sites.Where(x => ActiveMachine.Organization.Sites.All(y => y.OrganizationGuid == x.OrganizationGuid)).ToList() : new List<Site>();
+ sites.Insert(0, new Site() { Name = "NONE", ID = -1 });
+ Sites = sites;
+ SelectedSite = Sites.SingleOrDefault(x => x.Guid == ActiveMachine.SiteGuid);
+ }
}
}