public FrameworkElement Initialize() {
if (_session == null) {
if (!WebCore.IsInitialized) {
WebCore.Initialize(new WebConfig {
UserAgent = DefaultUserAgent,
ReduceMemoryUsageOnNavigation = true,
LogLevel = LogLevel.None,
#if DEBUG
RemoteDebuggingHost = @"127.0.0.1",
RemoteDebuggingPort = 45451,
#endif
AdditionalOptions = new[] {
@"disable-desktop-notifications"
},
CustomCSS = @"
::-webkit-scrollbar { width: 8px!important; height: 8px!important; }
::-webkit-scrollbar-track { box-shadow: none!important; border-radius: 0!important; background: #000!important; }
::-webkit-scrollbar-corner { background: #000 !important; }
::-webkit-scrollbar-thumb { border: none !important; box-shadow: none !important; border-radius: 0 !important; background: #333 !important; }
::-webkit-scrollbar-thumb:hover { background: #444 !important; }
::-webkit-scrollbar-thumb:active { background: #666 !important; }"
});
}
_session = WebCore.CreateWebSession(FilesStorage.Instance.GetTemporaryFilename(@"Awesomium"), new WebPreferences {
EnableGPUAcceleration = true,
WebGL = true,
SmoothScrolling = false,
FileAccessFromFileURL = true,
UniversalAccessFromFileURL = true
});
}
_inner = new BetterWebControl {
WebSession = _session,
UserAgent = DefaultUserAgent
};
_inner.LoadingFrame += OnLoadingFrame;
_inner.LoadingFrameComplete += OnLoadingFrameComplete;
_inner.LoadingFrameFailed += OnLoadingFrameComplete;
_inner.DocumentReady += OnDocumentReady;
return _inner;
}