Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            var queue        = new ConcurrentQueue <PresenceContainer>();
            var dataEvent    = new AutoResetEvent(false);
            var config       = new XmlConfiguration();
            var configValues = config.Deserialize();

            var alarm  = AlarmFactory.CreateAlarm(configValues.Alarm);
            var filter = FilterFactory.CreateFilter(configValues.Filter);
            var log    = LogFactory.CreateLog(configValues.Log);

            var producer   = new Producer(queue);
            var consumer   = new Consumer(queue, dataEvent);
            var controller = new CtrlHospitalBed(dataEvent, consumer, alarm, filter, log);

            var consumerThread   = new Thread(consumer.Run);
            var producerThread   = new Thread(producer.Run);
            var controllerThread = new Thread(controller.RunSystem);
            var checkThread      = new Thread(controller.CheckKeyChar);

            consumerThread.Start();
            producerThread.Start();
            controllerThread.Start();
            checkThread.Start();
        }
 public void ChooseAlarm(AlarmType alarmType)
 {
     _alarm.DetachFrom(_filter);
     _alarm = AlarmFactory.CreateAlarm(alarmType);
     _alarm.AttachTo(_filter);
 }