diff options
| author | stefan <stefan@hegedues.at> | 2018-09-12 19:26:21 +0200 |
|---|---|---|
| committer | stefan <stefan@hegedues.at> | 2018-09-12 19:26:21 +0200 |
| commit | 48facb797ed912e4ea6b04b17d1ff190ac2daac4 (patch) | |
| tree | 8dae77a31670a888d733484cb17dd4077d5444e8 /MediaBrowser.Common/Progress/ActionableProgress.cs | |
| parent | c32d8656382a0eacb301692e0084377fc433ae9b (diff) | |
Update to 3.5.2 and .net core 2.1
Diffstat (limited to 'MediaBrowser.Common/Progress/ActionableProgress.cs')
| -rw-r--r-- | MediaBrowser.Common/Progress/ActionableProgress.cs | 74 |
1 files changed, 0 insertions, 74 deletions
diff --git a/MediaBrowser.Common/Progress/ActionableProgress.cs b/MediaBrowser.Common/Progress/ActionableProgress.cs deleted file mode 100644 index 5b318c6a7..000000000 --- a/MediaBrowser.Common/Progress/ActionableProgress.cs +++ /dev/null @@ -1,74 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace MediaBrowser.Common.Progress -{ - /// <summary> - /// Class ActionableProgress - /// </summary> - /// <typeparam name="T"></typeparam> - public class ActionableProgress<T> : IProgress<T>, IDisposable - { - /// <summary> - /// The _actions - /// </summary> - private readonly List<Action<T>> _actions = new List<Action<T>>(); - public event EventHandler<T> ProgressChanged; - - /// <summary> - /// Registers the action. - /// </summary> - /// <param name="action">The action.</param> - public void RegisterAction(Action<T> action) - { - _actions.Add(action); - } - - /// <summary> - /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. - /// </summary> - public void Dispose() - { - Dispose(true); - GC.SuppressFinalize(this); - } - - /// <summary> - /// Releases unmanaged and - optionally - managed resources. - /// </summary> - /// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param> - protected virtual void Dispose(bool disposing) - { - if (disposing) - { - _actions.Clear(); - } - } - - public void Report(T value) - { - if (ProgressChanged != null) - { - ProgressChanged(this, value); - } - - foreach (var action in _actions) - { - action(value); - } - } - } - - public class SimpleProgress<T> : IProgress<T> - { - public event EventHandler<T> ProgressChanged; - - public void Report(T value) - { - if (ProgressChanged != null) - { - ProgressChanged(this, value); - } - } - } -} |
