mirror of
https://github.com/cefsharp/CefSharp.git
synced 2026-12-04 10:22:55 +00:00
fdc02076ce
When there are two forms that contain browser instances shown at the same time they rapidly switch between the two windows. Issue #2928
38 lines
1.2 KiB
C#
38 lines
1.2 KiB
C#
// Copyright © 2019 The CefSharp Authors. All rights reserved.
|
|
//
|
|
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
|
|
|
|
using System.Windows.Forms;
|
|
using CefSharp.WinForms.Example.Handlers;
|
|
|
|
namespace CefSharp.WinForms.Example.Minimal
|
|
{
|
|
public class MultiFormAppContext : ApplicationContext
|
|
{
|
|
private SimpleBrowserForm form1;
|
|
private SimpleBrowserForm form2;
|
|
|
|
public MultiFormAppContext(bool multiThreadedMessageLoop)
|
|
{
|
|
form1 = new SimpleBrowserForm(multiThreadedMessageLoop, new MultiFormFocusHandler());
|
|
form1.WindowState = FormWindowState.Normal;
|
|
form2 = new SimpleBrowserForm(multiThreadedMessageLoop, new MultiFormFocusHandler());
|
|
form2.WindowState = FormWindowState.Normal;
|
|
|
|
form1.FormClosed += OnFormClosed;
|
|
form2.FormClosed += OnFormClosed;
|
|
|
|
form1.Show();
|
|
form2.Show();
|
|
}
|
|
|
|
private void OnFormClosed(object sender, FormClosedEventArgs e)
|
|
{
|
|
if (Application.OpenForms.Count == 0)
|
|
{
|
|
ExitThread();
|
|
}
|
|
}
|
|
}
|
|
}
|