aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Common/Progress/ActionableProgress.cs
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Common/Progress/ActionableProgress.cs')
-rw-r--r--MediaBrowser.Common/Progress/ActionableProgress.cs38
1 files changed, 11 insertions, 27 deletions
diff --git a/MediaBrowser.Common/Progress/ActionableProgress.cs b/MediaBrowser.Common/Progress/ActionableProgress.cs
index 9fe01931f..0ba46ea3b 100644
--- a/MediaBrowser.Common/Progress/ActionableProgress.cs
+++ b/MediaBrowser.Common/Progress/ActionableProgress.cs
@@ -1,18 +1,22 @@
+#pragma warning disable CS1591
+#pragma warning disable CA1003
+
using System;
namespace MediaBrowser.Common.Progress
{
/// <summary>
- /// Class ActionableProgress
+ /// Class ActionableProgress.
/// </summary>
- /// <typeparam name="T"></typeparam>
+ /// <typeparam name="T">The type for the action parameter.</typeparam>
public class ActionableProgress<T> : IProgress<T>
{
/// <summary>
- /// The _actions
+ /// The _actions.
/// </summary>
- private Action<T> _action;
- public event EventHandler<T> ProgressChanged;
+ private Action<T>? _action;
+
+ public event EventHandler<T>? ProgressChanged;
/// <summary>
/// Registers the action.
@@ -25,29 +29,9 @@ namespace MediaBrowser.Common.Progress
public void Report(T value)
{
- if (ProgressChanged != null)
- {
- ProgressChanged(this, value);
- }
-
- var action = _action;
- if (action != null)
- {
- action(value);
- }
- }
- }
+ ProgressChanged?.Invoke(this, value);
- public class SimpleProgress<T> : IProgress<T>
- {
- public event EventHandler<T> ProgressChanged;
-
- public void Report(T value)
- {
- if (ProgressChanged != null)
- {
- ProgressChanged(this, value);
- }
+ _action?.Invoke(value);
}
}
}