Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/22/10 05:14:39 (15 years ago)
Author:
swagner
Message:

Worked on the refactoring of saving and loading items (#990)

Location:
trunk/sources/HeuristicLab.Core/3.3/Collections
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Core/3.3/Collections/ItemArray.cs

    r3431 r3483  
    3636  [Item("ItemArray<T>", "Represents an array of items.")]
    3737  public class ItemArray<T> : ObservableArray<T>, IItemArray<T> where T : class, IItem {
     38    private string filename;
     39    public string Filename {
     40      get { return filename; }
     41      set {
     42        if (!filename.Equals(value)) {
     43          filename = value;
     44          OnFilenameChanged();
     45        }
     46      }
     47    }
     48
    3849    public virtual string ItemName {
    3950      get { return ItemAttribute.GetName(this.GetType()); }
     
    7788    }
    7889
     90    public event EventHandler FilenameChanged;
     91    protected virtual void OnFilenameChanged() {
     92      EventHandler handler = FilenameChanged;
     93      if (handler != null) handler(this, EventArgs.Empty);
     94    }
    7995    public event EventHandler ItemImageChanged;
    8096    protected virtual void OnItemImageChanged() {
  • trunk/sources/HeuristicLab.Core/3.3/Collections/ItemCollection.cs

    r3431 r3483  
    3333  [Item("ItemCollection<T>", "Represents a collection of items.")]
    3434  public class ItemCollection<T> : ObservableCollection<T>, IItemCollection<T> where T : class, IItem {
     35    private string filename;
     36    public string Filename {
     37      get { return filename; }
     38      set {
     39        if (!filename.Equals(value)) {
     40          filename = value;
     41          OnFilenameChanged();
     42        }
     43      }
     44    }
     45
    3546    public virtual string ItemName {
    3647      get { return ItemAttribute.GetName(this.GetType()); }
     
    7384    }
    7485
     86    public event EventHandler FilenameChanged;
     87    protected virtual void OnFilenameChanged() {
     88      EventHandler handler = FilenameChanged;
     89      if (handler != null) handler(this, EventArgs.Empty);
     90    }
    7591    public event EventHandler ItemImageChanged;
    7692    protected virtual void OnItemImageChanged() {
  • trunk/sources/HeuristicLab.Core/3.3/Collections/ItemDictionary.cs

    r3431 r3483  
    3333  [Item("ItemDictionary<TKey, TValue>", "Represents a dictionary of items.")]
    3434  public class ItemDictionary<TKey, TValue> : ObservableDictionary<TKey, TValue>, IItemDictionary<TKey, TValue> where TKey : class, IItem where TValue : class, IItem {
     35    private string filename;
     36    public string Filename {
     37      get { return filename; }
     38      set {
     39        if (!filename.Equals(value)) {
     40          filename = value;
     41          OnFilenameChanged();
     42        }
     43      }
     44    }
     45
    3546    public virtual string ItemName {
    3647      get { return ItemAttribute.GetName(this.GetType()); }
     
    7485    }
    7586
     87    public event EventHandler FilenameChanged;
     88    protected virtual void OnFilenameChanged() {
     89      EventHandler handler = FilenameChanged;
     90      if (handler != null) handler(this, EventArgs.Empty);
     91    }
    7692    public event EventHandler ItemImageChanged;
    7793    protected virtual void OnItemImageChanged() {
  • trunk/sources/HeuristicLab.Core/3.3/Collections/ItemList.cs

    r3431 r3483  
    3636  [Item("ItemList<T>", "Represents a list of items.")]
    3737  public class ItemList<T> : ObservableList<T>, IItemList<T> where T : class, IItem {
     38    private string filename;
     39    public string Filename {
     40      get { return filename; }
     41      set {
     42        if (!filename.Equals(value)) {
     43          filename = value;
     44          OnFilenameChanged();
     45        }
     46      }
     47    }
     48
    3849    public virtual string ItemName {
    3950      get { return ItemAttribute.GetName(this.GetType()); }
     
    7687    }
    7788
     89    public event EventHandler FilenameChanged;
     90    protected virtual void OnFilenameChanged() {
     91      EventHandler handler = FilenameChanged;
     92      if (handler != null) handler(this, EventArgs.Empty);
     93    }
    7894    public event EventHandler ItemImageChanged;
    7995    protected virtual void OnItemImageChanged() {
  • trunk/sources/HeuristicLab.Core/3.3/Collections/ItemSet.cs

    r3431 r3483  
    3636  [Item("ItemSet<T>", "Represents a set of items.")]
    3737  public class ItemSet<T> : ObservableSet<T>, IItemSet<T> where T : class, IItem {
     38    private string filename;
     39    public string Filename {
     40      get { return filename; }
     41      set {
     42        if (!filename.Equals(value)) {
     43          filename = value;
     44          OnFilenameChanged();
     45        }
     46      }
     47    }
     48
    3849    public virtual string ItemName {
    3950      get { return ItemAttribute.GetName(this.GetType()); }
     
    7586    }
    7687
     88    public event EventHandler FilenameChanged;
     89    protected virtual void OnFilenameChanged() {
     90      EventHandler handler = FilenameChanged;
     91      if (handler != null) handler(this, EventArgs.Empty);
     92    }
    7793    public event EventHandler ItemImageChanged;
    7894    protected virtual void OnItemImageChanged() {
  • trunk/sources/HeuristicLab.Core/3.3/Collections/KeyedItemCollection.cs

    r3431 r3483  
    3232  [StorableClass]
    3333  public abstract class KeyedItemCollection<TKey, TItem> : ObservableKeyedCollection<TKey, TItem>, IKeyedItemCollection<TKey, TItem> where TItem : class, IItem {
     34    private string filename;
     35    public string Filename {
     36      get { return filename; }
     37      set {
     38        if (!filename.Equals(value)) {
     39          filename = value;
     40          OnFilenameChanged();
     41        }
     42      }
     43    }
     44
    3445    public virtual string ItemName {
    3546      get { return ItemAttribute.GetName(this.GetType()); }
     
    7586    }
    7687
     88    public event EventHandler FilenameChanged;
     89    protected virtual void OnFilenameChanged() {
     90      EventHandler handler = FilenameChanged;
     91      if (handler != null) handler(this, EventArgs.Empty);
     92    }
    7793    public event EventHandler ItemImageChanged;
    7894    protected virtual void OnItemImageChanged() {
  • trunk/sources/HeuristicLab.Core/3.3/Collections/ReadOnlyItemArray.cs

    r3431 r3483  
    3333  [Item("ReadOnlyItemArray<T>", "Represents a read-only array of items.")]
    3434  public class ReadOnlyItemArray<T> : ReadOnlyObservableArray<T>, IItemArray<T> where T : class, IItem {
     35    private string filename;
     36    public string Filename {
     37      get { return filename; }
     38      set {
     39        if (!filename.Equals(value)) {
     40          filename = value;
     41          OnFilenameChanged();
     42        }
     43      }
     44    }
     45
    3546    public virtual string ItemName {
    3647      get { return ItemAttribute.GetName(this.GetType()); }
     
    7485    }
    7586
     87    public event EventHandler FilenameChanged;
     88    protected virtual void OnFilenameChanged() {
     89      EventHandler handler = FilenameChanged;
     90      if (handler != null) handler(this, EventArgs.Empty);
     91    }
    7692    public event EventHandler ItemImageChanged;
    7793    protected virtual void OnItemImageChanged() {
  • trunk/sources/HeuristicLab.Core/3.3/Collections/ReadOnlyItemCollection.cs

    r3431 r3483  
    3333  [Item("ReadOnlyItemCollection<T>", "Represents a read-only collection of items.")]
    3434  public class ReadOnlyItemCollection<T> : ReadOnlyObservableCollection<T>, IItemCollection<T> where T : class, IItem {
     35    private string filename;
     36    public string Filename {
     37      get { return filename; }
     38      set {
     39        if (!filename.Equals(value)) {
     40          filename = value;
     41          OnFilenameChanged();
     42        }
     43      }
     44    }
     45
    3546    public virtual string ItemName {
    3647      get { return ItemAttribute.GetName(this.GetType()); }
     
    7485    }
    7586
     87    public event EventHandler FilenameChanged;
     88    protected virtual void OnFilenameChanged() {
     89      EventHandler handler = FilenameChanged;
     90      if (handler != null) handler(this, EventArgs.Empty);
     91    }
    7692    public event EventHandler ItemImageChanged;
    7793    protected virtual void OnItemImageChanged() {
  • trunk/sources/HeuristicLab.Core/3.3/Collections/ReadOnlyItemDictionary.cs

    r3431 r3483  
    3333  [Item("ReadOnlyItemDictionary<TKey, TValue>", "Represents a read-only dictionary of items.")]
    3434  public class ReadOnlyItemDictionary<TKey, TValue> : ReadOnlyObservableDictionary<TKey, TValue>, IItemDictionary<TKey, TValue> where TKey : class, IItem where TValue : class, IItem {
     35    private string filename;
     36    public string Filename {
     37      get { return filename; }
     38      set {
     39        if (!filename.Equals(value)) {
     40          filename = value;
     41          OnFilenameChanged();
     42        }
     43      }
     44    }
     45
    3546    public virtual string ItemName {
    3647      get { return ItemAttribute.GetName(this.GetType()); }
     
    7485    }
    7586
     87    public event EventHandler FilenameChanged;
     88    protected virtual void OnFilenameChanged() {
     89      EventHandler handler = FilenameChanged;
     90      if (handler != null) handler(this, EventArgs.Empty);
     91    }
    7692    public event EventHandler ItemImageChanged;
    7793    protected virtual void OnItemImageChanged() {
  • trunk/sources/HeuristicLab.Core/3.3/Collections/ReadOnlyItemList.cs

    r3431 r3483  
    3333  [Item("ReadOnlyItemList<T>", "Represents a read-only list of items.")]
    3434  public class ReadOnlyItemList<T> : ReadOnlyObservableList<T>, IItemList<T> where T : class, IItem {
     35    private string filename;
     36    public string Filename {
     37      get { return filename; }
     38      set {
     39        if (!filename.Equals(value)) {
     40          filename = value;
     41          OnFilenameChanged();
     42        }
     43      }
     44    }
     45
    3546    public virtual string ItemName {
    3647      get { return ItemAttribute.GetName(this.GetType()); }
     
    7485    }
    7586
     87    public event EventHandler FilenameChanged;
     88    protected virtual void OnFilenameChanged() {
     89      EventHandler handler = FilenameChanged;
     90      if (handler != null) handler(this, EventArgs.Empty);
     91    }
    7692    public event EventHandler ItemImageChanged;
    7793    protected virtual void OnItemImageChanged() {
  • trunk/sources/HeuristicLab.Core/3.3/Collections/ReadOnlyItemSet.cs

    r3431 r3483  
    3333  [Item("ReadOnlyItemSet<T>", "Represents a read-only set of items.")]
    3434  public class ReadOnlyItemSet<T> : ReadOnlyObservableSet<T>, IItemSet<T> where T : class, IItem {
     35    private string filename;
     36    public string Filename {
     37      get { return filename; }
     38      set {
     39        if (!filename.Equals(value)) {
     40          filename = value;
     41          OnFilenameChanged();
     42        }
     43      }
     44    }
     45
    3546    public virtual string ItemName {
    3647      get { return ItemAttribute.GetName(this.GetType()); }
     
    7485    }
    7586
     87    public event EventHandler FilenameChanged;
     88    protected virtual void OnFilenameChanged() {
     89      EventHandler handler = FilenameChanged;
     90      if (handler != null) handler(this, EventArgs.Empty);
     91    }
    7692    public event EventHandler ItemImageChanged;
    7793    protected virtual void OnItemImageChanged() {
  • trunk/sources/HeuristicLab.Core/3.3/Collections/ReadOnlyKeyedItemCollection.cs

    r3431 r3483  
    3333  [Item("ReadOnlyKeyedItemCollection<TKey, TItem>", "Represents a read-only keyed collection of items.")]
    3434  public class ReadOnlyKeyedItemCollection<TKey, TItem> : ReadOnlyObservableKeyedCollection<TKey, TItem>, IKeyedItemCollection<TKey, TItem> where TItem : class, IItem {
     35    private string filename;
     36    public string Filename {
     37      get { return filename; }
     38      set {
     39        if (!filename.Equals(value)) {
     40          filename = value;
     41          OnFilenameChanged();
     42        }
     43      }
     44    }
     45
    3546    public virtual string ItemName {
    3647      get { return ItemAttribute.GetName(this.GetType()); }
     
    7485    }
    7586
     87    public event EventHandler FilenameChanged;
     88    protected virtual void OnFilenameChanged() {
     89      EventHandler handler = FilenameChanged;
     90      if (handler != null) handler(this, EventArgs.Empty);
     91    }
    7692    public event EventHandler ItemImageChanged;
    7793    protected virtual void OnItemImageChanged() {
Note: See TracChangeset for help on using the changeset viewer.