private void UserControl_Loaded(object sender, RoutedEventArgs e) { BerkeliumSharp.Init( Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) ); BerkeliumSharp.PureCall += OnPureCall; BerkeliumSharp.OutOfMemory += OnOutOfMemory; BerkeliumSharp.InvalidParameter += OnInvalidParameter; BerkeliumSharp.Assertion += OnAssertion; Application.Current.Exit += OnExit; if (Window == null) { Context = Context.Create(); Window = new Berkelium.Managed.Window(Context); } else { Context = Window.Context; } WireEventHandlers(); UserControl_SizeChanged(null, null); Window.NavigateTo("http://www.google.com"); Window.Widget.Focus(); StartLoop(); _isInit = true; }
protected void OnExit(object sender, EventArgs e) { if (_isInit) { if (Window != null) Window.Dispose(); Window = null; if (WindowBitmap != null) WindowBitmap.Dispose(); WindowBitmap = null; BerkeliumSharp.Destroy(); _isInit = false; } }