Changeset 11605


Ignore:
Timestamp:
12/01/14 14:19:16 (7 years ago)
Author:
jkarder
Message:

#2262: VariableStore now implements IItem

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Scripting/3.3/VariableStore.cs

    r11066 r11605  
    2121
    2222using System;
     23using System.Drawing;
    2324using System.IO;
    2425using HeuristicLab.Collections;
    2526using HeuristicLab.Common;
     27using HeuristicLab.Common.Resources;
    2628using HeuristicLab.Core;
    2729using HeuristicLab.Persistence.Core;
     
    3234  [Item("VariableStore", "Represents a variable store.")]
    3335  [StorableClass]
    34   public class VariableStore : ObservableDictionary<string, object>, IContent, IDeepCloneable {
     36  public class VariableStore : ObservableDictionary<string, object>, IItem {
     37    #region Properties
     38    public virtual string ItemName {
     39      get { return ItemAttribute.GetName(GetType()); }
     40    }
     41    public virtual string ItemDescription {
     42      get { return ItemAttribute.GetDescription(GetType()); }
     43    }
     44    public Version ItemVersion {
     45      get { return ItemAttribute.GetVersion(GetType()); }
     46    }
     47    public static Image StaticItemImage {
     48      get { return VSImageLibrary.Class; }
     49    }
     50    public virtual Image ItemImage {
     51      get { return ItemAttribute.GetImage(GetType()); }
     52    }
     53    #endregion
     54
     55    #region Constructors & Cloning
    3556    [StorableConstructor]
    3657    protected VariableStore(bool deserializing) : base(deserializing) { }
     
    6889      }
    6990    }
     91    #endregion
     92
     93    #region Overrides
     94    public override string ToString() {
     95      return ItemName;
     96    }
     97    #endregion
     98
     99    #region Events
     100    public event EventHandler ItemImageChanged;
     101    protected virtual void OnItemImageChanged() {
     102      var handler = ItemImageChanged;
     103      if (handler != null) handler(this, EventArgs.Empty);
     104    }
     105    public event EventHandler ToStringChanged;
     106    protected virtual void OnToStringChanged() {
     107      var handler = ToStringChanged;
     108      if (handler != null) handler(this, EventArgs.Empty);
     109    }
     110    #endregion
    70111  }
    71112}
Note: See TracChangeset for help on using the changeset viewer.