Remove unnecessary extensions

This commit is contained in:
Michael Bucari-Tovo 2022-07-28 11:17:29 -06:00
parent 7525d318c0
commit 433974323c
3 changed files with 3 additions and 9 deletions

View File

@ -12,12 +12,6 @@ namespace Avalonia.Threading
public static void Invoke(this Dispatcher dispatcher, Action action, DispatcherPriority dispatcherPriority = DispatcherPriority.Normal)
=> WaitOnDispatcher(dispatcher.InvokeAsync(action, dispatcherPriority), dispatcher);
public static TResult WaitOnUIAndGetResult<TResult>(this Task<TResult> task)
=> WaitOnDispatcherAndGetResult(task, Dispatcher.UIThread);
public static void WaitOnUI(this Task task)
=> WaitOnDispatcher(task, Dispatcher.UIThread);
public static TResult WaitOnDispatcherAndGetResult<TResult>(this Task<TResult> task, Dispatcher dispatcher)
{
using var source = new CancellationTokenSource();

View File

@ -19,7 +19,7 @@ namespace LibationAvalonia
public static T ShowDialogSynchronously<T>(this Avalonia.Controls.Window window, Avalonia.Controls.Window owner)
{
return window.ShowDialog<T>(owner).WaitOnUIAndGetResult();
return window.ShowDialog<T>(owner).WaitOnDispatcherAndGetResult(Dispatcher.UIThread);
}
}
}

View File

@ -151,9 +151,9 @@ Libation.
private static DialogResult ShowCoreAsync(Window owner, string message, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton, bool saveAndRestorePosition = true)
{
var dialogTask = Dispatcher.UIThread.Invoke(() => CreateMessageBox(owner, message, caption, buttons, icon, defaultButton, saveAndRestorePosition));
var dialog = Dispatcher.UIThread.Invoke(() => CreateMessageBox(owner, message, caption, buttons, icon, defaultButton, saveAndRestorePosition));
return DisplayWindow(dialogTask, owner);
return DisplayWindow(dialog, owner);
}
private static MessageBoxWindow CreateMessageBox(Window owner, string message, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton, bool saveAndRestorePosition = true)