mirror of
https://github.com/cyanfish/naps2.git
synced 2024-09-11 15:26:55 +03:00
Set invoker in entry points
This commit is contained in:
parent
d0e9cbc84b
commit
740d3bbccc
@ -37,7 +37,6 @@ public class WinFormsEtoPlatform : EtoPlatform
|
||||
application.MainForm = mainForm;
|
||||
mainForm.Show();
|
||||
var appContext = new WF.ApplicationContext(mainForm.ToNative());
|
||||
Invoker.Current = new WinFormsInvoker(() => appContext.MainForm!);
|
||||
WinFormsDesktopForm.ApplicationContext = appContext;
|
||||
var setOptionsMethod =
|
||||
typeof(ApplicationHandler).GetMethod("SetOptions", BindingFlags.Instance | BindingFlags.NonPublic);
|
||||
|
@ -50,6 +50,7 @@ public static class ConsoleEntryPoint
|
||||
var application = EtoPlatform.Current.CreateApplication();
|
||||
application.UnhandledException += UnhandledException;
|
||||
application.Initialized += (_, _) => scanning.Execute().ContinueWith(_ => application.Quit());
|
||||
Invoker.Current = new EtoInvoker(application);
|
||||
EtoPlatform.Current.RunApplication(application);
|
||||
}
|
||||
else
|
||||
|
@ -38,6 +38,7 @@ public static class GuiEntryPoint
|
||||
// Show the main form
|
||||
var application = EtoPlatform.Current.CreateApplication();
|
||||
application.UnhandledException += UnhandledException;
|
||||
Invoker.Current = new EtoInvoker(application);
|
||||
var formFactory = container.Resolve<IFormFactory>();
|
||||
var desktop = formFactory.Create<DesktopForm>();
|
||||
|
||||
|
@ -39,13 +39,11 @@ public abstract class EtoPlatform
|
||||
|
||||
public virtual void RunApplication(Application application, Form mainForm)
|
||||
{
|
||||
Invoker.Current = new EtoInvoker(application);
|
||||
application.Run(mainForm);
|
||||
}
|
||||
|
||||
public virtual void RunApplication(Application application)
|
||||
{
|
||||
Invoker.Current = new EtoInvoker(application);
|
||||
application.Run();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user