Пример #1
0
 /// <summary>
 /// Handles a change to a TimeInForce record in the data model.
 /// </summary>
 /// <param name="sender">The object that originated the event.</param>
 /// <param name="timeInForceRowChangeEventArgs">The event arguments.</param>
 private void OnTimeInForceRowDeleted(Object sender, DataModel.TimeInForceRowChangeEventArgs timeInForceRowChangeEventArgs)
 {
     // This will delete the item from the list when it is deleted from the data model.
     if (timeInForceRowChangeEventArgs.Action == DataRowAction.Delete)
     {
         Int32 index = this.BinarySearch(timeInForceItem => timeInForceItem.TimeInForceCode, timeInForceRowChangeEventArgs.Row.TimeInForceCode);
         if (index >= 0)
         {
             this.RemoveAt(index);
         }
     }
 }
Пример #2
0
 /// <summary>
 /// Handles a change to a TimeInForce record in the data model.
 /// </summary>
 /// <param name="sender">The object that originated the event.</param>
 /// <param name="timeInForceRowChangeEventArgs">The event arguments.</param>
 private void OnTimeInForceRowChanged(Object sender, DataModel.TimeInForceRowChangeEventArgs timeInForceRowChangeEventArgs)
 {
     // We're only interested in additions and changes in this handler.
     if (timeInForceRowChangeEventArgs.Action == DataRowAction.Add || timeInForceRowChangeEventArgs.Action == DataRowAction.Change)
     {
         // If the item doesn't exist, it is added.  If it exists, it's updated.
         Int32 index = this.BinarySearch(timeInForceItem => timeInForceItem.TimeInForceCode, timeInForceRowChangeEventArgs.Row.TimeInForceCode);
         if (index < 0)
         {
             this.Insert(~index, new TimeInForceItem(timeInForceRowChangeEventArgs.Row));
         }
         else
         {
             this[index].Copy(timeInForceRowChangeEventArgs.Row);
         }
     }
 }