Skip to content

Instantly share code, notes, and snippets.

@Perikles
Created August 11, 2011 03:49
Show Gist options
  • Save Perikles/1138867 to your computer and use it in GitHub Desktop.
Save Perikles/1138867 to your computer and use it in GitHub Desktop.
Example of Initializing the WebCore when using a WebControl in application's MainWindow
<Window
x:Class="AwesomiumCSharpWpfApplication.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:awe="http://schemas.awesomium.com/winfx"
Title="MainWindow"
Height="350"
Width="525">
<Grid>
<awe:WebControl x:Name="Browser" />
</Grid>
</Window>
using System;
using System.Windows;
using AwesomiumSharp;
namespace AwesomiumCSharpWpfApplication
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
// Initialize the WebCore before creating the control. Just make sure that you
// specify False for the start parameter. This will ensure lazy initialization of
// the core; if this is your main window, a synchronization context necessary
// for WebCore's auto-update, may not be created yet. Specifying false will ensure
// that the core will start when the first WebView or WebControl is created. By that
// time, the dispatcher will definitely be running.
WebCore.Initialize( new WebCoreConfig() { LogLevel = LogLevel.None }, false );
InitializeComponent();
}
}
}
Imports AwesomiumSharp
Class MainWindow
Public Sub New()
' Initialize the WebCore before creating the control. Just make sure that you
' specify False for the start parameter. This will ensure lazy initialization of
' the core; if this is your main window, a synchronization context necessary
' for WebCore's auto-update, may not be created yet. Specifying false will ensure
' that the core will start when the first WebView or WebControl is created. By that
' time, the dispatcher will definitely be running.
WebCore.Initialize(New WebCoreConfig() With {.LogLevel = LogLevel.None}, False)
' This call is required by the designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
End Sub
End Class
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment