void setupComponents()
 {
     _lockData = (LockData)_lockFactory.CreateandReturnObj (LockClassesEnumeration.LockData);
     _dataReader = (LockDataReader)_lockFactory.CreateandReturnObj (LockClassesEnumeration.LockDataReader);
     _alarmer = (LockAlarmer)_lockFactory.CreateandReturnObj (LockClassesEnumeration.LockAlarmer);
     _alarmer.UpperLevelAlarm += new EventHandler(soundMutableAlarm);
     _alarmer.LowerLevelAlarm += new EventHandler(soundMutableAlarm);
     _alarmer.FlowRateAlarm += new EventHandler(soundMutableAlarm);
     _tickTimer.Stop ();
     _tickTimer.Interval = TimeSpan.FromMilliseconds (1000);
     _tickTimer.Tick += new EventHandler (updateReadings);
 }
Exemple #2
0
 public Object CreateandReturnObj(LockClassesEnumeration objectToGet)
 {
     object createdObject = null;
     switch (objectToGet)
     {
     case LockClassesEnumeration.LockAlarmer:
         LockAlarmer alarmer = new LockAlarmer();
         createdObject = alarmer;
         break;
     case LockClassesEnumeration.LockDataReader:
         LockDataReader dataReader = new LockDataReader();
         createdObject = dataReader;
         break;
     case LockClassesEnumeration.LockData:
         LockData lockData = new LockData();
         createdObject = lockData;
         break;
     default:
         throw new ArgumentException("Invalid parameter passed");
     }
     return createdObject;
 }