diff options
Diffstat (limited to 'Software/Visual_Studio/Tango.BL/ObservablesStaticCollections.cs')
| -rw-r--r-- | Software/Visual_Studio/Tango.BL/ObservablesStaticCollections.cs | 78 |
1 files changed, 25 insertions, 53 deletions
diff --git a/Software/Visual_Studio/Tango.BL/ObservablesStaticCollections.cs b/Software/Visual_Studio/Tango.BL/ObservablesStaticCollections.cs index 807b95935..1e0d5546d 100644 --- a/Software/Visual_Studio/Tango.BL/ObservablesStaticCollections.cs +++ b/Software/Visual_Studio/Tango.BL/ObservablesStaticCollections.cs @@ -15,14 +15,8 @@ namespace Tango.BL { public partial class ObservablesStaticCollections : ExtendedObject { - private ObservablesContext db; - private bool _initialized; - public bool IsInitialized - { - get { return _initialized; } - private set { _initialized = value; } - } + private ObservablesContext db; private static ObservablesStaticCollections _instance; /// <summary> @@ -58,79 +52,57 @@ namespace Tango.BL /// <summary> /// Initializes this instance. /// </summary> - public void Initialize(Action<String> progressLog = null) + public void Initialize() { if (!_initialized) { - progressLog?.Invoke("Loading static collections..."); db = ObservablesContext.CreateDefault(); + TaskSequencer sequencer = new TaskSequencer(); + WindingMethods = db.WindingMethods.ToObservableCollection(); - progressLog?.Invoke("Loading color spaces..."); ColorSpaces = db.ColorSpaces.ToObservableCollection(); - - progressLog?.Invoke("Loading spools..."); SpoolTypes = db.SpoolTypes.ToObservableCollection(); - progressLog?.Invoke("Loading events..."); EventTypes = db.EventTypes.ToObservableCollection(); - progressLog?.Invoke("Loading blowers..."); - HardwareBlowerTypes = db.HardwareBlowerTypes.ToList().OrderByAlphaNumeric(x => x.Description).ToObservableCollection(); - //HardwareBlowers = db.HardwareBlowers.ToObservableCollection(); + HardwareBlowerTypes = db.HardwareBlowerTypes.ToObservableCollection(); + HardwareBlowers = db.HardwareBlowers.ToObservableCollection(); - progressLog?.Invoke("Loading break sensors..."); - HardwareBreakSensorTypes = db.HardwareBreakSensorTypes.ToList().OrderByAlphaNumeric(x => x.Description).ToObservableCollection(); - //HardwareBreakSensors = db.HardwareBreakSensors.ToObservableCollection(); + HardwareBreakSensorTypes = db.HardwareBreakSensorTypes.ToObservableCollection(); + HardwareBreakSensors = db.HardwareBreakSensors.ToObservableCollection(); - progressLog?.Invoke("Loading dancers..."); - HardwareDancerTypes = db.HardwareDancerTypes.ToList().OrderByAlphaNumeric(x => x.Description).ToObservableCollection(); - //HardwareDancers = db.HardwareDancers.ToObservableCollection(); + HardwareDancerTypes = db.HardwareDancerTypes.ToObservableCollection(); + HardwareDancers = db.HardwareDancers.ToObservableCollection(); - progressLog?.Invoke("Loading motors..."); - HardwareMotorTypes = db.HardwareMotorTypes.ToList().OrderByAlphaNumeric(x => x.Description).ToObservableCollection(); - //HardwareMotors = db.HardwareMotors.ToObservableCollection(); + HardwareMotorTypes = db.HardwareMotorTypes.ToObservableCollection(); + HardwareMotors = db.HardwareMotors.ToObservableCollection(); - progressLog?.Invoke("Loading pid controls..."); - HardwarePidControlTypes = db.HardwarePidControlTypes.ToList().OrderByAlphaNumeric(x => x.Description).ToObservableCollection(); - //HardwarePidControls = db.HardwarePidControls.ToObservableCollection(); + HardwarePidControlTypes = db.HardwarePidControlTypes.ToObservableCollection(); + HardwarePidControls = db.HardwarePidControls.ToObservableCollection(); - progressLog?.Invoke("Loading speed sensors..."); - HardwareSpeedSensorTypes = db.HardwareSpeedSensorTypes.ToList().OrderByAlphaNumeric(x => x.Description).ToObservableCollection(); - //HardwareSpeedSensors = db.HardwareSpeedSensors.ToObservableCollection(); + HardwareSpeedSensorTypes = db.HardwareSpeedSensorTypes.ToObservableCollection(); + HardwareSpeedSensors = db.HardwareSpeedSensors.ToObservableCollection(); - progressLog?.Invoke("Loading winders..."); - HardwareWinderTypes = db.HardwareWinderTypes.ToList().OrderByAlphaNumeric(x => x.Description).ToObservableCollection(); - //HardwareWinders = db.HardwareWinders.ToObservableCollection(); + HardwareWinderTypes = db.HardwareWinderTypes.ToObservableCollection(); + HardwareWinders = db.HardwareWinders.ToObservableCollection(); - progressLog?.Invoke("Loading tech controllers..."); - TechControllers = db.TechControllers.ToList().OrderByAlphaNumeric(x => x.Description).ToObservableCollection(); - - progressLog?.Invoke("Loading tech dispensers..."); - TechDispensers = db.TechDispensers.ToList().OrderByAlphaNumeric(x => x.Description).ToObservableCollection(); - - progressLog?.Invoke("Loading tech io's..."); + TechControllers = db.TechControllers.ToObservableCollection(); + TechDispensers = db.TechDispensers.ToObservableCollection(); TechIos = db.TechIos.ToObservableCollection(); + TechMonitors = db.TechMonitors.ToObservableCollection(); + TechValves = db.TechValves.ToObservableCollection(); + TechHeaters = db.TechHeaters.ToObservableCollection(); - progressLog?.Invoke("Loading tech monitors..."); - TechMonitors = db.TechMonitors.ToList().OrderByAlphaNumeric(x => x.Description).ToObservableCollection(); - - progressLog?.Invoke("Loading tech valves..."); - TechValves = db.TechValves.ToList().OrderByAlphaNumeric(x => x.Description).ToObservableCollection(); - - progressLog?.Invoke("Loading tech heaters..."); - TechHeaters = db.TechHeaters.ToList().OrderByAlphaNumeric(x => x.Description).ToObservableCollection(); - - progressLog?.Invoke("Loading machines..."); Machines = db.Machines.Include(x => x.Organization).ToObservableCollection(); - progressLog?.Invoke("Loading users..."); Users = db.Users.Where(x => !x.Deleted).Include(x => x.Contact).ToObservableCollection(); - progressLog?.Invoke("Loading machine versions..."); MachineVersions = db.MachineVersions.ToObservableCollection(); + + //Load later... Task.Factory.StartNew(() => { |
