- Timestamp:
- 10/11/14 03:32:15 (10 years ago)
- Location:
- branches/OptimizationNetworks
- Files:
-
- 8 added
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/OptimizationNetworks/HeuristicLab.Optimization.Networks.Views/3.3/HeuristicLab.Optimization.Networks.Views-3.3.csproj
r11423 r11449 85 85 </ItemGroup> 86 86 <ItemGroup> 87 <Compile Include="EntitySelector.cs"> 88 <SubType>UserControl</SubType> 89 </Compile> 90 <Compile Include="EntitySelector.Designer.cs"> 91 <DependentUpon>EntitySelector.cs</DependentUpon> 92 </Compile> 93 <Compile Include="EntitySelectorDialog.cs"> 94 <SubType>Form</SubType> 95 </Compile> 96 <Compile Include="EntitySelectorDialog.Designer.cs"> 97 <DependentUpon>EntitySelectorDialog.cs</DependentUpon> 98 </Compile> 99 <Compile Include="EntityView.cs"> 100 <SubType>UserControl</SubType> 101 </Compile> 102 <Compile Include="EntityView.Designer.cs"> 103 <DependentUpon>EntityView.cs</DependentUpon> 104 </Compile> 87 105 <Compile Include="PortView.cs"> 88 106 <SubType>UserControl</SubType> -
branches/OptimizationNetworks/HeuristicLab.Optimization.Networks.Views/3.3/InputPortView.Designer.cs
r11438 r11449 27 27 private System.ComponentModel.IContainer components = null; 28 28 29 /// <summary>30 /// Clean up any resources being used.31 /// </summary>32 /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>33 protected override void Dispose(bool disposing) {34 if (disposing) {35 if (components != null) components.Dispose();36 }37 base.Dispose(disposing);38 }39 40 29 #region Component Designer generated code 41 30 … … 45 34 /// </summary> 46 35 private void InitializeComponent() { 36 System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(InputPortView)); 47 37 this.outputPortGroupBox = new System.Windows.Forms.GroupBox(); 38 this.setOutputPortButton = new System.Windows.Forms.Button(); 39 this.clearOutputPortButton = new System.Windows.Forms.Button(); 48 40 this.outputPortView = new HeuristicLab.Optimization.Networks.Views.PortView(); 49 41 this.valueGroupBox.SuspendLayout(); … … 55 47 // valueGroupBox 56 48 // 57 this.valueGroupBox.Location = new System.Drawing.Point(0, 129);58 this.valueGroupBox.Size = new System.Drawing.Size(645, 388);59 this.valueGroupBox.TabIndex = 6;49 this.valueGroupBox.Location = new System.Drawing.Point(0, 82); 50 this.valueGroupBox.Size = new System.Drawing.Size(645, 435); 51 this.valueGroupBox.TabIndex = 4; 60 52 // 61 53 // valuePanel 62 54 // 63 this.valuePanel.Size = new System.Drawing.Size(633, 363);55 this.valuePanel.Size = new System.Drawing.Size(633, 410); 64 56 // 65 57 // valueViewHost 66 58 // 67 this.valueViewHost.Size = new System.Drawing.Size(633, 363); 68 // 69 // pathTextBox 70 // 71 this.pathTextBox.Location = new System.Drawing.Point(71, 26); 72 this.pathTextBox.Size = new System.Drawing.Size(549, 20); 59 this.valueViewHost.Size = new System.Drawing.Size(633, 410); 73 60 // 74 61 // nameTextBox … … 83 70 this.outputPortGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 84 71 | System.Windows.Forms.AnchorStyles.Right))); 72 this.outputPortGroupBox.Controls.Add(this.setOutputPortButton); 73 this.outputPortGroupBox.Controls.Add(this.clearOutputPortButton); 85 74 this.outputPortGroupBox.Controls.Add(this.outputPortView); 86 this.outputPortGroupBox.Location = new System.Drawing.Point(0, 52);75 this.outputPortGroupBox.Location = new System.Drawing.Point(0, 26); 87 76 this.outputPortGroupBox.Name = "outputPortGroupBox"; 88 this.outputPortGroupBox.Size = new System.Drawing.Size(645, 71);89 this.outputPortGroupBox.TabIndex = 5;77 this.outputPortGroupBox.Size = new System.Drawing.Size(645, 50); 78 this.outputPortGroupBox.TabIndex = 3; 90 79 this.outputPortGroupBox.TabStop = false; 91 80 this.outputPortGroupBox.Text = "&Output Port"; 92 this.outputPortGroupBox.DragDrop += new System.Windows.Forms.DragEventHandler(this.outputPortGroupBox_DragDrop); 93 this.outputPortGroupBox.DragEnter += new System.Windows.Forms.DragEventHandler(this.outputPortGroupBox_DragEnterOver); 94 this.outputPortGroupBox.DragOver += new System.Windows.Forms.DragEventHandler(this.outputPortGroupBox_DragEnterOver); 81 // 82 // setOutputPortButton 83 // 84 this.setOutputPortButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Edit; 85 this.setOutputPortButton.Location = new System.Drawing.Point(6, 19); 86 this.setOutputPortButton.Name = "setOutputPortButton"; 87 this.setOutputPortButton.Size = new System.Drawing.Size(24, 24); 88 this.setOutputPortButton.TabIndex = 0; 89 this.setOutputPortButton.UseVisualStyleBackColor = true; 90 this.setOutputPortButton.Click += new System.EventHandler(this.setOutputPortButton_Click); 91 // 92 // clearOutputPortButton 93 // 94 this.clearOutputPortButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Remove; 95 this.clearOutputPortButton.Location = new System.Drawing.Point(36, 19); 96 this.clearOutputPortButton.Name = "clearOutputPortButton"; 97 this.clearOutputPortButton.Size = new System.Drawing.Size(24, 24); 98 this.clearOutputPortButton.TabIndex = 1; 99 this.clearOutputPortButton.UseVisualStyleBackColor = true; 100 this.clearOutputPortButton.Click += new System.EventHandler(this.clearOutputPortButton_Click); 95 101 // 96 102 // outputPortView 97 103 // 98 this.outputPortView.Caption = "Port View"; 104 this.outputPortView.AllowDrop = true; 105 this.outputPortView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 106 | System.Windows.Forms.AnchorStyles.Left) 107 | System.Windows.Forms.AnchorStyles.Right))); 108 this.outputPortView.Caption = "Output Port View"; 99 109 this.outputPortView.Content = null; 100 this.outputPortView.Dock = System.Windows.Forms.DockStyle.Fill; 101 this.outputPortView.Location = new System.Drawing.Point(3, 16); 110 this.outputPortView.Location = new System.Drawing.Point(66, 21); 102 111 this.outputPortView.Name = "outputPortView"; 103 112 this.outputPortView.ReadOnly = true; 104 this.outputPortView.Size = new System.Drawing.Size(639, 52); 105 this.outputPortView.TabIndex = 0; 113 this.outputPortView.Size = new System.Drawing.Size(573, 23); 114 this.outputPortView.TabIndex = 2; 115 this.outputPortView.DragDrop += new System.Windows.Forms.DragEventHandler(this.outputPortView_DragDrop); 116 this.outputPortView.DragEnter += new System.Windows.Forms.DragEventHandler(this.outputPortView_DragEnterOver); 117 this.outputPortView.DragOver += new System.Windows.Forms.DragEventHandler(this.outputPortView_DragEnterOver); 106 118 // 107 119 // InputPortView … … 110 122 this.Controls.Add(this.outputPortGroupBox); 111 123 this.Name = "InputPortView"; 112 this.Controls.SetChildIndex(this.pathLabel, 0);113 this.Controls.SetChildIndex(this.pathTextBox, 0);114 124 this.Controls.SetChildIndex(this.nameLabel, 0); 115 125 this.Controls.SetChildIndex(this.nameTextBox, 0); … … 130 140 protected System.Windows.Forms.GroupBox outputPortGroupBox; 131 141 protected PortView outputPortView; 142 protected System.Windows.Forms.Button clearOutputPortButton; 143 protected System.Windows.Forms.Button setOutputPortButton; 132 144 133 145 -
branches/OptimizationNetworks/HeuristicLab.Optimization.Networks.Views/3.3/InputPortView.cs
r11438 r11449 30 30 [Content(typeof(IInputPort), false)] 31 31 public partial class InputPortView : ValuePortView { 32 protected EntitySelectorDialog entitySelectorDialog; 33 32 34 public new IInputPort Content { 33 35 get { return (IInputPort)base.Content; } … … 37 39 public InputPortView() { 38 40 InitializeComponent(); 41 } 42 43 protected override void Dispose(bool disposing) { 44 if (disposing) { 45 if (entitySelectorDialog != null) entitySelectorDialog.Dispose(); 46 if (components != null) components.Dispose(); 47 } 48 base.Dispose(disposing); 39 49 } 40 50 … … 56 66 base.SetEnabledStateOfControls(); 57 67 outputPortGroupBox.Enabled = Content != null && !ReadOnly; 68 setOutputPortButton.Enabled = Content != null && !ReadOnly; 69 clearOutputPortButton.Enabled = Content != null && Content.OutputPort != null && !ReadOnly; 58 70 } 59 71 … … 62 74 Invoke(new EventHandler(Content_OutputPortChanged), sender, e); 63 75 else { 76 clearOutputPortButton.Enabled = Content.OutputPort != null && !ReadOnly; 64 77 outputPortView.Content = Content.OutputPort; 65 78 } 66 79 } 67 80 68 protected virtual void outputPortGroupBox_DragEnterOver(object sender, DragEventArgs e) { 81 protected virtual void setOutputPortButton_Click(object sender, EventArgs e) { 82 if (entitySelectorDialog == null) { 83 entitySelectorDialog = new EntitySelectorDialog(); 84 entitySelectorDialog.Caption = "Select Output Port"; 85 } 86 87 IEntity root = Content; 88 while (root.Parent != null) 89 root = root.Parent; 90 entitySelectorDialog.EntitySelector.Root = root; 91 92 if (entitySelectorDialog.ShowDialog(this) == DialogResult.OK) { 93 Content.OutputPort = entitySelectorDialog.EntitySelector.SelectedEntity as IOutputPort; 94 } 95 } 96 protected virtual void clearOutputPortButton_Click(object sender, EventArgs e) { 97 Content.OutputPort = null; 98 } 99 100 protected virtual void outputPortView_DragEnterOver(object sender, DragEventArgs e) { 69 101 e.Effect = DragDropEffects.None; 70 102 if (!ReadOnly && (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is IOutputPort)) { … … 72 104 } 73 105 } 74 protected virtual void outputPort GroupBox_DragDrop(object sender, DragEventArgs e) {106 protected virtual void outputPortView_DragDrop(object sender, DragEventArgs e) { 75 107 if (e.Effect != DragDropEffects.None) { 76 108 IOutputPort port = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) as IOutputPort; -
branches/OptimizationNetworks/HeuristicLab.Optimization.Networks.Views/3.3/NetworkView.cs
r11409 r11449 28 28 [Content(typeof(Network), true)] 29 29 [Content(typeof(INetwork), false)] 30 public partial class NetworkView : NamedItemView {30 public partial class NetworkView : EntityView { 31 31 public new INetwork Content { 32 32 get { return (INetwork)base.Content; } -
branches/OptimizationNetworks/HeuristicLab.Optimization.Networks.Views/3.3/NodeView.cs
r11409 r11449 28 28 [Content(typeof(Node), true)] 29 29 [Content(typeof(INode), false)] 30 public partial class NodeView : NamedItemView {30 public partial class NodeView : EntityView { 31 31 public new INode Content { 32 32 get { return (INode)base.Content; } -
branches/OptimizationNetworks/HeuristicLab.Optimization.Networks.Views/3.3/PortView.Designer.cs
r11438 r11449 45 45 /// </summary> 46 46 private void InitializeComponent() { 47 this.pathLabel = new System.Windows.Forms.Label();48 this.pathTextBox = new System.Windows.Forms.TextBox();49 47 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); 50 48 this.SuspendLayout(); … … 54 52 this.errorProvider.SetIconAlignment(this.nameTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft); 55 53 this.errorProvider.SetIconPadding(this.nameTextBox, 2); 56 this.nameTextBox.Location = new System.Drawing.Point(69, 0);57 this.nameTextBox.Size = new System.Drawing.Size(551, 20);58 //59 // infoLabel60 //61 this.infoLabel.Location = new System.Drawing.Point(626, 3);62 //63 // pathLabel64 //65 this.pathLabel.AutoSize = true;66 this.pathLabel.Location = new System.Drawing.Point(3, 29);67 this.pathLabel.Name = "pathLabel";68 this.pathLabel.Size = new System.Drawing.Size(32, 13);69 this.pathLabel.TabIndex = 3;70 this.pathLabel.Text = "&Path:";71 //72 // pathTextBox73 //74 this.pathTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)75 | System.Windows.Forms.AnchorStyles.Right)));76 this.pathTextBox.Location = new System.Drawing.Point(69, 26);77 this.pathTextBox.Name = "pathTextBox";78 this.pathTextBox.ReadOnly = true;79 this.pathTextBox.Size = new System.Drawing.Size(551, 20);80 this.pathTextBox.TabIndex = 4;81 54 // 82 55 // PortView 83 56 // 84 57 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit; 85 this.Controls.Add(this.pathTextBox);86 this.Controls.Add(this.pathLabel);87 58 this.Name = "PortView"; 88 this.Size = new System.Drawing.Size(645, 517);89 this.Controls.SetChildIndex(this.nameLabel, 0);90 this.Controls.SetChildIndex(this.nameTextBox, 0);91 this.Controls.SetChildIndex(this.infoLabel, 0);92 this.Controls.SetChildIndex(this.pathLabel, 0);93 this.Controls.SetChildIndex(this.pathTextBox, 0);94 59 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit(); 95 60 this.ResumeLayout(false); … … 100 65 #endregion 101 66 102 protected System.Windows.Forms.Label pathLabel;103 protected System.Windows.Forms.TextBox pathTextBox;104 67 105 68 -
branches/OptimizationNetworks/HeuristicLab.Optimization.Networks.Views/3.3/PortView.cs
r11438 r11449 29 29 [Content(typeof(Port), true)] 30 30 [Content(typeof(IPort), false)] 31 public partial class PortView : NamedItemView {31 public partial class PortView : EntityView { 32 32 public new IPort Content { 33 33 get { return (IPort)base.Content; } … … 39 39 } 40 40 41 protected override void DeregisterContentEvents() {42 Content.PathChanged -= Content_PathChanged;43 base.DeregisterContentEvents();44 }45 protected override void RegisterContentEvents() {46 base.RegisterContentEvents();47 Content.PathChanged += Content_PathChanged;48 }49 50 41 protected override void OnContentChanged() { 51 42 base.OnContentChanged(); 52 pathTextBox.Text = Content == null ? string.Empty : Content.Path;53 43 } 54 44 55 45 protected override void SetEnabledStateOfControls() { 56 46 base.SetEnabledStateOfControls(); 57 pathTextBox.Enabled = Content != null;58 }59 60 protected virtual void Content_PathChanged(object sender, System.EventArgs e) {61 if (InvokeRequired)62 Invoke(new EventHandler(Content_PathChanged), sender, e);63 else {64 pathTextBox.Text = Content.Path;65 }66 47 } 67 48 } -
branches/OptimizationNetworks/HeuristicLab.Optimization.Networks.Views/3.3/ValuePortView.Designer.cs
r11438 r11449 64 64 | System.Windows.Forms.AnchorStyles.Right))); 65 65 this.valueGroupBox.Controls.Add(this.valuePanel); 66 this.valueGroupBox.Location = new System.Drawing.Point(0, 52);66 this.valueGroupBox.Location = new System.Drawing.Point(0, 26); 67 67 this.valueGroupBox.Name = "valueGroupBox"; 68 this.valueGroupBox.Size = new System.Drawing.Size(645, 4 65);69 this.valueGroupBox.TabIndex = 5;68 this.valueGroupBox.Size = new System.Drawing.Size(645, 491); 69 this.valueGroupBox.TabIndex = 3; 70 70 this.valueGroupBox.TabStop = false; 71 71 this.valueGroupBox.Text = "Value"; … … 79 79 this.valuePanel.Location = new System.Drawing.Point(6, 19); 80 80 this.valuePanel.Name = "valuePanel"; 81 this.valuePanel.Size = new System.Drawing.Size(633, 4 40);81 this.valuePanel.Size = new System.Drawing.Size(633, 466); 82 82 this.valuePanel.TabIndex = 0; 83 83 // … … 91 91 this.valueViewHost.Name = "valueViewHost"; 92 92 this.valueViewHost.ReadOnly = false; 93 this.valueViewHost.Size = new System.Drawing.Size(633, 4 40);93 this.valueViewHost.Size = new System.Drawing.Size(633, 466); 94 94 this.valueViewHost.TabIndex = 0; 95 95 this.valueViewHost.ViewsLabelVisible = true; … … 101 101 this.Controls.Add(this.valueGroupBox); 102 102 this.Name = "ValuePortView"; 103 this.Controls.SetChildIndex(this.pathLabel, 0);104 this.Controls.SetChildIndex(this.pathTextBox, 0);105 103 this.Controls.SetChildIndex(this.nameLabel, 0); 106 104 this.Controls.SetChildIndex(this.nameTextBox, 0); -
branches/OptimizationNetworks/HeuristicLab.Optimization.Networks/3.3/HeuristicLab.Optimization.Networks-3.3.csproj
r11423 r11449 84 84 </ItemGroup> 85 85 <ItemGroup> 86 <Compile Include="IEntity.cs" /> 86 87 <Compile Include="IPort.cs" /> 87 88 <Compile Include="IVariablesNode.cs" /> 89 <Compile Include="Entity.cs" /> 88 90 <Compile Include="Port.cs" /> 89 91 <Compile Include="VariablesNode.cs" /> -
branches/OptimizationNetworks/HeuristicLab.Optimization.Networks/3.3/INode.cs
r11401 r11449 24 24 25 25 namespace HeuristicLab.Optimization.Networks { 26 public interface INode : INamedItem { 26 public interface INode : IEntity { 27 new INetwork Parent { get; set; } 27 28 IKeyedItemCollection<string, IPort> Ports { get; } 28 29 } -
branches/OptimizationNetworks/HeuristicLab.Optimization.Networks/3.3/IPort.cs
r11431 r11449 24 24 25 25 namespace HeuristicLab.Optimization.Networks { 26 public interface IPort : INamedItem { 27 INode Parent { get; set; } 28 string Path { get; } 29 30 event EventHandler PathChanged; 26 public interface IPort : IEntity { 27 new INode Parent { get; set; } 31 28 } 32 29 } -
branches/OptimizationNetworks/HeuristicLab.Optimization.Networks/3.3/Network.cs
r11409 r11449 23 23 using HeuristicLab.Core; 24 24 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 25 using System.Collections.Generic; 25 26 using System.Drawing; 27 using System.Linq; 26 28 27 29 namespace HeuristicLab.Optimization.Networks { … … 34 36 public static new Image StaticItemImage { 35 37 get { return HeuristicLab.Common.Resources.VSImageLibrary.Module; } 38 } 39 40 public override IEnumerable<IEntity> Children { 41 get { return base.Children.Concat(Nodes.AsEnumerable<IEntity>()); } 36 42 } 37 43 … … 47 53 : base(original, cloner) { 48 54 nodes = cloner.Clone(original.nodes); 55 foreach (var n in Nodes) 56 n.Parent = this; 57 RegisterNodesEvents(); 49 58 } 50 59 public Network() 51 60 : base("Network") { 52 61 nodes = new NodeCollection(); 62 RegisterNodesEvents(); 53 63 } 54 64 public Network(string name) 55 65 : base(name) { 56 66 nodes = new NodeCollection(); 67 RegisterNodesEvents(); 57 68 } 58 69 public Network(string name, string description) 59 70 : base(name, description) { 60 71 nodes = new NodeCollection(); 72 RegisterNodesEvents(); 73 } 74 75 [StorableHook(HookType.AfterDeserialization)] 76 private void AfterDeserialization() { 77 foreach (var n in Nodes) 78 n.Parent = this; 79 RegisterNodesEvents(); 61 80 } 62 81 … … 64 83 return new Network(this, cloner); 65 84 } 85 86 #region Nodes Events 87 protected virtual void RegisterNodesEvents() { 88 nodes.ItemsAdded += Nodes_ItemsAdded; 89 nodes.ItemsRemoved += Nodes_ItemsRemoved; 90 nodes.ItemsReplaced += Nodes_ItemsReplaced; 91 nodes.CollectionReset += Nodes_CollectionReset; 92 } 93 protected virtual void Nodes_ItemsAdded(object sender, Collections.CollectionItemsChangedEventArgs<INode> e) { 94 foreach (var n in e.Items) 95 n.Parent = this; 96 } 97 protected virtual void Nodes_ItemsRemoved(object sender, Collections.CollectionItemsChangedEventArgs<INode> e) { 98 foreach (var n in e.Items) 99 n.Parent = null; 100 } 101 protected virtual void Nodes_ItemsReplaced(object sender, Collections.CollectionItemsChangedEventArgs<INode> e) { 102 foreach (var n in e.OldItems) 103 n.Parent = null; 104 foreach (var n in e.Items) 105 n.Parent = this; 106 } 107 protected virtual void Nodes_CollectionReset(object sender, Collections.CollectionItemsChangedEventArgs<INode> e) { 108 foreach (var n in e.OldItems) 109 n.Parent = null; 110 foreach (var n in e.Items) 111 n.Parent = this; 112 } 113 #endregion 66 114 } 67 115 } -
branches/OptimizationNetworks/HeuristicLab.Optimization.Networks/3.3/Node.cs
r11423 r11449 25 25 using HeuristicLab.Core; 26 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 27 using System.Collections.Generic; 28 using System.Linq; 27 29 28 30 namespace HeuristicLab.Optimization.Networks { 29 31 [Item("Node", "A node of an optimization network.")] 30 32 [StorableClass] 31 public class Node : NamedItem, INode {33 public class Node : Entity, INode { 32 34 public static new Image StaticItemImage { 33 35 get { return HeuristicLab.Common.Resources.VSImageLibrary.RadialChart; } 36 } 37 38 new public INetwork Parent { 39 get { return (INetwork)base.Parent; } 40 set { 41 // NOTE: never call setter directly as the Parent property is set by the network which contains the node 42 base.Parent = value; 43 } 44 } 45 public override IEnumerable<IEntity> Children { 46 get { return base.Children.Concat(Ports.AsEnumerable<IEntity>()); } 34 47 } 35 48 -
branches/OptimizationNetworks/HeuristicLab.Optimization.Networks/3.3/Port.cs
r11431 r11449 29 29 [Item("Port", "Abstract base class for ports of an optimization network node.")] 30 30 [StorableClass] 31 public abstract class Port : NamedItem, IPort {31 public abstract class Port : Entity, IPort { 32 32 public static new Image StaticItemImage { 33 33 get { return HeuristicLab.Common.Resources.VSImageLibrary.Field; } 34 34 } 35 35 36 private INode parent; 37 public INode Parent { 38 get { return parent; } 36 new public INode Parent { 37 get { return (INode)base.Parent; } 39 38 set { 40 39 // NOTE: never call setter directly as the Parent property is set by the node which contains the port 41 if (value != parent) { 42 DeregisterParentEvents(); 43 parent = value; 44 RegisterParentEvents(); 45 OnPathChanged(); 46 } 47 } 48 } 49 public string Path { 50 get { 51 return parent != null ? parent.Name : string.Empty; 40 base.Parent = value; 52 41 } 53 42 } … … 59 48 protected Port(string name) : base(name) { } 60 49 protected Port(string name, string description) : base(name, description) { } 61 62 public event EventHandler PathChanged;63 protected virtual void OnPathChanged() {64 var handler = PathChanged;65 if (handler != null) handler(this, EventArgs.Empty);66 }67 68 #region Parent Events69 protected virtual void RegisterParentEvents() {70 if (parent != null) {71 parent.NameChanged += Parent_NameChanged;72 }73 }74 protected virtual void DeregisterParentEvents() {75 if (parent != null) {76 parent.NameChanged -= Parent_NameChanged;77 }78 }79 void Parent_NameChanged(object sender, EventArgs e) {80 OnPathChanged();81 }82 #endregion83 50 } 84 51 }
Note: See TracChangeset
for help on using the changeset viewer.