Skip to content

Commit

Permalink
Merge pull request #2598 from cyanfish/wfmainform
Browse files Browse the repository at this point in the history
WinForms: Handle MainForm changes
  • Loading branch information
cwensley authored Dec 11, 2023
2 parents 5fb78c0 + e4a2c48 commit 5b33292
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/Eto.WinForms/Forms/ApplicationHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ public class ApplicationHandler : WidgetHandler<object, Application, Application
bool quitting;
readonly Thread mainThread;
SynchronizationContext context;
swf.ApplicationContext applicationContext = new swf.ApplicationContext();
public static bool EnableScrollingUnderMouse = true;
public static bool BubbleMouseEvents = true;
public static bool BubbleKeyEvents = true;
Expand Down Expand Up @@ -115,10 +116,7 @@ public void Run()

if (!quitting)
{
if (Widget.MainForm != null && Widget.MainForm.Loaded)
swf.Application.Run((swf.Form)Widget.MainForm.ControlObject);
else
swf.Application.Run();
swf.Application.Run(applicationContext);
}
}
else
Expand Down Expand Up @@ -230,6 +228,7 @@ public void Attach(object context)

public void OnMainFormChanged()
{
applicationContext.MainForm = (swf.Form)Widget.MainForm.ControlObject;
}

public void Quit()
Expand Down

0 comments on commit 5b33292

Please sign in to comment.