mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-11-20 04:18:51 -07:00
07cc4be6a7
* Add analyzers to MediaBrowser.XbmcMetadata * Enable TreatWarningsAsErrors for MediaBrowser.XbmcMetadata * Add analyzers to MediaBrowser.WebDashboard * Enable TreatWarningsAsErrors for MediaBrowser.WebDashboard * Disable SA1600 in favor of CS1591
46 lines
1.0 KiB
C#
46 lines
1.0 KiB
C#
#pragma warning disable CS1591
|
|
|
|
using System;
|
|
|
|
namespace MediaBrowser.Common.Progress
|
|
{
|
|
/// <summary>
|
|
/// Class ActionableProgress
|
|
/// </summary>
|
|
/// <typeparam name="T"></typeparam>
|
|
public class ActionableProgress<T> : IProgress<T>
|
|
{
|
|
/// <summary>
|
|
/// The _actions
|
|
/// </summary>
|
|
private Action<T> _action;
|
|
public event EventHandler<T> ProgressChanged;
|
|
|
|
/// <summary>
|
|
/// Registers the action.
|
|
/// </summary>
|
|
/// <param name="action">The action.</param>
|
|
public void RegisterAction(Action<T> action)
|
|
{
|
|
_action = action;
|
|
}
|
|
|
|
public void Report(T value)
|
|
{
|
|
ProgressChanged?.Invoke(this, value);
|
|
|
|
_action?.Invoke(value);
|
|
}
|
|
}
|
|
|
|
public class SimpleProgress<T> : IProgress<T>
|
|
{
|
|
public event EventHandler<T> ProgressChanged;
|
|
|
|
public void Report(T value)
|
|
{
|
|
ProgressChanged?.Invoke(this, value);
|
|
}
|
|
}
|
|
}
|