示例#1
0
 /// <summary>
 /// Handles a change to a Blotter record in the data model.
 /// </summary>
 /// <param name="sender">The object that originated the event.</param>
 /// <param name="blotterRowChangeEventArgs">The event arguments.</param>
 private void OnBlotterRowDeleted(Object sender, DataModel.BlotterRowChangeEventArgs blotterRowChangeEventArgs)
 {
     // This will delete the item from the list when it is deleted from the data model.
     if (blotterRowChangeEventArgs.Action == DataRowAction.Delete)
     {
         Int32 index = this.BinarySearch(blotterItem => blotterItem.BlotterId, blotterRowChangeEventArgs.Row.BlotterId);
         if (index >= 0)
         {
             this.RemoveAt(index);
         }
     }
 }
示例#2
0
 /// <summary>
 /// Handles a change to a Blotter record in the data model.
 /// </summary>
 /// <param name="sender">The object that originated the event.</param>
 /// <param name="blotterRowChangeEventArgs">The event arguments.</param>
 private void OnBlotterRowChanged(Object sender, DataModel.BlotterRowChangeEventArgs blotterRowChangeEventArgs)
 {
     // We're only interested in additions and changes in this handler.
     if (blotterRowChangeEventArgs.Action == DataRowAction.Add || blotterRowChangeEventArgs.Action == DataRowAction.Change)
     {
         // If the item doesn't exist, it is added.  If it exists, it's updated.
         Int32 index = this.BinarySearch(blotterItem => blotterItem.BlotterId, blotterRowChangeEventArgs.Row.BlotterId);
         if (index < 0)
         {
             this.Insert(~index, new BlotterItem(blotterRowChangeEventArgs.Row));
         }
         else
         {
             this[index].Copy(blotterRowChangeEventArgs.Row);
         }
     }
 }