Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
TrackingCollectionChangedEventArgs.cs
Go to the documentation of this file.
1 // Copyright (c) 2014 Silicon Studio Corp. (http://siliconstudio.co.jp)
2 // This file is distributed under GPL v3. See LICENSE.md for details.
3 using System;
4 using System.Collections.Specialized;
5 
6 namespace SiliconStudio.Core.Collections
7 {
9  {
10  public TrackingCollectionChangedEventArgs(NotifyCollectionChangedAction action, object item, object oldItem, int index = -1, bool collectionChanged = false)
11  {
12  Action = action;
13  Item = item;
14  OldItem = oldItem;
15  Index = index;
16  CollectionChanged = collectionChanged;
17  }
18 
19  public TrackingCollectionChangedEventArgs(NotifyCollectionChangedAction action, object key, object item, object oldItem, bool collectionChanged = false)
20  {
21  Action = action;
22  Item = item;
23  OldItem = oldItem;
24  Key = key;
25  Index = -1;
26  CollectionChanged = collectionChanged;
27  }
28 
29  /// <summary>
30  /// Gets the type of action performed.
31  /// Allowed values are <see cref="NotifyCollectionChangedAction.Add"/> and <see cref="NotifyCollectionChangedAction.Remove"/>.
32  /// </summary>
33  public NotifyCollectionChangedAction Action { get; private set; }
34 
35  /// <summary>
36  /// Gets the added or removed item (if dictionary, value only).
37  /// </summary>
38  public object Item { get; private set; }
39 
40  /// <summary>
41  /// Gets the previous value. Only valid if <see cref="Action"/> is <see cref="NotifyCollectionChangedAction.Add"/> and <see cref=""/>
42  /// </summary>
43  public object OldItem { get; private set; }
44 
45  /// <summary>Gets the added or removed key (if dictionary).</summary>
46  public object Key { get; private set; }
47 
48  /// <summary>
49  /// Gets the index in the collection (if applicable).
50  /// </summary>
51  public int Index { get; private set; }
52 
53  /// <summary>
54  /// Gets a value indicating whether [collection changed (not a replacement but real insertion/removal)].
55  /// </summary>
56  /// <value>
57  /// <c>true</c> if [collection changed]; otherwise, <c>false</c>.
58  /// </value>
59  public bool CollectionChanged { get; private set; }
60  }
61 }
TrackingCollectionChangedEventArgs(NotifyCollectionChangedAction action, object item, object oldItem, int index=-1, bool collectionChanged=false)
TrackingCollectionChangedEventArgs(NotifyCollectionChangedAction action, object key, object item, object oldItem, bool collectionChanged=false)