Example #1
0
        public void RemoveBedsideSystem(Guid bedsideId)
        {
            var bedsideSystem = BedsideSystems.Single(b => b.BedsideSystemId == bedsideId);

            BedsideSystems.Remove(bedsideSystem);
            bedsideSystem.OnAlarmRaised -= NotifyAlarmRaised;
            bedsideSystem.Dispose();
        }
        public static void Main()
        {
            var initialBedsideSystems          = int.Parse(ConfigurationManager.AppSettings["InitialBedsideSystems"]);
            var initialModulesPerBedsideSystem = int.Parse(ConfigurationManager.AppSettings["InitialModulesPerBedsideSystem"]);
            var initialMinValue = int.Parse(ConfigurationManager.AppSettings["InitialMinValue"]);
            var initialMaxValue = int.Parse(ConfigurationManager.AppSettings["InitialMaxValue"]);

            int nextModuleNumber = 1;

            // Create all of the bedside systems and their modules
            for (var bedsideSystemNumber = 1; bedsideSystemNumber <= initialBedsideSystems; bedsideSystemNumber++)
            {
                IBedsideSystem bedsideSystem = new BedsideSystem($"Bedside System {bedsideSystemNumber}");
                for (var moduleNumber = 1; moduleNumber < initialModulesPerBedsideSystem + 1; moduleNumber++)
                {
                    ModuleType moduleType = getModuleType();
                    IModule    newModule  = new Module($"Module {nextModuleNumber}", moduleType, initialMinValue, initialMaxValue);

                    nextModuleNumber++;
                    bedsideSystem.AddModule(newModule);
                }
                // Add the newly created bedside system to the list
                BedsideSystems.Add(bedsideSystem);
            }

            // Create the Control System
            ControlSystem           controlSystem          = new ControlSystem(BedsideSystems);
            ControlSystemController controlSytemController = new ControlSystemController(controlSystem);

            // Now create the view for the Control System
            Application.SetCompatibleTextRenderingDefault(false);
            ControlSystemView controlSystemView = new ControlSystemView(controlSytemController);


            // Start the view for the Control System
            Application.EnableVisualStyles();
            Application.Run(CreateControlForm(controlSystemView));

            // Closing the control system view form causes the controlSystem to dispose, which then cascades to
            // disposing bedside systems and their associated modules.
            controlSystem.Dispose();
        }
Example #3
0
 private void AddBedsideSystem(IBedsideSystem bedsideSystem)
 {
     BedsideSystems.Add(bedsideSystem);
     bedsideSystem.OnAlarmRaised += NotifyAlarmRaised;
 }