-
Notifications
You must be signed in to change notification settings - Fork 2
Upgrade to CefGlue v68 and CefSharp v67
*** For note on more recent versions please see Upgrade to CefGlue v70 and CefSharp v71.
Prior to upgrade of CefGlue v68 and CefSharp v67, Chromely on Windows uses the "blackbox" approach to Winapi window creation - see here. This approach encapsulates the window creation and details are hidden.
However since upgrading to CefGlue v68 and the removal of SingleProcess option see 1 and 2, the "blackbox" approach creates a separate window besides the main window. Looks like the MultiProcess option is not in sync with the "blackbox" approach. As a result, Chromely Winapi will now use the Win32 approach windows creation see here. This way there is a better control on when the browser and actual window are created.
As a result the way Chromely is created will change. For newer approach, please see the Demo Projects. Below the differences will be highlighted.
class Program
{
static int Main(string[] args)
{
var startUrl = "https://google.com";
var config = ChromelyConfiguration
.Create()
.WitAppArgs(args)
.WithHostSize(1000, 600)
.WithStartUrl(startUrl);
var factory = WinapiHostFactory.Init();
using (var window = factory.CreateWindow(() => new CefGlueBrowserHost(config),
"chromely", constructionParams: new FrameWindowConstructionParams()))
{
window.SetSize(config.HostWidth, config.HostHeight);
window.CenterToScreen();
window.Show();
return new EventLoop().Run(window);
}
}
}
- Creates Chromely window of size 1000 x 600 pixels.
- Sets the window title to "chromely"
- Sets start url to "https://google.com"
- Centers the window
class Program
{
static int Main(string[] args)
{
var startUrl = "https://google.com";
var config = ChromelyConfiguration
.Create()
.WithHostMode(WindowState.Normal, true)
.WithHostTitle("chromely")
.WithHostIconFile("chromely.ico")
.WitAppArgs(args)
.WithHostSize(1000, 600)
.WithStartUrl(startUrl);
using (var window = new CefGlueBrowserWindow(config))
{
return window.Run(args);
}
}
}
- Creates Chromely window of size 1000 x 600 pixels.
- Sets the window title to "chromely"
- Sets start url to "https://google.com"
- Centers the window
class Program
{
static int Main(string[] args)
{
var startUrl = "https://google.com";
var config = ChromelyConfiguration
.Create()
.WithAppArgs(args)
.WithHostSize(1000, 600)
.WithStartUrl(startUrl);
var factory = WinapiHostFactory.Init();
using (var window = factory.CreateWindow(() => new CefSharpBrowserHost(config),
"chromely", constructionParams: new FrameWindowConstructionParams()))
{
window.SetSize(config.HostWidth, config.HostHeight);
window.CenterToScreen();
window.Show();
return new EventLoop().Run(window);
}
}
}
- Creates Chromely window of size 1000 x 600 pixels.
- Sets the window title to "chromely"
- Sets start url to "https://google.com"
- Centers the window
class Program
{
static int Main(string[] args)
{
var startUrl = "https://google.com";
var config = ChromelyConfiguration
.Create()
.WithHostMode(WindowState.Normal, true)
.WithHostTitle("chromely")
.WithHostIconFile("chromely.ico")
.WitAppArgs(args)
.WithHostSize(1000, 600)
.WithStartUrl(startUrl);
using (var window = new CefSharpBrowserWindow(config))
{
return window.Run(args);
}
}
}
- Creates Chromely window of size 1000 x 600 pixels.
- Sets the window title to "chromely"
- Sets start url to "https://google.com"
- Centers the window
Chromely
Getting Started
The Basics
Digging Deeper
- Sub-Process
- Infrastructure
- Restful Resources
- Register Resource Assemblies
- Custom Local Resource Handling
- Custom Scheme Handling
- Expose .NET class to JavaScript
- Generic Message Routing
- Real-time with Websocket
- External Url Registration
Angular - React - Vue