ElectricalRelationUploader.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. using SAGA.GplotRelationComputerManage;
  2. using SAGA.Models;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. namespace SAGA.GplotManage
  9. {
  10. public class ElectricalRelationUploader : RelationUploader
  11. {
  12. public ElectricalRelationUploader(string relationType, string relationDisplay) : base(relationType, relationDisplay)
  13. {
  14. CurrentHandler = ElectricalRelationHandlerFactory.Create(relationType);
  15. }
  16. public IElectricalRelationHandler CurrentHandler { get; private set; }
  17. public override void Upload()
  18. {
  19. //计算数据
  20. if (CurrentHandler == null)
  21. return;
  22. //加载数据
  23. var data = CurrentHandler.GetComputeData(new PowerComputerContext()); ;
  24. //使用数据
  25. Upload(data);
  26. }
  27. public override void Upload(object loadData)
  28. {
  29. List<DataNode> dataNodes = loadData as List<DataNode>;
  30. if (dataNodes == null)
  31. {
  32. return;
  33. }
  34. //上传数据处理
  35. }
  36. #region 数据上传方法
  37. private void CreateGraph(DataNode dn, List<ReleateData> data)
  38. {
  39. if (dn.Childrens.Count > 0)
  40. {
  41. foreach (var n in dn.Childrens)
  42. {
  43. // data.Add(GetReleateData(dn.EId, n.EId));
  44. CreateGraph(n, data);
  45. }
  46. }
  47. }
  48. #endregion
  49. }
  50. }