StorageContent.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. using System;
  2. using SHJX.Service.ServerClient;
  3. using System.Collections.Concurrent;
  4. using SHJX.Service.Control.PortOperate.Interface;
  5. namespace SHJX.Service.Control.PortOperate.Content
  6. {
  7. public class StorageContent
  8. {
  9. private readonly ConcurrentDictionary<string, StorageOperateImp> _storages;
  10. public StorageContent(OptClient client)
  11. {
  12. _storages = new ConcurrentDictionary<string, StorageOperateImp>();
  13. _storages.TryAdd("Timer", new TimerOperate(client));
  14. _storages.TryAdd("DripNozzle", new DripNozzleOperate(client));
  15. //_storages.TryAdd("DripNozzle2", new DripNozzleOperateHigh(client));
  16. //_storages.TryAdd("TitrationStir2", new TitrationStirOperateHigh(client));
  17. //_storages.TryAdd("Indicator2", new IndicatorOperateHigh(client));
  18. _storages.TryAdd("SilverSulfatePipe", new SilverSulfatePipeOperate(client));
  19. _storages.TryAdd("Mercury", new MercuryOperate(client));
  20. _storages.TryAdd("Water", new WaterOperate(client));
  21. _storages.TryAdd("Indicator", new IndicatorOperate(client));
  22. _storages.TryAdd("SampleFan", new SampleFanOperate(client));
  23. _storages.TryAdd("DissolveFan", new DissolveFanOperate(client));
  24. _storages.TryAdd("LiquidStir", new LiquidStirOperate(client));
  25. _storages.TryAdd("TitrationStir", new TitrationStirOperate(client));
  26. }
  27. public StorageOperateImp Factory(string pumpName)
  28. {
  29. if (_storages.TryGetValue(pumpName, out var storage))
  30. {
  31. return storage;
  32. }
  33. throw new ArgumentNullException(pumpName);
  34. }
  35. }
  36. }