Changeset 2932 for trunk/sources
- Timestamp:
- 03/05/10 03:07:12 (15 years ago)
- Location:
- trunk/sources
- Files:
-
- 1 deleted
- 39 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Core.Views/3.3/ItemArrayView.Designer.cs
r2924 r2932 38 38 foreach (ListViewItem listViewItem in itemsListView.Items) { 39 39 T item = listViewItem.Tag as T; 40 if (item != null) item. Changed -= new ChangedEventHandler(Item_Changed);40 if (item != null) item.ToStringChanged -= new EventHandler(Item_ToStringChanged); 41 41 } 42 42 if (components != null) components.Dispose(); -
trunk/sources/HeuristicLab.Core.Views/3.3/ItemArrayView.cs
r2917 r2932 129 129 itemsListView.Items.Add(listViewItem); 130 130 if (listViewItem.Tag != null) 131 ((T)listViewItem.Tag). Changed += new ChangedEventHandler(Item_Changed);131 ((T)listViewItem.Tag).ToStringChanged += new EventHandler(Item_ToStringChanged); 132 132 } 133 133 protected virtual void InsertListViewItem(int index, ListViewItem listViewItem) { 134 134 itemsListView.Items.Insert(index, listViewItem); 135 135 if (listViewItem.Tag != null) 136 ((T)listViewItem.Tag). Changed += new ChangedEventHandler(Item_Changed);136 ((T)listViewItem.Tag).ToStringChanged += new EventHandler(Item_ToStringChanged); 137 137 } 138 138 protected virtual void RemoveListViewItem(ListViewItem listViewItem) { 139 139 if (listViewItem.Tag != null) 140 ((T)listViewItem.Tag). Changed -= new ChangedEventHandler(Item_Changed);140 ((T)listViewItem.Tag).ToStringChanged -= new EventHandler(Item_ToStringChanged); 141 141 listViewItem.Remove(); 142 142 } … … 309 309 310 310 #region Item Events 311 protected virtual void Item_ Changed(object sender, ChangedEventArgs e) {311 protected virtual void Item_ToStringChanged(object sender, EventArgs e) { 312 312 if (InvokeRequired) 313 Invoke(new ChangedEventHandler(Item_Changed), sender, e);313 Invoke(new EventHandler(Item_ToStringChanged), sender, e); 314 314 else { 315 315 T item = (T)sender; -
trunk/sources/HeuristicLab.Core.Views/3.3/ItemCollectionView.Designer.cs
r2924 r2932 38 38 if (disposing) { 39 39 foreach (ListViewItem item in itemsListView.Items) 40 ((T)item.Tag). Changed -= new ChangedEventHandler(Item_Changed);40 ((T)item.Tag).ToStringChanged -= new EventHandler(Item_ToStringChanged); 41 41 if (components != null) components.Dispose(); 42 42 } -
trunk/sources/HeuristicLab.Core.Views/3.3/ItemCollectionView.cs
r2924 r2932 109 109 protected virtual void AddListViewItem(ListViewItem listViewItem) { 110 110 itemsListView.Items.Add(listViewItem); 111 ((T)listViewItem.Tag). Changed += new ChangedEventHandler(Item_Changed);111 ((T)listViewItem.Tag).ToStringChanged += new EventHandler(Item_ToStringChanged); 112 112 sortAscendingButton.Enabled = itemsListView.Items.Count > 0; 113 113 sortDescendingButton.Enabled = itemsListView.Items.Count > 0; 114 114 } 115 115 protected virtual void RemoveListViewItem(ListViewItem listViewItem) { 116 ((T)listViewItem.Tag). Changed -= new ChangedEventHandler(Item_Changed);116 ((T)listViewItem.Tag).ToStringChanged -= new EventHandler(Item_ToStringChanged); 117 117 listViewItem.Remove(); 118 118 sortAscendingButton.Enabled = itemsListView.Items.Count > 0; … … 254 254 255 255 #region Item Events 256 protected virtual void Item_ Changed(object sender, ChangedEventArgs e) {257 if (InvokeRequired) 258 Invoke(new ChangedEventHandler(Item_Changed), sender, e);256 protected virtual void Item_ToStringChanged(object sender, EventArgs e) { 257 if (InvokeRequired) 258 Invoke(new EventHandler(Item_ToStringChanged), sender, e); 259 259 else { 260 260 T item = (T)sender; -
trunk/sources/HeuristicLab.Core.Views/3.3/ItemListView.Designer.cs
r2924 r2932 37 37 if (disposing) { 38 38 foreach (ListViewItem item in itemsListView.Items) 39 ((T)item.Tag). Changed -= new ChangedEventHandler(Item_Changed);39 ((T)item.Tag).ToStringChanged -= new EventHandler(Item_ToStringChanged); 40 40 if (components != null) components.Dispose(); 41 41 } -
trunk/sources/HeuristicLab.Core.Views/3.3/ItemListView.cs
r2917 r2932 131 131 protected virtual void AddListViewItem(ListViewItem listViewItem) { 132 132 itemsListView.Items.Add(listViewItem); 133 ((T)listViewItem.Tag). Changed += new ChangedEventHandler(Item_Changed);133 ((T)listViewItem.Tag).ToStringChanged += new EventHandler(Item_ToStringChanged); 134 134 } 135 135 protected virtual void InsertListViewItem(int index, ListViewItem listViewItem) { 136 136 itemsListView.Items.Insert(index, listViewItem); 137 ((T)listViewItem.Tag). Changed += new ChangedEventHandler(Item_Changed);137 ((T)listViewItem.Tag).ToStringChanged += new EventHandler(Item_ToStringChanged); 138 138 } 139 139 protected virtual void RemoveListViewItem(ListViewItem listViewItem) { 140 ((T)listViewItem.Tag). Changed -= new ChangedEventHandler(Item_Changed);140 ((T)listViewItem.Tag).ToStringChanged -= new EventHandler(Item_ToStringChanged); 141 141 listViewItem.Remove(); 142 142 } … … 333 333 334 334 #region Item Events 335 protected virtual void Item_ Changed(object sender, ChangedEventArgs e) {336 if (InvokeRequired) 337 Invoke(new ChangedEventHandler(Item_Changed), sender, e);335 protected virtual void Item_ToStringChanged(object sender, EventArgs e) { 336 if (InvokeRequired) 337 Invoke(new EventHandler(Item_ToStringChanged), sender, e); 338 338 else { 339 339 T item = (T)sender; -
trunk/sources/HeuristicLab.Core/3.3/HeuristicLab.Core-3.3.csproj
r2900 r2932 102 102 <Compile Include="Cloner.cs" /> 103 103 <Compile Include="Attributes\CreatableAttribute.cs" /> 104 <Compile Include="ChangedEventArgs.cs" />105 104 <None Include="HeuristicLabCorePlugin.cs.frame" /> 106 105 <Compile Include="Interfaces\IParameterizedNamedItem.cs" /> -
trunk/sources/HeuristicLab.Core/3.3/Interfaces/IItem.cs
r2852 r2932 20 20 #endregion 21 21 22 using System; 22 23 using System.Drawing; 23 24 … … 31 32 Image ItemImage { get; } 32 33 33 event ChangedEventHandlerChanged;34 event EventHandler ToStringChanged; 34 35 } 35 36 } -
trunk/sources/HeuristicLab.Core/3.3/Item.cs
r2830 r2932 20 20 #endregion 21 21 22 using System; 22 23 using System.Drawing; 23 24 using HeuristicLab.Common.Resources; … … 49 50 } 50 51 51 public event ChangedEventHandler Changed; 52 protected void OnChanged() { 53 OnChanged(new ChangedEventArgs()); 54 } 55 protected virtual void OnChanged(ChangedEventArgs e) { 56 if ((e.RegisterChangedObject(this)) && (Changed != null)) 57 Changed(this, e); 52 public event EventHandler ToStringChanged; 53 protected virtual void OnToStringChanged() { 54 if (ToStringChanged != null) 55 ToStringChanged(this, EventArgs.Empty); 58 56 } 59 57 } -
trunk/sources/HeuristicLab.Core/3.3/ItemArray.cs
r2833 r2932 35 35 [Item("ItemArray<T>", "Represents an array of items.")] 36 36 public class ItemArray<T> : ObservableArray<T>, IItem where T : class, IItem { 37 [Storable(Name = "RestoreEvents")]38 private object RestoreEvents {39 get { return null; }40 set {41 foreach (T item in this)42 if (item != null) item.Changed += new ChangedEventHandler(Item_Changed);43 }44 }45 46 37 public virtual string ItemName { 47 38 get { return ItemAttribute.GetName(this.GetType()); } … … 56 47 public ItemArray() : base() { } 57 48 public ItemArray(int length) : base(length) { } 58 public ItemArray(T[] array) : base(array) { 59 foreach (T item in this) 60 if (item != null) item.Changed += new ChangedEventHandler(Item_Changed); 61 } 62 public ItemArray(IEnumerable<T> collection) : base(collection) { 63 foreach (T item in this) 64 if (item != null) item.Changed += new ChangedEventHandler(Item_Changed); 65 } 49 public ItemArray(T[] array) : base(array) { } 50 public ItemArray(IEnumerable<T> collection) : base(collection) { } 66 51 67 52 public object Clone() { … … 79 64 } 80 65 81 public event ChangedEventHandler Changed; 82 protected void OnChanged() { 83 OnChanged(new ChangedEventArgs()); 84 } 85 protected virtual void OnChanged(ChangedEventArgs e) { 86 if ((e.RegisterChangedObject(this)) && (Changed != null)) 87 Changed(this, e); 88 } 89 90 protected override void OnItemsReplaced(IEnumerable<IndexedItem<T>> items, IEnumerable<IndexedItem<T>> oldItems) { 91 foreach (IndexedItem<T> oldItem in oldItems) 92 if (oldItem.Value != null) oldItem.Value.Changed -= new ChangedEventHandler(Item_Changed); 93 foreach (IndexedItem<T> item in items) 94 if (item.Value != null) item.Value.Changed += new ChangedEventHandler(Item_Changed); 95 base.OnItemsReplaced(items, oldItems); 96 } 97 protected override void OnCollectionReset(IEnumerable<IndexedItem<T>> items, IEnumerable<IndexedItem<T>> oldItems) { 98 foreach (IndexedItem<T> oldItem in oldItems) 99 if (oldItem.Value != null) oldItem.Value.Changed -= new ChangedEventHandler(Item_Changed); 100 foreach (IndexedItem<T> item in items) 101 if (item.Value != null) item.Value.Changed += new ChangedEventHandler(Item_Changed); 102 base.OnCollectionReset(items, oldItems); 103 } 104 protected override void OnPropertyChanged(string propertyName) { 105 base.OnPropertyChanged(propertyName); 106 OnChanged(); 107 } 108 109 private void Item_Changed(object sender, ChangedEventArgs e) { 110 OnChanged(e); 66 public event EventHandler ToStringChanged; 67 protected virtual void OnToStringChanged() { 68 if (ToStringChanged != null) 69 ToStringChanged(this, EventArgs.Empty); 111 70 } 112 71 } -
trunk/sources/HeuristicLab.Core/3.3/ItemCollection.cs
r2852 r2932 32 32 [Item("ItemCollection<T>", "Represents a collection of items.")] 33 33 public class ItemCollection<T> : ObservableCollection<T>, IItem where T : class, IItem { 34 [Storable(Name = "RestoreEvents")]35 private object RestoreEvents {36 get { return null; }37 set {38 foreach (T item in this)39 if (item != null) item.Changed += new ChangedEventHandler(Item_Changed);40 }41 }42 43 34 public virtual string ItemName { 44 35 get { return ItemAttribute.GetName(this.GetType()); } … … 53 44 public ItemCollection() : base() { } 54 45 public ItemCollection(int capacity) : base(capacity) { } 55 public ItemCollection(IEnumerable<T> collection) : base(collection) { 56 foreach (T item in this) 57 if (item != null) item.Changed += new ChangedEventHandler(Item_Changed); 58 } 46 public ItemCollection(IEnumerable<T> collection) : base(collection) { } 59 47 60 48 public object Clone() { … … 72 60 } 73 61 74 public event ChangedEventHandler Changed; 75 protected void OnChanged() { 76 OnChanged(new ChangedEventArgs()); 77 } 78 protected virtual void OnChanged(ChangedEventArgs e) { 79 if ((e.RegisterChangedObject(this)) && (Changed != null)) 80 Changed(this, e); 81 } 82 83 protected override void OnItemsAdded(IEnumerable<T> items) { 84 foreach (T item in items) 85 if (item != null) item.Changed += new ChangedEventHandler(Item_Changed); 86 base.OnItemsAdded(items); 87 } 88 protected override void OnItemsRemoved(IEnumerable<T> items) { 89 foreach (T item in items) 90 if (item != null) item.Changed -= new ChangedEventHandler(Item_Changed); 91 base.OnItemsRemoved(items); 92 } 93 protected override void OnCollectionReset(IEnumerable<T> items, IEnumerable<T> oldItems) { 94 foreach (T oldItem in oldItems) 95 if (oldItem != null) oldItem.Changed -= new ChangedEventHandler(Item_Changed); 96 foreach (T item in items) 97 if (item != null) item.Changed += new ChangedEventHandler(Item_Changed); 98 base.OnCollectionReset(items, oldItems); 99 } 100 protected override void OnPropertyChanged(string propertyName) { 101 base.OnPropertyChanged(propertyName); 102 OnChanged(); 103 } 104 105 private void Item_Changed(object sender, ChangedEventArgs e) { 106 OnChanged(e); 62 public event EventHandler ToStringChanged; 63 protected virtual void OnToStringChanged() { 64 if (ToStringChanged != null) 65 ToStringChanged(this, EventArgs.Empty); 107 66 } 108 67 } -
trunk/sources/HeuristicLab.Core/3.3/ItemList.cs
r2833 r2932 36 36 [Item("ItemList<T>", "Represents a list of items.")] 37 37 public class ItemList<T> : ObservableList<T>, IItem where T : class, IItem { 38 [Storable(Name = "RestoreEvents")]39 private object RestoreEvents {40 get { return null; }41 set {42 foreach (T item in this)43 if (item != null) item.Changed += new ChangedEventHandler(Item_Changed);44 }45 }46 47 38 public virtual string ItemName { 48 39 get { return ItemAttribute.GetName(this.GetType()); } … … 57 48 public ItemList() : base() { } 58 49 public ItemList(int capacity) : base(capacity) { } 59 public ItemList(IEnumerable<T> collection) : base(collection) { 60 foreach (T item in this) 61 if (item != null) item.Changed += new ChangedEventHandler(Item_Changed); 62 } 50 public ItemList(IEnumerable<T> collection) : base(collection) { } 63 51 64 52 public object Clone() { … … 76 64 } 77 65 78 public event ChangedEventHandler Changed; 79 protected void OnChanged() { 80 OnChanged(new ChangedEventArgs()); 81 } 82 protected virtual void OnChanged(ChangedEventArgs e) { 83 if ((e.RegisterChangedObject(this)) && (Changed != null)) 84 Changed(this, e); 85 } 86 87 protected override void OnItemsAdded(IEnumerable<IndexedItem<T>> items) { 88 foreach (IndexedItem<T> item in items) 89 if (item.Value != null) item.Value.Changed += new ChangedEventHandler(Item_Changed); 90 base.OnItemsAdded(items); 91 } 92 protected override void OnItemsRemoved(IEnumerable<IndexedItem<T>> items) { 93 foreach (IndexedItem<T> item in items) 94 if (item.Value != null) item.Value.Changed -= new ChangedEventHandler(Item_Changed); 95 base.OnItemsRemoved(items); 96 } 97 protected override void OnItemsReplaced(IEnumerable<IndexedItem<T>> items, IEnumerable<IndexedItem<T>> oldItems) { 98 foreach (IndexedItem<T> oldItem in oldItems) 99 if (oldItem.Value != null) oldItem.Value.Changed -= new ChangedEventHandler(Item_Changed); 100 foreach (IndexedItem<T> item in items) 101 if (item.Value != null) item.Value.Changed += new ChangedEventHandler(Item_Changed); 102 base.OnItemsReplaced(items, oldItems); 103 } 104 protected override void OnCollectionReset(IEnumerable<IndexedItem<T>> items, IEnumerable<IndexedItem<T>> oldItems) { 105 foreach (IndexedItem<T> oldItem in oldItems) 106 if (oldItem.Value != null) oldItem.Value.Changed -= new ChangedEventHandler(Item_Changed); 107 foreach (IndexedItem<T> item in items) 108 if (item.Value != null) item.Value.Changed += new ChangedEventHandler(Item_Changed); 109 base.OnCollectionReset(items, oldItems); 110 } 111 protected override void OnPropertyChanged(string propertyName) { 112 base.OnPropertyChanged(propertyName); 113 OnChanged(); 114 } 115 116 private void Item_Changed(object sender, ChangedEventArgs e) { 117 OnChanged(e); 66 public event EventHandler ToStringChanged; 67 protected virtual void OnToStringChanged() { 68 if (ToStringChanged != null) 69 ToStringChanged(this, EventArgs.Empty); 118 70 } 119 71 } -
trunk/sources/HeuristicLab.Core/3.3/ItemSet.cs
r2833 r2932 36 36 [Item("ItemSet<T>", "Represents a set of items.")] 37 37 public class ItemSet<T> : ObservableSet<T>, IItem where T : class, IItem { 38 [Storable(Name = "RestoreEvents")]39 private object RestoreEvents {40 get { return null; }41 set {42 foreach (T item in this)43 if (item != null) item.Changed += new ChangedEventHandler(Item_Changed);44 }45 }46 47 38 public virtual string ItemName { 48 39 get { return ItemAttribute.GetName(this.GetType()); } … … 56 47 57 48 public ItemSet() : base() { } 58 public ItemSet(IEnumerable<T> collection) : base(collection) { 59 foreach (T item in this) 60 if (item != null) item.Changed += new ChangedEventHandler(Item_Changed); 61 } 49 public ItemSet(IEnumerable<T> collection) : base(collection) { } 62 50 63 51 public object Clone() { … … 75 63 } 76 64 77 public event ChangedEventHandler Changed; 78 protected void OnChanged() { 79 OnChanged(new ChangedEventArgs()); 80 } 81 protected virtual void OnChanged(ChangedEventArgs e) { 82 if ((e.RegisterChangedObject(this)) && (Changed != null)) 83 Changed(this, e); 84 } 85 86 protected override void OnItemsAdded(IEnumerable<T> items) { 87 foreach (T item in items) 88 if (item != null) item.Changed += new ChangedEventHandler(Item_Changed); 89 base.OnItemsAdded(items); 90 } 91 protected override void OnItemsRemoved(IEnumerable<T> items) { 92 foreach (T item in items) 93 if (item != null) item.Changed -= new ChangedEventHandler(Item_Changed); 94 base.OnItemsRemoved(items); 95 } 96 protected override void OnCollectionReset(IEnumerable<T> items, IEnumerable<T> oldItems) { 97 foreach (T oldItem in oldItems) 98 if (oldItem != null) oldItem.Changed -= new ChangedEventHandler(Item_Changed); 99 foreach (T item in items) 100 if (item != null) item.Changed += new ChangedEventHandler(Item_Changed); 101 base.OnCollectionReset(items, oldItems); 102 } 103 protected override void OnPropertyChanged(string propertyName) { 104 base.OnPropertyChanged(propertyName); 105 OnChanged(); 106 } 107 108 private void Item_Changed(object sender, ChangedEventArgs e) { 109 OnChanged(e); 65 public event EventHandler ToStringChanged; 66 protected virtual void OnToStringChanged() { 67 if (ToStringChanged != null) 68 ToStringChanged(this, EventArgs.Empty); 110 69 } 111 70 } -
trunk/sources/HeuristicLab.Core/3.3/NamedItem.cs
r2931 r2932 130 130 if (NameChanged != null) 131 131 NameChanged(this, EventArgs.Empty); 132 On Changed();132 OnToStringChanged(); 133 133 } 134 134 /// <inheritdoc/> … … 141 141 if (DescriptionChanged != null) 142 142 DescriptionChanged(this, EventArgs.Empty); 143 OnChanged();144 143 } 145 144 } -
trunk/sources/HeuristicLab.Core/3.3/NamedItemCollection.cs
r2834 r2932 66 66 } 67 67 68 public event ChangedEventHandler Changed; 69 protected void OnChanged() { 70 OnChanged(new ChangedEventArgs()); 71 } 72 protected virtual void OnChanged(ChangedEventArgs e) { 73 if ((e.RegisterChangedObject(this)) && (Changed != null)) 74 Changed(this, e); 68 public event EventHandler ToStringChanged; 69 protected virtual void OnToStringChanged() { 70 if (ToStringChanged != null) 71 ToStringChanged(this, EventArgs.Empty); 75 72 } 76 73 … … 98 95 base.OnCollectionReset(items, oldItems); 99 96 } 100 protected override void OnPropertyChanged(string propertyName) {101 base.OnPropertyChanged(propertyName);102 OnChanged();103 }104 97 105 98 private void RegisterItemEvents(IEnumerable<T> items) { … … 108 101 item.NameChanging += new EventHandler<CancelEventArgs<string>>(Item_NameChanging); 109 102 item.NameChanged += new EventHandler(Item_NameChanged); 110 item.Changed += new ChangedEventHandler(Item_Changed);111 103 } 112 104 } … … 117 109 item.NameChanging -= new EventHandler<CancelEventArgs<string>>(Item_NameChanging); 118 110 item.NameChanged -= new EventHandler(Item_NameChanged); 119 item.Changed -= new ChangedEventHandler(Item_Changed);120 111 } 121 112 } … … 129 120 UpdateItemKey(item); 130 121 } 131 private void Item_Changed(object sender, ChangedEventArgs e) {132 OnChanged(e);133 }134 122 } 135 123 } -
trunk/sources/HeuristicLab.Core/3.3/OperatorGraph.cs
r2853 r2932 114 114 if (InitialOperatorChanged != null) 115 115 InitialOperatorChanged(this, EventArgs.Empty); 116 OnChanged();117 116 } 118 117 … … 153 152 private void RegisterOperatorsEvents() { 154 153 if (operators != null) { 155 operators.Changed += new ChangedEventHandler(Operators_Changed);156 154 operators.ItemsAdded += new CollectionItemsChangedEventHandler<IOperator>(Operators_ItemsAdded); 157 155 operators.ItemsRemoved += new CollectionItemsChangedEventHandler<IOperator>(Operators_ItemsRemoved); … … 175 173 DeregisterOperatorEvents(op); 176 174 } 177 operators.Changed -= new ChangedEventHandler(Operators_Changed);178 175 operators.ItemsAdded -= new CollectionItemsChangedEventHandler<IOperator>(Operators_ItemsAdded); 179 176 operators.ItemsRemoved -= new CollectionItemsChangedEventHandler<IOperator>(Operators_ItemsRemoved); … … 240 237 if (opParam.Value != null) Operators.Add(opParam.Value); 241 238 } 242 private void Operators_Changed(object sender, ChangedEventArgs e) {243 OnChanged(e);244 }245 239 #endregion 246 240 } -
trunk/sources/HeuristicLab.Core/3.3/ParameterizedNamedItem.cs
r2851 r2932 34 34 get { return parameters; } 35 35 private set { 36 if (parameters != null) parameters.Changed -= new ChangedEventHandler(Parameters_Changed);37 36 parameters = value; 38 37 readOnlyParameters = null; 39 if (parameters != null) parameters.Changed += new ChangedEventHandler(Parameters_Changed);40 38 } 41 39 } … … 83 81 return clone; 84 82 } 85 86 private void Parameters_Changed(object sender, ChangedEventArgs e) {87 OnChanged(e);88 }89 83 } 90 84 } -
trunk/sources/HeuristicLab.Core/3.3/Scope.cs
r2931 r2932 41 41 } 42 42 43 [Storable] 43 44 private VariableCollection variables; 44 [Storable]45 45 public VariableCollection Variables { 46 46 get { return variables; } 47 private set {48 if (variables != null) variables.Changed -= new ChangedEventHandler(Variables_Changed);49 variables = value;50 if (variables != null) variables.Changed += new ChangedEventHandler(Variables_Changed);51 }52 47 } 53 48 … … 69 64 : base("Anonymous") { 70 65 parent = null; 71 Variables = new VariableCollection();66 variables = new VariableCollection(); 72 67 SubScopes = new ScopeList(); 73 68 } … … 79 74 : base(name) { 80 75 parent = null; 81 Variables = new VariableCollection();76 variables = new VariableCollection(); 82 77 SubScopes = new ScopeList(); 83 78 } … … 85 80 : base(name, description) { 86 81 parent = null; 87 Variables = new VariableCollection();82 variables = new VariableCollection(); 88 83 SubScopes = new ScopeList(); 89 84 } … … 101 96 clone.Name = Name; 102 97 clone.Description = Description; 103 if (variables.Count > 0) clone. Variables = (VariableCollection)cloner.Clone(variables);98 if (variables.Count > 0) clone.variables = (VariableCollection)cloner.Clone(variables); 104 99 if (subScopes.Count > 0) clone.SubScopes = (ScopeList)cloner.Clone(subScopes); 105 100 return clone; … … 113 108 subScopes.ItemsReplaced += new CollectionItemsChangedEventHandler<IndexedItem<IScope>>(SubScopes_ItemsReplaced); 114 109 subScopes.CollectionReset += new CollectionItemsChangedEventHandler<IndexedItem<IScope>>(SubScopes_CollectionReset); 115 subScopes.Changed += new ChangedEventHandler(SubScopes_Changed);116 110 } 117 111 } … … 122 116 subScopes.ItemsReplaced -= new CollectionItemsChangedEventHandler<IndexedItem<IScope>>(SubScopes_ItemsReplaced); 123 117 subScopes.CollectionReset -= new CollectionItemsChangedEventHandler<IndexedItem<IScope>>(SubScopes_CollectionReset); 124 subScopes.Changed -= new ChangedEventHandler(SubScopes_Changed);125 118 } 126 119 } … … 145 138 item.Value.Parent = this; 146 139 } 147 private void SubScopes_Changed(object sender, ChangedEventArgs e) {148 OnChanged(e);149 }150 #endregion151 152 #region Variables Events153 private void Variables_Changed(object sender, ChangedEventArgs e) {154 OnChanged(e);155 }156 140 #endregion 157 141 } -
trunk/sources/HeuristicLab.Core/3.3/Variable.cs
r2833 r2932 39 39 set { 40 40 if (this.value != value) { 41 if (this.value != null) this.value. Changed -= new ChangedEventHandler(Value_Changed);41 if (this.value != null) this.value.ToStringChanged -= new EventHandler(Value_ToStringChanged); 42 42 this.value = value; 43 if (this.value != null) this.value. Changed += new ChangedEventHandler(Value_Changed);43 if (this.value != null) this.value.ToStringChanged += new EventHandler(Value_ToStringChanged); 44 44 OnValueChanged(); 45 45 } … … 72 72 : base(name) { 73 73 this.value = value; 74 if (this.value != null) this.value. Changed += new ChangedEventHandler(Value_Changed);74 if (this.value != null) this.value.ToStringChanged += new EventHandler(Value_ToStringChanged); 75 75 } 76 76 public Variable(string name, string description, IItem value) 77 77 : base(name, description) { 78 78 this.value = value; 79 if (this.value != null) this.value. Changed += new ChangedEventHandler(Value_Changed);79 if (this.value != null) this.value.ToStringChanged += new EventHandler(Value_ToStringChanged); 80 80 } 81 81 … … 110 110 if (ValueChanged != null) 111 111 ValueChanged(this, EventArgs.Empty); 112 OnChanged();113 112 } 114 113 115 private void Value_ Changed(object sender, ChangedEventArgs e) {116 On Changed(e);114 private void Value_ToStringChanged(object sender, EventArgs e) { 115 OnToStringChanged(); 117 116 } 118 117 } -
trunk/sources/HeuristicLab.Data.Views/3.3/BoolDataView.cs
r2917 r2932 50 50 51 51 protected override void DeregisterContentEvents() { 52 Content. Changed -= new ChangedEventHandler(Content_Changed);52 Content.ValueChanged -= new EventHandler(Content_ValueChanged); 53 53 base.DeregisterContentEvents(); 54 54 } … … 56 56 protected override void RegisterContentEvents() { 57 57 base.RegisterContentEvents(); 58 Content. Changed += new ChangedEventHandler(Content_Changed);58 Content.ValueChanged += new EventHandler(Content_ValueChanged); 59 59 } 60 60 … … 72 72 } 73 73 74 private void Content_ Changed(object sender, ChangedEventArgs e) {74 private void Content_ValueChanged(object sender, EventArgs e) { 75 75 if (InvokeRequired) 76 Invoke(new ChangedEventHandler(Content_Changed), sender, e);76 Invoke(new EventHandler(Content_ValueChanged), sender, e); 77 77 else 78 78 valueCheckBox.Checked = Content.Value; -
trunk/sources/HeuristicLab.Data.Views/3.3/ComparisonDataView.cs
r2917 r2932 51 51 52 52 protected override void DeregisterContentEvents() { 53 Content. Changed -= new ChangedEventHandler(Content_Changed);53 Content.ValueChanged -= new EventHandler(Content_ValueChanged); 54 54 base.DeregisterContentEvents(); 55 55 } … … 57 57 protected override void RegisterContentEvents() { 58 58 base.RegisterContentEvents(); 59 Content. Changed += new ChangedEventHandler(Content_Changed);59 Content.ValueChanged += new EventHandler(Content_ValueChanged); 60 60 } 61 61 … … 72 72 } 73 73 74 private void Content_ Changed(object sender, ChangedEventArgs e) {74 private void Content_ValueChanged(object sender, EventArgs e) { 75 75 if (InvokeRequired) 76 Invoke(new ChangedEventHandler(Content_Changed), sender, e);76 Invoke(new EventHandler(Content_ValueChanged), sender, e); 77 77 else 78 78 valueComboBox.SelectedItem = Content.Value; -
trunk/sources/HeuristicLab.Data.Views/3.3/StringConvertibleDataView.cs
r2917 r2932 53 53 54 54 protected override void DeregisterContentEvents() { 55 Content. Changed -= new ChangedEventHandler(Content_Changed);55 Content.ValueChanged -= new EventHandler(Content_ValueChanged); 56 56 base.DeregisterContentEvents(); 57 57 } … … 59 59 protected override void RegisterContentEvents() { 60 60 base.RegisterContentEvents(); 61 Content. Changed += new ChangedEventHandler(Content_Changed);61 Content.ValueChanged += new EventHandler(Content_ValueChanged); 62 62 } 63 63 … … 75 75 } 76 76 77 private void Content_ Changed(object sender, ChangedEventArgs e) {77 private void Content_ValueChanged(object sender, EventArgs e) { 78 78 if (InvokeRequired) 79 Invoke(new ChangedEventHandler(Content_Changed), sender, e);79 Invoke(new EventHandler(Content_ValueChanged), sender, e); 80 80 else 81 81 valueTextBox.Text = Content.GetValue(); -
trunk/sources/HeuristicLab.Data/3.3/IStringConvertibleData.cs
r2790 r2932 32 32 bool SetValue(string value); 33 33 34 event ChangedEventHandlerChanged;34 event EventHandler ValueChanged; 35 35 } 36 36 } -
trunk/sources/HeuristicLab.Data/3.3/StringArrayData.cs
r2863 r2932 139 139 if (ItemChanged != null) 140 140 ItemChanged(this, new EventArgs<int, int>(index, 0)); 141 On Changed();141 OnToStringChanged(); 142 142 } 143 143 private event EventHandler Reset; … … 149 149 if (Reset != null) 150 150 Reset(this, EventArgs.Empty); 151 On Changed();151 OnToStringChanged(); 152 152 } 153 153 #endregion -
trunk/sources/HeuristicLab.Data/3.3/StringData.cs
r2790 r2932 40 40 if ((value != null) || (this.value != string.Empty)) { 41 41 this.value = value != null ? value : string.Empty; 42 On Changed();42 OnValueChanged(); 43 43 } 44 44 } … … 71 71 } 72 72 73 public event EventHandler ValueChanged; 74 private void OnValueChanged() { 75 if (ValueChanged != null) 76 ValueChanged(this, EventArgs.Empty); 77 OnToStringChanged(); 78 } 79 73 80 #region IStringConvertibleData Members 74 81 bool IStringConvertibleData.Validate(string value, out string errorMessage) { -
trunk/sources/HeuristicLab.Data/3.3/StringMatrixData.cs
r2790 r2932 160 160 if (ItemChanged != null) 161 161 ItemChanged(this, new EventArgs<int, int>(rowIndex, columnIndex)); 162 On Changed();162 OnToStringChanged(); 163 163 } 164 164 private event EventHandler Reset; … … 170 170 if (Reset != null) 171 171 Reset(this, EventArgs.Empty); 172 On Changed();172 OnToStringChanged(); 173 173 } 174 174 #endregion -
trunk/sources/HeuristicLab.Data/3.3/ValueTypeArrayData.cs
r2790 r2932 95 95 if (ItemChanged != null) 96 96 ItemChanged(this, new EventArgs<int, int>(index, 0)); 97 On Changed();97 OnToStringChanged(); 98 98 } 99 99 protected event EventHandler Reset; … … 101 101 if (Reset != null) 102 102 Reset(this, EventArgs.Empty); 103 On Changed();103 OnToStringChanged(); 104 104 } 105 105 } -
trunk/sources/HeuristicLab.Data/3.3/ValueTypeData.cs
r2790 r2932 38 38 if (!value.Equals(this.value)) { 39 39 this.value = value; 40 On Changed();40 OnValueChanged(); 41 41 } 42 42 } … … 59 59 return value.ToString(); 60 60 } 61 62 public event EventHandler ValueChanged; 63 protected virtual void OnValueChanged() { 64 if (ValueChanged != null) 65 ValueChanged(this, EventArgs.Empty); 66 OnToStringChanged(); 67 } 61 68 } 62 69 } -
trunk/sources/HeuristicLab.Data/3.3/ValueTypeMatrixData.cs
r2790 r2932 112 112 if (ItemChanged != null) 113 113 ItemChanged(this, new EventArgs<int, int>(rowIndex, columnIndex)); 114 On Changed();114 OnToStringChanged(); 115 115 } 116 116 protected event EventHandler Reset; … … 118 118 if (Reset != null) 119 119 Reset(this, EventArgs.Empty); 120 On Changed();120 OnToStringChanged(); 121 121 } 122 122 } -
trunk/sources/HeuristicLab.Encodings.Permutation/3.3/Tests/Random.cs
r2929 r2932 112 112 } 113 113 114 public event ChangedEventHandlerChanged;114 public event EventHandler ToStringChanged; 115 115 116 116 #endregion -
trunk/sources/HeuristicLab.Encodings.RealVector/3.3/Tests/TestRandom.cs
r2929 r2932 112 112 } 113 113 114 public event ChangedEventHandlerChanged;114 public event EventHandler ToStringChanged; 115 115 116 116 #endregion -
trunk/sources/HeuristicLab.Operators.Programmable/3.3/ProgrammableOperator.cs
r2911 r2932 37 37 using HeuristicLab.PluginInfrastructure; 38 38 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 39 using HeuristicLab.Collections; 39 40 40 41 namespace HeuristicLab.Operators.Programmable { … … 168 169 Plugins = defaultPluginDict; 169 170 namespaces = new HashSet<string>(DiscoverNamespaces()); 170 Parameters.Changed += (s, a) => OnSignatureChanged(s, a); 171 } 172 173 protected void OnSignatureChanged(object sender, EventArgs args) { 171 Parameters.ItemsAdded += (s, a) => OnSignatureChanged(s, a); 172 Parameters.ItemsRemoved += (s, a) => OnSignatureChanged(s, a); 173 Parameters.ItemsReplaced += (s, a) => OnSignatureChanged(s, a); 174 Parameters.CollectionReset += (s, a) => OnSignatureChanged(s, a); 175 } 176 177 protected void OnSignatureChanged(object sender, CollectionItemsChangedEventArgs<IParameter> args) { 174 178 if (SignatureChanged != null) 175 SignatureChanged(sender, args);179 SignatureChanged(sender, EventArgs.Empty); 176 180 } 177 181 -
trunk/sources/HeuristicLab.Operators/3.3/Operator.cs
r2845 r2932 163 163 BreakpointChanged(this, EventArgs.Empty); 164 164 } 165 OnChanged();166 165 } 167 166 /// <inheritdoc/> -
trunk/sources/HeuristicLab.Optimization/3.3/Algorithm.cs
r2882 r2932 112 112 if (ProblemChanged != null) 113 113 ProblemChanged(this, EventArgs.Empty); 114 OnChanged();115 114 } 116 115 public event EventHandler ExecutionTimeChanged; … … 118 117 if (ExecutionTimeChanged != null) 119 118 ExecutionTimeChanged(this, EventArgs.Empty); 120 OnChanged();121 119 } 122 120 public event EventHandler Prepared; … … 124 122 if (Prepared != null) 125 123 Prepared(this, EventArgs.Empty); 126 OnChanged();127 124 } 128 125 public event EventHandler Started; … … 130 127 if (Started != null) 131 128 Started(this, EventArgs.Empty); 132 OnChanged();133 129 } 134 130 public event EventHandler Stopped; … … 136 132 if (Stopped != null) 137 133 Stopped(this, EventArgs.Empty); 138 OnChanged();139 134 } 140 135 protected virtual void OnCanceledChanged() { } … … 147 142 problem.SolutionCreatorChanged -= new EventHandler(Problem_SolutionCreatorChanged); 148 143 problem.EvaluatorChanged -= new EventHandler(Problem_EvaluatorChanged); 149 problem.Changed -= new ChangedEventHandler(Problem_Changed);150 144 } 151 145 protected virtual void RegisterProblemEvents() { 152 146 problem.SolutionCreatorChanged += new EventHandler(Problem_SolutionCreatorChanged); 153 147 problem.EvaluatorChanged += new EventHandler(Problem_EvaluatorChanged); 154 problem.Changed += new ChangedEventHandler(Problem_Changed);155 148 } 156 149 157 150 protected virtual void Problem_SolutionCreatorChanged(object sender, EventArgs e) { } 158 151 protected virtual void Problem_EvaluatorChanged(object sender, EventArgs e) { } 159 private void Problem_Changed(object sender, ChangedEventArgs e) {160 OnChanged(e);161 }162 152 #endregion 163 153 } -
trunk/sources/HeuristicLab.Optimization/3.3/EngineAlgorithm.cs
r2924 r2932 195 195 if (EngineChanged != null) 196 196 EngineChanged(this, EventArgs.Empty); 197 OnChanged();198 197 } 199 198 … … 202 201 } 203 202 private void RegisterEngineEvents() { 204 Engine.Changed += new ChangedEventHandler(Engine_Changed);205 203 Engine.ExceptionOccurred += new EventHandler<EventArgs<Exception>>(Engine_ExceptionOccurred); 206 204 Engine.ExecutionTimeChanged += new EventHandler(Engine_ExecutionTimeChanged); … … 208 206 } 209 207 private void DeregisterEngineEvents() { 210 Engine.Changed -= new ChangedEventHandler(Engine_Changed);211 208 Engine.ExceptionOccurred -= new EventHandler<EventArgs<Exception>>(Engine_ExceptionOccurred); 212 209 Engine.ExecutionTimeChanged -= new EventHandler(Engine_ExecutionTimeChanged); … … 223 220 OnStopped(); 224 221 } 225 private void Engine_Changed(object sender, ChangedEventArgs e) {226 OnChanged(e);227 }228 222 } 229 223 } -
trunk/sources/HeuristicLab.Parameters/3.3/LookupParameter.cs
r2852 r2932 156 156 if (ActualNameChanged != null) 157 157 ActualNameChanged(this, EventArgs.Empty); 158 On Changed();158 OnToStringChanged(); 159 159 } 160 160 -
trunk/sources/HeuristicLab.Parameters/3.3/OptionalConstrainedValueParameter.cs
r2924 r2932 50 50 if (value != this.value) { 51 51 if ((value != null) && !validValues.Contains(value)) throw new ArgumentException("Invalid value."); 52 if (this.value != null) this.value.ToStringChanged -= new EventHandler(Value_ToStringChanged); 52 53 this.value = value; 54 if (this.value != null) this.value.ToStringChanged += new EventHandler(Value_ToStringChanged); 53 55 OnValueChanged(); 54 56 } 55 57 } 56 58 } 59 57 60 IItem IValueParameter.Value { 58 61 get { return Value; } … … 121 124 if (ValueChanged != null) 122 125 ValueChanged(this, EventArgs.Empty); 123 On Changed();126 OnToStringChanged(); 124 127 } 125 128 … … 129 132 validValues.ItemsRemoved += new CollectionItemsChangedEventHandler<T>(ValidValues_ItemsRemoved); 130 133 validValues.CollectionReset += new CollectionItemsChangedEventHandler<T>(ValidValues_CollectionReset); 131 validValues.Changed += new ChangedEventHandler(ValidValues_Changed);132 134 } 133 135 } … … 138 140 validValues.ItemsRemoved -= new CollectionItemsChangedEventHandler<T>(ValidValues_ItemsRemoved); 139 141 validValues.CollectionReset -= new CollectionItemsChangedEventHandler<T>(ValidValues_CollectionReset); 140 validValues.Changed -= new ChangedEventHandler(ValidValues_Changed);141 142 } 142 143 } … … 149 150 if ((Value != null) && !validValues.Contains(Value)) Value = null; 150 151 } 151 protected virtual void Val idValues_Changed(object sender, ChangedEventArgs e) {152 On Changed(e);152 protected virtual void Value_ToStringChanged(object sender, EventArgs e) { 153 OnToStringChanged(); 153 154 } 154 155 } -
trunk/sources/HeuristicLab.Parameters/3.3/OptionalValueParameter.cs
r2924 r2932 37 37 set { 38 38 if (value != this.value) { 39 if (this.value != null) this.value. Changed -= new ChangedEventHandler(Value_Changed);39 if (this.value != null) this.value.ToStringChanged -= new EventHandler(Value_ToStringChanged); 40 40 this.value = value; 41 if (this.value != null) this.value. Changed += new ChangedEventHandler(Value_Changed);41 if (this.value != null) this.value.ToStringChanged += new EventHandler(Value_ToStringChanged); 42 42 OnValueChanged(); 43 43 } … … 96 96 if (ValueChanged != null) 97 97 ValueChanged(this, EventArgs.Empty); 98 On Changed();98 OnToStringChanged(); 99 99 } 100 private void Value_ Changed(object sender, ChangedEventArgs e) {101 On Changed(e);100 private void Value_ToStringChanged(object sender, EventArgs e) { 101 OnToStringChanged(); 102 102 } 103 103 } -
trunk/sources/HeuristicLab.Parameters/3.3/ValueLookupParameter.cs
r2852 r2932 37 37 set { 38 38 if (value != this.value) { 39 if (this.value != null) this.value. Changed -= new ChangedEventHandler(Value_Changed);39 if (this.value != null) this.value.ToStringChanged -= new EventHandler(Value_ToStringChanged); 40 40 this.value = value; 41 if (this.value != null) this.value. Changed += new ChangedEventHandler(Value_Changed);41 if (this.value != null) this.value.ToStringChanged += new EventHandler(Value_ToStringChanged); 42 42 OnValueChanged(); 43 43 } … … 89 89 if (ValueChanged != null) 90 90 ValueChanged(this, EventArgs.Empty); 91 On Changed();91 OnToStringChanged(); 92 92 } 93 private void Value_ Changed(object sender, ChangedEventArgs e) {94 On Changed(e);93 private void Value_ToStringChanged(object sender, EventArgs e) { 94 OnToStringChanged(); 95 95 } 96 96 }
Note: See TracChangeset
for help on using the changeset viewer.