PumpContent.cs 1.1 KB

12345678910111213141516171819202122232425262728293031
  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 PumpContent
  8. {
  9. private readonly ConcurrentDictionary<string, PortOperateImp> _pumpContents;
  10. public PumpContent(OptClient client)
  11. {
  12. _pumpContents = new ConcurrentDictionary<string, PortOperateImp>();
  13. _pumpContents.TryAdd("PotassiumDichromate_Low", new PotassiumDichromateLowOperatep(client));
  14. _pumpContents.TryAdd("PotassiumDichromate_High", new PotassiumDichromateHighOperate(client));
  15. _pumpContents.TryAdd("FAS_Low", new FasLowOperate(client));
  16. _pumpContents.TryAdd("FAS_High", new FasHighOperate(client));
  17. _pumpContents.TryAdd("SilverSulfate", new SilverSulfateOperate(client));
  18. }
  19. public PortOperateImp Factory(string pumpName)
  20. {
  21. if (_pumpContents.TryGetValue(pumpName, out var pumpOperate))
  22. {
  23. return pumpOperate;
  24. }
  25. throw new ArgumentNullException(pumpName);
  26. }
  27. }
  28. }