Link.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. using System.ComponentModel;
  2. namespace Flowchart
  3. {
  4. public class Link : INotifyPropertyChanged
  5. {
  6. [Browsable(false)]
  7. public FlowNode Source { get; private set; }
  8. [Browsable(false)]
  9. public PortKinds SourcePort { get; private set; }
  10. [Browsable(false)]
  11. public FlowNode Target { get; private set; }
  12. [Browsable(false)]
  13. public PortKinds TargetPort { get; private set; }
  14. private string _text;
  15. public string Text
  16. {
  17. get { return _text; }
  18. set
  19. {
  20. _text = value;
  21. OnPropertyChanged("Text");
  22. }
  23. }
  24. public Link(FlowNode source, PortKinds sourcePort, FlowNode target, PortKinds targetPort)
  25. {
  26. Source = source;
  27. SourcePort = sourcePort;
  28. Target = target;
  29. TargetPort = targetPort;
  30. }
  31. #region INotifyPropertyChanged Members
  32. public event PropertyChangedEventHandler PropertyChanged;
  33. protected void OnPropertyChanged(string name)
  34. {
  35. PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
  36. }
  37. #endregion
  38. }
  39. public enum PortKinds { Top, Bottom, Left, Right }
  40. }