Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/10/09 16:50:26 (14 years ago)
Author:
swagner
Message:

Implemented generic EventArgs (#796)

Location:
trunk/sources/HeuristicLab.GP/3.4
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.GP/3.4/GPOperatorGroup.cs

    r1914 r2474  
    3030using HeuristicLab.Constraints;
    3131using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     32using HeuristicLab.Common;
    3233
    3334namespace HeuristicLab.GP {
     
    207208    }
    208209
    209     public event EventHandler OperatorAdded;
    210     public event EventHandler OperatorRemoved;
     210    public event EventHandler<EventArgs<IOperator>> OperatorAdded;
     211    public event EventHandler<EventArgs<IOperator>> OperatorRemoved;
    211212
    212213    protected virtual void OnOperatorAdded(IOperator op) {
    213214      if(OperatorAdded != null) {
    214         OperatorAdded(this, new OperatorEventArgs(op));
     215        OperatorAdded(this, new EventArgs<IOperator>(op));
    215216      }
    216217    }
    217218    protected virtual void OnOperatorRemoved(IOperator op) {
    218219      if(OperatorRemoved != null) {
    219         OperatorRemoved(this, new OperatorEventArgs(op));
    220       }
    221     }
    222   }
    223 
    224   internal class OperatorEventArgs : EventArgs {
    225     public IOperator op;
    226 
    227     public OperatorEventArgs(IOperator op) {
    228       this.op = op;
     220        OperatorRemoved(this, new EventArgs<IOperator>(op));
     221      }
    229222    }
    230223  }
  • trunk/sources/HeuristicLab.GP/3.4/GPOperatorLibraryEditor.cs

    r1529 r2474  
    3333using HeuristicLab.Operators;
    3434using HeuristicLab.Random;
     35using HeuristicLab.Common;
    3536
    3637namespace HeuristicLab.GP {
     
    4748      operatorLibraryEditor.OperatorLibrary = library;
    4849
    49       library.GPOperatorGroup.OperatorAdded += new EventHandler(GPOperatorLibraryView_OperatorAdded);
    50       library.GPOperatorGroup.OperatorRemoved += new EventHandler(GPOperatorGroup_OperatorRemoved);
     50      library.GPOperatorGroup.OperatorAdded += new EventHandler<EventArgs<IOperator>>(GPOperatorLibraryView_OperatorAdded);
     51      library.GPOperatorGroup.OperatorRemoved += new EventHandler<EventArgs<IOperator>>(GPOperatorGroup_OperatorRemoved);
    5152
    5253      mutationVariableView.Enabled = false;
     
    7273
    7374
    74     private void GPOperatorLibraryView_OperatorAdded(object sender, EventArgs e) {
    75       IOperator op = ((OperatorEventArgs)e).op;
     75    private void GPOperatorLibraryView_OperatorAdded(object sender, EventArgs<IOperator> e) {
     76      IOperator op = e.Value;
    7677      if(op.GetVariable(FunctionBase.MANIPULATION) != null) {
    7778        ListViewItem operatorMutationItem = new ListViewItem();
     
    113114
    114115
    115     private void GPOperatorGroup_OperatorRemoved(object sender, EventArgs e) {
    116       IOperator op = ((OperatorEventArgs)e).op;
     116    private void GPOperatorGroup_OperatorRemoved(object sender, EventArgs<IOperator> e) {
     117      IOperator op = e.Value;
    117118
    118119      foreach(ListViewItem item in mutationListView.Items) {
  • trunk/sources/HeuristicLab.GP/3.4/HeuristicLab.GP-3.4.csproj

    r1914 r2474  
    128128  </ItemGroup>
    129129  <ItemGroup>
     130    <ProjectReference Include="..\..\HeuristicLab.Common\3.2\HeuristicLab.Common-3.2.csproj">
     131      <Project>{1FC004FC-59AF-4249-B1B6-FF25873A20E4}</Project>
     132      <Name>HeuristicLab.Common-3.2</Name>
     133    </ProjectReference>
    130134    <ProjectReference Include="..\..\HeuristicLab.Constraints\3.3\HeuristicLab.Constraints-3.3.csproj">
    131135      <Project>{19C1E42A-4B48-4EFD-B697-899016F1C198}</Project>
  • trunk/sources/HeuristicLab.GP/3.4/HeuristicLabGPPlugin.cs

    r1914 r2474  
    2828  [ClassInfo(Name = "HeuristicLab.GP-3.4")]
    2929  [PluginFile(Filename = "HeuristicLab.GP-3.4.dll", Filetype = PluginFileType.Assembly)]
     30  [Dependency(Dependency = "HeuristicLab.Common-3.2")]
    3031  [Dependency(Dependency = "HeuristicLab.Constraints-3.3")]
    3132  [Dependency(Dependency = "HeuristicLab.Core-3.3")]
Note: See TracChangeset for help on using the changeset viewer.