- Timestamp:
- 07/22/19 14:15:55 (5 years ago)
- Location:
- stable
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
stable
- Property svn:mergeinfo changed
/trunk merged: 16872-16873,16875,16890
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Parameters/3.3/ValueLookupParameter.cs
r17097 r17149 22 22 using System; 23 23 using System.Drawing; 24 using HEAL.Attic; 24 25 using HeuristicLab.Common; 25 26 using HeuristicLab.Core; 26 using HEAL.Attic;27 27 28 28 namespace HeuristicLab.Parameters { … … 45 45 get { return this.value; } 46 46 set { 47 if (ReadOnly) throw new InvalidOperationException("Cannot set the value of a readonly parameter."); 47 48 if (value != this.value) { 48 49 DeregisterValueEvents(); … … 66 67 } 67 68 69 [Storable(DefaultValue = false)] 70 private bool readOnly; 71 public bool ReadOnly { 72 get { return readOnly; } 73 set { 74 if (value == readOnly) return; 75 readOnly = value; 76 OnReadOnlyChanged(); 77 } 78 } 79 68 80 [Storable(DefaultValue = true)] 69 81 private bool getsCollected; … … 84 96 : base(original, cloner) { 85 97 value = cloner.Clone(original.value); 98 readOnly = original.readOnly; 86 99 getsCollected = original.getsCollected; 87 100 RegisterValueEvents(); … … 89 102 public ValueLookupParameter() 90 103 : base() { 104 this.readOnly = false; 91 105 this.Hidden = false; 92 106 this.getsCollected = true; … … 94 108 public ValueLookupParameter(string name) 95 109 : base(name) { 110 this.readOnly = false; 96 111 this.Hidden = false; 97 112 this.getsCollected = true; 98 }99 public ValueLookupParameter(string name, bool getsCollected)100 : base(name) {101 this.Hidden = false;102 this.getsCollected = getsCollected;103 113 } 104 114 public ValueLookupParameter(string name, T value) 105 115 : base(name) { 106 116 this.value = value; 117 this.readOnly = false; 107 118 this.Hidden = false; 108 119 this.getsCollected = true; 109 120 RegisterValueEvents(); 110 121 } 111 public ValueLookupParameter(string name, T value, bool getsCollected)112 : base(name) {113 this.value = value;114 this.Hidden = false;115 this.getsCollected = getsCollected;116 RegisterValueEvents();117 }118 122 public ValueLookupParameter(string name, string description) 119 123 : base(name, description) { 124 this.readOnly = false; 120 125 this.Hidden = false; 121 126 this.getsCollected = true; 122 }123 public ValueLookupParameter(string name, string description, bool getsCollected)124 : base(name, description) {125 this.Hidden = false;126 this.getsCollected = getsCollected;127 127 } 128 128 public ValueLookupParameter(string name, string description, T value) 129 129 : base(name, description) { 130 130 this.value = value; 131 this.readOnly = false; 131 132 this.Hidden = false; 132 133 this.getsCollected = true; 133 134 RegisterValueEvents(); 134 135 } 135 public ValueLookupParameter(string name, string description, T value, bool getsCollected)136 : base(name, description) {137 this.value = value;138 this.Hidden = false;139 this.getsCollected = getsCollected;140 RegisterValueEvents();141 }142 136 public ValueLookupParameter(string name, string description, string actualName) 143 137 : base(name, description, actualName) { 138 this.readOnly = false; 144 139 this.Hidden = false; 145 140 this.getsCollected = true; 146 }147 public ValueLookupParameter(string name, string description, string actualName, bool getsCollected)148 : base(name, description, actualName) {149 this.Hidden = false;150 this.getsCollected = getsCollected;151 141 } 152 142 #endregion … … 177 167 OnToStringChanged(); 178 168 } 169 public event EventHandler ReadOnlyChanged; 170 protected virtual void OnReadOnlyChanged() { 171 EventHandler handler = ReadOnlyChanged; 172 if (handler != null) handler(this, EventArgs.Empty); 173 } 179 174 public event EventHandler GetsCollectedChanged; 180 175 protected virtual void OnGetsCollectedChanged() {
Note: See TracChangeset
for help on using the changeset viewer.