Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ OnListChanged()

virtual void System.Data.DataView.OnListChanged ( ListChangedEventArgs e)
inlineprotectedvirtualinherited

Definition at line 1209 of file DataView.cs.

1210 {
1211 DataCommonEventSource.Log.Trace("<ds.DataView.OnListChanged|INFO> {0}, ListChangedType={1}", ObjectID, e.ListChangedType);
1212 try
1213 {
1214 DataColumn dataColumn = null;
1215 string text = null;
1216 switch (e.ListChangedType)
1217 {
1218 case ListChangedType.ItemMoved:
1219 case ListChangedType.ItemChanged:
1220 if (0 <= e.NewIndex)
1221 {
1222 DataRow row = GetRow(e.NewIndex);
1223 if (row.HasPropertyChanged)
1224 {
1225 dataColumn = row.LastChangedColumn;
1226 text = ((dataColumn != null) ? dataColumn.ColumnName : string.Empty);
1227 }
1228 }
1229 break;
1230 }
1231 if (_onListChanged != null)
1232 {
1233 if (dataColumn != null && e.NewIndex == e.OldIndex)
1234 {
1235 ListChangedEventArgs e2 = new ListChangedEventArgs(e.ListChangedType, e.NewIndex, new DataColumnPropertyDescriptor(dataColumn));
1236 _onListChanged(this, e2);
1237 }
1238 else
1239 {
1240 _onListChanged(this, e);
1241 }
1242 }
1243 if (text != null)
1244 {
1245 this[e.NewIndex].RaisePropertyChangedEvent(text);
1246 }
1247 }
1248 catch (Exception e3) when (ADP.IsCatchableExceptionType(e3))
1249 {
1250 ExceptionBuilder.TraceExceptionWithoutRethrow(e3);
1251 }
1252 }
static bool IsCatchableExceptionType(Exception e)
Definition ADP.cs:790
DataRow GetRow(int index)
Definition DataView.cs:1113
ListChangedEventHandler _onListChanged
Definition DataView.cs:86

References System.Data.DataView._onListChanged, System.Data.DataView.GetRow(), System.Data.Common.ADP.IsCatchableExceptionType(), System.ComponentModel.ListChangedEventArgs.ListChangedType, System.Data.DataCommonEventSource.Log, System.ComponentModel.ListChangedEventArgs.NewIndex, System.Data.DataView.ObjectID, System.ComponentModel.ListChangedEventArgs.OldIndex, System.text, and System.Data.ExceptionBuilder.TraceExceptionWithoutRethrow().

Referenced by System.Data.DataView.AddNew(), System.Data.DataView.ChildRelationCollectionChanged(), System.Data.DataView.ColumnCollectionChanged(), System.Data.DataView.FinishAddNew(), System.Data.DataView.IndexListChanged(), System.Data.DataView.ParentRelationCollectionChanged(), and System.Data.DataView.UpdateIndex().