FUSIONVirFactory.cs 1009 B

12345678910111213141516171819202122232425262728293031323334353637
  1. using System.Collections.Generic;
  2. using Wayne.ForecourtControl.Fusion;
  3. namespace Wayne.ForecourtControl.Vir.Fusion
  4. {
  5. public static class FUSIONVirFactory
  6. {
  7. static List<IVir> virList = new List<IVir>();
  8. // Methods
  9. public static IVir CreateVir(int fcId, int id)
  10. {
  11. FUSIONVir vir = new FUSIONVir(fcId, id);
  12. virList.Add(vir);
  13. return vir;
  14. }
  15. public static System.Collections.ObjectModel.ReadOnlyCollection<IVir> Virs
  16. {
  17. get { return virList.AsReadOnly(); }
  18. }
  19. public static IVir getVir(int deviceId)
  20. {
  21. foreach (FUSIONVir fusionVir in FUSIONVirFactory.virList)
  22. {
  23. if (fusionVir.Id == deviceId)
  24. {
  25. return fusionVir;
  26. }
  27. }
  28. Trace.WriteLineIf(Trace.CheckTraceLevel(2), string.Format("vir={0} NOT found", deviceId));
  29. return null;
  30. }
  31. }
  32. }