Remove unnecessary extensions
This commit is contained in:
parent
7525d318c0
commit
433974323c
@ -12,12 +12,6 @@ namespace Avalonia.Threading
|
|||||||
public static void Invoke(this Dispatcher dispatcher, Action action, DispatcherPriority dispatcherPriority = DispatcherPriority.Normal)
|
public static void Invoke(this Dispatcher dispatcher, Action action, DispatcherPriority dispatcherPriority = DispatcherPriority.Normal)
|
||||||
=> WaitOnDispatcher(dispatcher.InvokeAsync(action, dispatcherPriority), dispatcher);
|
=> 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)
|
public static TResult WaitOnDispatcherAndGetResult<TResult>(this Task<TResult> task, Dispatcher dispatcher)
|
||||||
{
|
{
|
||||||
using var source = new CancellationTokenSource();
|
using var source = new CancellationTokenSource();
|
||||||
|
|||||||
@ -19,7 +19,7 @@ namespace LibationAvalonia
|
|||||||
|
|
||||||
public static T ShowDialogSynchronously<T>(this Avalonia.Controls.Window window, Avalonia.Controls.Window owner)
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -151,9 +151,9 @@ Libation.
|
|||||||
|
|
||||||
private static DialogResult ShowCoreAsync(Window owner, string message, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton, bool saveAndRestorePosition = true)
|
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)
|
private static MessageBoxWindow CreateMessageBox(Window owner, string message, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton, bool saveAndRestorePosition = true)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user