/// <summary> /// Removes a filter from this collection. /// </summary> /// <param name="name">The name of the filter to remove.</param> /// <returns>True if the filter with the given <paramref name="name"/> was successfully removed; otherwise false.</returns> public bool RemoveFilter(string name) { // Check for a valid name if (string.IsNullOrEmpty(name)) { return(false); } // Grab the filter object (so we can pass it to the event if successful) var filter = TryGetFilter(name); if (filter == null) { return(false); } // Try to remove var removed = _filters.Remove(name); if (removed) { // Raise the event if (Removed != null) { Removed.Raise(this, new MapDrawFilterHelperCollectionEventArgs(name, filter)); } } return(removed); }
/// <summary> /// Removes a <see cref="IToolTargetContainer"/> from this collection. /// </summary> /// <param name="c">The <see cref="IToolTargetContainer"/> to add.</param> /// <returns>True if <paramref name="c"/> was removed; false if <paramref name="c"/> was null or not in the collection.</returns> public bool Remove(IToolTargetContainer c) { // Check for a valid value if (c == null) { const string errmsg = "Tried to remove null IToolTargetContainer from ToolTargetContainerCollection `{0}`."; if (log.IsWarnEnabled) { log.WarnFormat(errmsg, this); } Debug.Fail(string.Format(errmsg, this)); return(false); } // Remove from the collection var ret = _buffer.Remove(c); // Check if removed successfully if (ret) { // Raise the event if (Removed != null) { Removed.Raise(this, EventArgsHelper.Create(c)); } } return(ret); }
/// <summary> /// Handles when a GrhData is removed from the DArray /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="NetGore.Collections.DArrayEventArgs{T}"/> instance containing the event data.</param> static void RemoveHandler(object sender, DArrayEventArgs <GrhData> e) { Debug.Assert(e.Index != GrhIndex.Invalid); RemoveFromDictionary(e.Item); if (Removed != null) { Removed.Raise(e.Item, EventArgs.Empty); } }
/// <summary> /// Occurs when the <see cref="CharacterStatusEffects.Removed"/> event is raised. /// </summary> /// <param name="statusEffect">The <see cref="ActiveStatusEffect"/> that was removed.</param> protected virtual void OnRemoved(ActiveStatusEffect statusEffect) { statusEffect.SubtractBonusesFrom(_modStats); if (Removed != null) { Removed.Raise(this, EventArgsHelper.Create(statusEffect)); } AssertModStatsAreCorrect(); }
public void RemoveActivity(Activity activity) { if (!_activities.Contains(activity)) { return; } _activities.Remove(activity); Removed.Raise(this, activity); NotifyPropertyChanged(() => Activities); }
public void ProcessDelta() { if (_added.Count != 0) { CollectionChangedEventArgs <Serial> list = new CollectionChangedEventArgs <Serial>(_added); _added.Clear(); Added.Raise(list); } if (_removed.Count != 0) { CollectionChangedEventArgs <Serial> list = new CollectionChangedEventArgs <Serial>(_removed); _removed.Clear(); Removed.Raise(list); } }
public void RemoveDay(Day day) { _days.Remove(day); Removed.Raise(this, day); }
private void OnActivityMoved(object sender, RoutedEventArgs e) { Removed.Raise(this, ((ActivityControl)e.OriginalSource).Activity); }