From 0cf6664ee129f739d5218df4140c32d02dab3d92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Holger=20B=C3=B6rchers?= Date: Fri, 8 May 2020 20:24:18 +0200 Subject: [PATCH] Updated nuget packages --- App/ModernWpfPlayground.csproj | 8 +-- App/MvvmStuff/TaskExtensions.cs | 85 ---------------------------- App/MvvmStuff/TaskExtensions{T}.cs | 91 ------------------------------ 3 files changed, 4 insertions(+), 180 deletions(-) delete mode 100644 App/MvvmStuff/TaskExtensions.cs delete mode 100644 App/MvvmStuff/TaskExtensions{T}.cs diff --git a/App/ModernWpfPlayground.csproj b/App/ModernWpfPlayground.csproj index feed22f..6a1a116 100644 --- a/App/ModernWpfPlayground.csproj +++ b/App/ModernWpfPlayground.csproj @@ -9,10 +9,10 @@ - - - - + + + + diff --git a/App/MvvmStuff/TaskExtensions.cs b/App/MvvmStuff/TaskExtensions.cs deleted file mode 100644 index e315c7d..0000000 --- a/App/MvvmStuff/TaskExtensions.cs +++ /dev/null @@ -1,85 +0,0 @@ -// ReSharper disable CheckNamespace -namespace System.Threading.Tasks -{ - /// - /// Extension methods for the Task object. - /// - public static class TaskExtensions - { - /// - /// Awaits a task without blocking the main thread. - /// - /// Primarily used to replace async void scenarios such as ctor's and ICommands. - /// The task to be awaited - public static void Await(this Task task) - { - task.Await(null, null, false); - } - - /// - /// Awaits a task without blocking the main thread. - /// - /// Primarily used to replace async void scenarios such as ctor's and ICommands. - /// The task to be awaited - /// Configures an awaiter used to await this task - public static void Await(this Task task, bool configureAwait) - { - task.Await(null, null, configureAwait); - } - - /// - /// Awaits a task without blocking the main thread. - /// - /// Primarily used to replace async void scenarios such as ctor's and ICommands. - /// The task to be awaited - /// The action to perform when the task is complete. - public static void Await(this Task task, Action completedCallback) - { - task.Await(completedCallback, null, false); - } - - /// - /// Awaits a task without blocking the main thread. - /// - /// Primarily used to replace async void scenarios such as ctor's and ICommands. - /// The task to be awaited - /// The action to perform when the task is complete. - /// The action to perform when an error occurs executing the task. - public static void Await(this Task task, Action completedCallback, Action errorCallback) - { - task.Await(completedCallback, errorCallback, false); - } - - /// - /// Awaits a task without blocking the main thread. - /// - /// Primarily used to replace async void scenarios such as ctor's and ICommands. - /// The task to be awaited - /// The action to perform when an error occurs executing the task. - public static void Await(this Task task, Action errorCallback) - { - task.Await(null, errorCallback, false); - } - - /// - /// Awaits a task without blocking the main thread. - /// - /// Primarily used to replace async void scenarios such as ctor's and ICommands. - /// The task to be awaited - /// The action to perform when the task is complete. - /// The action to perform when an error occurs executing the task. - /// Configures an awaiter used to await this task - public async static void Await(this Task task, Action? completedCallback, Action? errorCallback, bool configureAwait) - { - try - { - await task.ConfigureAwait(configureAwait); - completedCallback?.Invoke(); - } - catch (Exception ex) - { - errorCallback?.Invoke(ex); - } - } - } -} diff --git a/App/MvvmStuff/TaskExtensions{T}.cs b/App/MvvmStuff/TaskExtensions{T}.cs deleted file mode 100644 index 5d3364f..0000000 --- a/App/MvvmStuff/TaskExtensions{T}.cs +++ /dev/null @@ -1,91 +0,0 @@ -// ReSharper disable CheckNamespace -namespace System.Threading.Tasks -{ - /// - /// Extension methods for the Task object. - /// - public static class TaskExtensionsT - { - /// - /// Awaits a task without blocking the main thread. - /// - /// Primarily used to replace async void scenarios such as ctor's and ICommands. - /// The result type - /// The task to be awaited - public static void Await(this Task task) - { - task.Await(null, null, false); - } - - /// - /// Awaits a task without blocking the main thread. - /// - /// Primarily used to replace async void scenarios such as ctor's and ICommands. - /// The result type - /// The task to be awaited - /// Configures an awaiter used to await this task - public static void Await(this Task task, bool configureAwait) - { - task.Await(null, null, configureAwait); - } - - /// - /// Awaits a task without blocking the main thread. - /// - /// Primarily used to replace async void scenarios such as ctor's and ICommands. - /// The result type - /// The task to be awaited - /// The action to perform when the task is complete. - public static void Await(this Task task, Action completedCallback) - { - task.Await(completedCallback, null, false); - } - - /// - /// Awaits a task without blocking the main thread. - /// - /// Primarily used to replace async void scenarios such as ctor's and ICommands. - /// The result type - /// The task to be awaited - /// The action to perform when the task is complete. - /// The action to perform when an error occurs executing the task. - public static void Await(this Task task, Action completedCallback, Action errorCallback) - { - task.Await(completedCallback, errorCallback, false); - } - - /// - /// Awaits a task without blocking the main thread. - /// - /// Primarily used to replace async void scenarios such as ctor's and ICommands. - /// The result type - /// The task to be awaited - /// The action to perform when an error occurs executing the task. - public static void Await(this Task task, Action errorCallback) - { - task.Await(null, errorCallback, false); - } - - /// - /// Awaits a task without blocking the main thread. - /// - /// Primarily used to replace async void scenarios such as ctor's and ICommands. - /// The result type - /// The task to be awaited - /// The action to perform when the task is complete. - /// The action to perform when an error occurs executing the task. - /// Configures an awaiter used to await this task - public async static void Await(this Task task, Action? completedCallback, Action? errorCallback, bool configureAwait) - { - try - { - var result = await task.ConfigureAwait(configureAwait); - completedCallback?.Invoke(result); - } - catch (Exception ex) - { - errorCallback?.Invoke(ex); - } - } - } -}