Terraria v1.4.4.9
Terraria source code documentation
All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Events Macros
ObservableCollection.cs
Go to the documentation of this file.
7
9
12[DebuggerDisplay("Count = {Count}")]
13[TypeForwardedFrom("WindowsBase, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")]
15{
16 [Serializable]
17 [TypeForwardedFrom("WindowsBase, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")]
18 private sealed class SimpleMonitor : IDisposable
19 {
20 internal int _busyCount;
21
24
29
30 public void Dispose()
31 {
32 _collection._blockReentrancyCount--;
33 }
34 }
35
37
40
41 event PropertyChangedEventHandler? INotifyPropertyChanged.PropertyChanged
42 {
43 add
44 {
46 }
47 remove
48 {
50 }
51 }
52
54
55 protected virtual event PropertyChangedEventHandler? PropertyChanged;
56
58 {
59 }
60
62 : base((IList<T>)CreateCopy(collection, "collection"))
63 {
64 }
65
67 : base((IList<T>)CreateCopy(list, "list"))
68 {
69 }
70
72 {
73 if (collection == null)
74 {
76 }
77 return new List<T>(collection);
78 }
79
80 public void Move(int oldIndex, int newIndex)
81 {
83 }
84
85 protected override void ClearItems()
86 {
88 base.ClearItems();
92 }
93
94 protected override void RemoveItem(int index)
95 {
97 T val = base[index];
98 base.RemoveItem(index);
102 }
103
104 protected override void InsertItem(int index, T item)
105 {
107 base.InsertItem(index, item);
111 }
112
113 protected override void SetItem(int index, T item)
114 {
116 T val = base[index];
117 base.SetItem(index, item);
120 }
121
122 protected virtual void MoveItem(int oldIndex, int newIndex)
123 {
125 T val = base[oldIndex];
126 base.RemoveItem(oldIndex);
127 base.InsertItem(newIndex, val);
130 }
131
133 {
134 this.PropertyChanged?.Invoke(this, e);
135 }
136
138 {
140 if (collectionChanged != null)
141 {
143 try
144 {
145 collectionChanged(this, e);
146 }
147 finally
148 {
150 }
151 }
152 }
153
155 {
158 }
159
160 protected void CheckReentrancy()
161 {
162 if (_blockReentrancyCount > 0)
163 {
165 if (collectionChanged != null && collectionChanged.GetInvocationList().Length > 1)
166 {
168 }
169 }
170 }
171
176
181
186
191
196
201
203 {
204 return _monitor ?? (_monitor = new SimpleMonitor(this));
205 }
206
213
215 private void OnDeserialized(StreamingContext context)
216 {
217 if (_monitor != null)
218 {
221 }
222 }
223}
static readonly NotifyCollectionChangedEventArgs ResetCollectionChanged
static readonly PropertyChangedEventArgs IndexerPropertyChanged
static readonly PropertyChangedEventArgs CountPropertyChanged
PropertyChangedEventHandler? INotifyPropertyChanged. PropertyChanged
virtual ? PropertyChangedEventHandler PropertyChanged
static List< T > CreateCopy(IEnumerable< T > collection, string paramName)
virtual ? NotifyCollectionChangedEventHandler CollectionChanged
void OnCollectionChanged(NotifyCollectionChangedAction action, object item, int index, int oldIndex)
void OnCollectionChanged(NotifyCollectionChangedAction action, object item, int index)
virtual void OnPropertyChanged(PropertyChangedEventArgs e)
void OnCollectionChanged(NotifyCollectionChangedAction action, object oldItem, object newItem, int index)
virtual void MoveItem(int oldIndex, int newIndex)
virtual void OnCollectionChanged(NotifyCollectionChangedEventArgs e)
static string ObservableCollectionReentrancyNotAllowed
Definition SR.cs:30
Definition SR.cs:7
delegate void NotifyCollectionChangedEventHandler(object? sender, NotifyCollectionChangedEventArgs e)