private void RemoveWithDelay( IEnumerable <Notification> items, Action <Notification> onBeforeDelay, RemovedBy removedBy, int millisecondDelay) { foreach (var item in items) { onBeforeDelay(item); } TaskUtilities .Delay(millisecondDelay) .ContinueWith(() => { foreach (var item in items) { var removed = collection.Remove(item); if (removed) { OnRemoved(item, removedBy); } } }, taskScheduler); }
private void RemoveWithDelay( Notification notification, Action <Notification> onBeforeDelay, RemovedBy removedBy, int millisecondDelay) { RemoveWithDelay(new[] { notification }, onBeforeDelay, removedBy, millisecondDelay); }
public void Remove(Notification notification, RemovedBy removedBy) { var removed = collection.Remove(notification); if (removed) { OnRemoved(notification, removedBy); } }
private void OnRemoved(Notification notification, RemovedBy removedBy) { var onRemoved = Removed; if (onRemoved != null) { onRemoved(this, new NotificationRemovedArgs { Notification = notification, RemovedBy = removedBy }); } }
/// <summary> /// Link other information against this enumerant. /// </summary> /// <param name="ctx"> /// A <see cref="RegistryContext"/> holding the registry information to link. /// </param> internal void Link(RegistryContext ctx) { if (ctx == null) { throw new ArgumentNullException(nameof(ctx)); } RequiredBy.Clear(); RequiredBy.AddRange(GetFeaturesRequiringEnum(ctx)); RemovedBy.Clear(); RemovedBy.AddRange(GetFeaturesRemovingEnum(ctx)); }
/// <summary> /// Link other information against this enumerant. /// </summary> /// <param name="ctx"> /// A <see cref="RegistryContext"/> holding the registry information to link. /// </param> internal void Link(RegistryContext ctx) { if (ctx == null) { throw new ArgumentNullException("ctx"); } RequiredBy.Clear(); RequiredBy.AddRange(GetFeaturesRequiringCommand(ctx)); RemovedBy.Clear(); RemovedBy.AddRange(GetFeaturesRemovingCommand(ctx)); foreach (CommandParameter commandParameter in Parameters) { commandParameter.ParentCommand = this; } }
public void RemoveWithDelay(IEnumerable <Notification> items, RemovedBy removedBy) { RemoveWithDelay(items, item => item.IsRemoving = true, removedBy, 200); }
public void RemoveWithDelay(Notification notification, RemovedBy removedBy) { RemoveWithDelay(notification, item => item.IsRemoving = true, removedBy, 200); }