/// <summary> /// The observable concurrent queue on changed. /// </summary> /// <param name="sender"> /// The sender. /// </param> /// <param name="args"> /// The args. /// </param> private static void OnObservableConcurrentQueueContentChanged( object sender, NotifyConcurrentQueueChangedEventArgs<int> args) { if (args.Action == NotifyConcurrentQueueChangedAction.Enqueue) { Console.BackgroundColor = ConsoleColor.DarkGreen; Console.WriteLine("New Item added: {0}", args.ChangedItem); } if (args.Action == NotifyConcurrentQueueChangedAction.Dequeue) { Console.BackgroundColor = ConsoleColor.Red; Console.WriteLine("New Item deleted: {0}", args.ChangedItem); } if (args.Action == NotifyConcurrentQueueChangedAction.Peek) { Console.BackgroundColor = ConsoleColor.DarkBlue; Console.WriteLine("Item peeked: {0}", args.ChangedItem); } if (args.Action == NotifyConcurrentQueueChangedAction.Empty) { Console.BackgroundColor = ConsoleColor.White; Console.ForegroundColor = ConsoleColor.Blue; Console.WriteLine("Queue is empty"); } Console.ResetColor(); }
/// <summary> /// The on queue changed. /// </summary> /// <param name="sender"> /// The sender. /// </param> /// <param name="args"> /// The args. /// </param> private void OnQueueChanged(object sender, NotifyConcurrentQueueChangedEventArgs <int> args) { switch (args.Action) { case NotifyConcurrentQueueChangedAction.Enqueue: { this._queueAddedItem = args.ChangedItem; this._isQueueEmpty = false; break; } case NotifyConcurrentQueueChangedAction.Dequeue: { this._queueDeletedItem = args.ChangedItem; this._isQueueEmpty = false; break; } case NotifyConcurrentQueueChangedAction.Peek: { this._queuePeekedItem = args.ChangedItem; this._isQueueEmpty = false; break; } case NotifyConcurrentQueueChangedAction.Empty: { this._isQueueEmpty = true; break; } default: throw new ArgumentOutOfRangeException(); } }
/// <summary> /// The observable concurrent queue on changed. /// </summary> /// <param name="sender"> /// The sender. /// </param> /// <param name="args"> /// The args. /// </param> private static void OnObservableConcurrentQueueContentChanged( object sender, NotifyConcurrentQueueChangedEventArgs <int> args) { if (args.Action == NotifyConcurrentQueueChangedAction.Enqueue) { Console.BackgroundColor = ConsoleColor.DarkGreen; Console.WriteLine("New Item added: {0}", args.ChangedItem); } if (args.Action == NotifyConcurrentQueueChangedAction.Dequeue) { Console.BackgroundColor = ConsoleColor.Red; Console.WriteLine("New Item deleted: {0}", args.ChangedItem); } if (args.Action == NotifyConcurrentQueueChangedAction.Peek) { Console.BackgroundColor = ConsoleColor.DarkBlue; Console.WriteLine("Item peeked: {0}", args.ChangedItem); } if (args.Action == NotifyConcurrentQueueChangedAction.Empty) { Console.BackgroundColor = ConsoleColor.White; Console.ForegroundColor = ConsoleColor.Blue; Console.WriteLine("Queue is empty"); } Console.ResetColor(); }
/// <summary> /// The on queue changed. /// </summary> /// <param name="sender"> /// The sender. /// </param> /// <param name="args"> /// The args. /// </param> private void OnQueueChanged(object sender, NotifyConcurrentQueueChangedEventArgs <int> args) { switch (args.Action) { case NotifyConcurrentQueueChangedAction.Enqueue: { _queueAddedItem = args.ChangedItem; _isQueueEmpty = false; break; } case NotifyConcurrentQueueChangedAction.Dequeue: { _queueDeletedItem = args.ChangedItem; _isQueueEmpty = false; break; } case NotifyConcurrentQueueChangedAction.Peek: { _queuePeekedItem = args.ChangedItem; _isQueueEmpty = false; break; } case NotifyConcurrentQueueChangedAction.Empty: { _isQueueEmpty = true; break; } } }
private void EventHadler(object sender, NotifyConcurrentQueueChangedEventArgs <Uri> args) { if (args.Action == NotifyConcurrentQueueChangedAction.Enqueue) { Task.Run(DownloadNext); } }
/// <summary> /// Raises the <see cref="E:Changed"/> event. /// </summary> /// <param name="args"> /// The <see cref="NotifyConcurrentQueueChangedEventArgs{T}"/> instance containing the event data. /// </param> private void OnContentChanged(NotifyConcurrentQueueChangedEventArgs <T> args) { var handler = this.ContentChanged; if (handler != null) { handler(this, args); } }
/// <summary> /// Raises the <see cref="E:Changed"/> event. /// </summary> /// <param name="args"> /// The <see cref="NotifyConcurrentQueueChangedEventArgs{T}"/> instance containing the event data. /// </param> private void OnContentChanged(NotifyConcurrentQueueChangedEventArgs <T> args) { this.ContentChanged?.Invoke(this, args); }
private void OnObservableConcurrentQueueContentChanged( object sender, NotifyConcurrentQueueChangedEventArgs<string> args) { if (args.Action == NotifyConcurrentQueueChangedAction.Enqueue || args.Action == NotifyConcurrentQueueChangedAction.Dequeue) { this.Dispatcher.BeginInvoke(new Action(delegate() { this.filesToConvertingListBox.ItemsSource = this.filesToConvertingQueue.ToList(); })); } }
/// <summary> /// The on queue changed. /// </summary> /// <param name="sender"> /// The sender. /// </param> /// <param name="args"> /// The args. /// </param> private void OnQueueChanged(object sender, NotifyConcurrentQueueChangedEventArgs<int> args) { switch (args.Action) { case NotifyConcurrentQueueChangedAction.Enqueue: { this.queueAddedItem = args.ChangedItem; this.isQueueEmpty = false; break; } case NotifyConcurrentQueueChangedAction.Dequeue: { this.queueDeletedItem = args.ChangedItem; this.isQueueEmpty = false; break; } case NotifyConcurrentQueueChangedAction.Peek: { this.queuePeekedItem = args.ChangedItem; this.isQueueEmpty = false; break; } case NotifyConcurrentQueueChangedAction.Empty: { this.isQueueEmpty = true; break; } } }