/// <summary>
 /// Bind a Trigger to the same interface the argument trigger is bound to.  
 /// </summary>
 /// <param name="trigger">A bound Trigger. </param>
 internal void Bind(Trigger trigger)
 {
     Bind(trigger.iTaskTrigger);
 }
 /// <summary>
 /// Add the supplied Trigger to the collection.  The Trigger to be added must be unbound,
 /// i.e. it must not be a current member of a TriggerList--this or any other.
 /// </summary>
 /// <param name="trigger">Trigger to add.</param>
 /// <returns>Index of added trigger.</returns>
 /// <exception cref="ArgumentException">Trigger being added is already bound.</exception>
 public int Add(Trigger trigger)
 {
     // if trigger is already bound a list throw an exception
     if (trigger.Bound)
         throw new ArgumentException("A Trigger cannot be added if it is already in a list.");
     // Add a trigger to the task for this TaskList
     ITaskTrigger iTrigger;
     ushort index;
     iTask.CreateTrigger(out index, out iTrigger);
     // Add the Trigger to the TaskList
     trigger.Bind(iTrigger);
     int index2 = oTriggers.Add(trigger);
     // Verify index is the same in task and in list
     if (index2 != (int)index)
         throw new ApplicationException("Assertion Failure");
     return (int)index;
 }
 /// <summary>
 /// Test to see if trigger is part of the collection.
 /// </summary>
 /// <param name="trigger">Trigger to find.</param>
 /// <returns>true if trigger found in collection.</returns>
 public bool Contains(Trigger trigger)
 {
     return (IndexOf(trigger) != -1);
 }
 /// <summary>
 /// Returns the index of the supplied Trigger.
 /// </summary>
 /// <param name="trigger">Trigger to find.</param>
 /// <returns>Zero based index in collection, -1 if not a member.</returns>
 public int IndexOf(Trigger trigger)
 {
     for (int i = 0; i < Count; i++)
     {
         if (this[i].Equals(trigger))
             return i;
     }
     return -1;
 }
 /// <summary>
 /// Removes the trigger from the collection.  If the trigger is not in
 /// the collection, nothing happens.  (No exception.)
 /// </summary>
 /// <param name="trigger">Trigger to remove.</param>
 public void Remove(Trigger trigger)
 {
     int i = IndexOf(trigger);
     if (i != -1)
         RemoveAt(i);
 }