Changeset 4770 for branches/ParameterBinding/HeuristicLab.Parameters
- Timestamp:
- 11/11/10 14:03:24 (14 years ago)
- Location:
- branches/ParameterBinding/HeuristicLab.Parameters/3.3
- Files:
-
- 2 added
- 2 deleted
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ParameterBinding/HeuristicLab.Parameters/3.3/HeuristicLab.Parameters-3.3.csproj
r4758 r4770 111 111 <None Include="HeuristicLabParametersPlugin.cs.frame" /> 112 112 <Compile Include="ConstrainedValueParameter.cs" /> 113 <Compile Include="ParameterSecondLevel ValueBinding.cs" />113 <Compile Include="ParameterSecondLevelNameBinding.cs" /> 114 114 <Compile Include="ParameterValueBinding.cs" /> 115 115 <Compile Include="OptionalConstrainedValueParameter.cs" /> 116 <Compile Include="Parameter ActualNameBinding.cs" />116 <Compile Include="ParameterNameBinding.cs" /> 117 117 <Compile Include="ScopeTreeLookupParameter.cs" /> 118 118 <Compile Include="ValueParameter.cs" /> -
branches/ParameterBinding/HeuristicLab.Parameters/3.3/ParameterValueBinding.cs
r4757 r4770 11 11 public class ParameterValueBinding : IParameterBinding { 12 12 [Storable] 13 private IValueParameter recipient;14 public IValueParameter Recipient {15 get { return recipient; }13 private IValueParameter target; 14 public IValueParameter Target { 15 get { return target; } 16 16 } 17 17 [Storable] 18 private IValueParameter donor;19 public IValueParameter Donor{20 get { return donor; }18 private IValueParameter source; 19 public IValueParameter Source { 20 get { return source; } 21 21 } 22 22 … … 24 24 protected ParameterValueBinding(bool deserializing) { } 25 25 protected ParameterValueBinding(ParameterValueBinding original, Cloner cloner) { 26 this. donor = cloner.Clone(donor);27 this. recipient = cloner.Clone(recipient);26 this.source = cloner.Clone(source); 27 this.target = cloner.Clone(target); 28 28 RegisterEventHandlers(); 29 29 } 30 public ParameterValueBinding(IValueParameter recipient, IValueParameter donor) { 31 if (recipient == null) throw new ArgumentNullException("destination"); 32 if (donor == null) throw new ArgumentNullException("source"); 33 this.recipient = recipient; 34 this.donor = donor; 35 RegisterEventHandlers(); 30 public ParameterValueBinding(IValueParameter target, IValueParameter source) { 31 if (target == null) throw new ArgumentNullException("destination"); 32 if (source == null) throw new ArgumentNullException("source"); 33 this.target = target; 34 this.source = source; 36 35 } 37 36 38 public override IDeepCloneable Clone(Cloner cloner) { 37 public object Clone() { 38 return Clone(new Cloner()); 39 } 40 41 public virtual IDeepCloneable Clone(Cloner cloner) { 39 42 return new ParameterValueBinding(this, cloner); 40 43 } … … 42 45 public void Bind() { 43 46 RegisterEventHandlers(); 47 ExecuteBinding(); 44 48 } 45 49 … … 54 58 55 59 private void RegisterEventHandlers() { 56 donor.ValueChanged += new EventHandler(source_ValueChanged);60 source.ValueChanged += new EventHandler(source_ValueChanged); 57 61 } 58 62 59 63 private void DeregisterEventHandlers() { 60 donor.ValueChanged -= new EventHandler(source_ValueChanged);64 source.ValueChanged -= new EventHandler(source_ValueChanged); 61 65 } 62 63 66 64 67 private void source_ValueChanged(object sender, EventArgs e) { 65 recipient.Value = (IItem)donor.Value.Clone(); 68 ExecuteBinding(); 69 } 70 71 private void ExecuteBinding() { 72 target.Value = (IItem)source.Value.Clone(); 66 73 } 67 74 }
Note: See TracChangeset
for help on using the changeset viewer.