You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
jellyfin/MediaBrowser.Common/Progress/ActionableProgress.cs

37 lines
843 B

#pragma warning disable CS1591
using System;
6 years ago
namespace MediaBrowser.Common.Progress
{
/// <summary>
/// Class ActionableProgress.
6 years ago
/// </summary>
/// <typeparam name="T">The type for the action parameter.</typeparam>
6 years ago
public class ActionableProgress<T> : IProgress<T>
{
/// <summary>
/// The _actions.
6 years ago
/// </summary>
private Action<T> _action;
6 years ago
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);
6 years ago
_action?.Invoke(value);
6 years ago
}
}
}