mirror of
https://github.com/babalae/better-genshin-impact.git
synced 2026-05-21 09:45:48 +08:00
create a setup builder impl from MicaSetup
This commit is contained in:
29
Build/MicaSetup/Helper/UIDispatcherHelper.cs
Normal file
29
Build/MicaSetup/Helper/UIDispatcherHelper.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
|
||||
namespace MicaSetup.Helper;
|
||||
|
||||
public static class UIDispatcherHelper
|
||||
{
|
||||
public static Window MainWindow => Application.Current.Dispatcher.Invoke(() => Application.Current.MainWindow);
|
||||
|
||||
public static void Invoke(Action callback, params object[] args)
|
||||
{
|
||||
_ = Application.Current?.Dispatcher.Invoke(callback, args);
|
||||
}
|
||||
|
||||
public static void Invoke(Action<Window> callback)
|
||||
{
|
||||
Application.Current?.Dispatcher.Invoke(callback, MainWindow);
|
||||
}
|
||||
|
||||
public static void BeginInvoke(Action callback, params object[] args)
|
||||
{
|
||||
_ = Application.Current?.Dispatcher.BeginInvoke(callback, args);
|
||||
}
|
||||
|
||||
public static void BeginInvoke(Action<Window> callback)
|
||||
{
|
||||
Application.Current?.Dispatcher.BeginInvoke(callback, MainWindow);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user