Skip to content

Commit

Permalink
WinForms: Handle MainForm changes
Browse files Browse the repository at this point in the history
  • Loading branch information
cyanfish committed Dec 11, 2023
1 parent 5fb78c0 commit e4a2c48
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 e4a2c48

Please sign in to comment.