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