FlowConnection.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. using Prism.Mvvm;
  2. using System;
  3. using System.Windows;
  4. using Newtonsoft.Json;
  5. namespace TeamAAS.FlowEditor.Models
  6. {
  7. [Serializable]
  8. /// <summary>
  9. /// 节点间的连线
  10. /// </summary>
  11. public class FlowConnection : TeamAAS.BindableBase
  12. {
  13. public string ConnectionId { get; set; } = System.Guid.NewGuid().ToString("N");
  14. public string SourceNodeId { get; set; }
  15. public PortSide SourceSide { get; set; } = PortSide.Right;
  16. public string TargetNodeId { get; set; }
  17. public PortSide TargetSide { get; set; } = PortSide.Left;
  18. /// <summary>
  19. /// 分支条件(仅 BranchNode 的输出连线使用,如 "True"/"False")
  20. /// </summary>
  21. public string BranchCondition { get; set; }
  22. // ===== 以下为运行时属性(不序列化)=====
  23. [JsonIgnore]
  24. public Point SourcePosition
  25. {
  26. get => _sourcePosition;
  27. set => SetProperty(ref _sourcePosition, value);
  28. }
  29. private Point _sourcePosition;
  30. [JsonIgnore]
  31. public Point TargetPosition
  32. {
  33. get => _targetPosition;
  34. set => SetProperty(ref _targetPosition, value);
  35. }
  36. private Point _targetPosition;
  37. [JsonIgnore]
  38. public bool IsSelected
  39. {
  40. get => _isSelected;
  41. set => SetProperty(ref _isSelected, value);
  42. }
  43. private bool _isSelected;
  44. }
  45. }