Link.cs 1.1 KB

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