protected void OnInitialized() { var switches = DotNetBrowserSwitches.Create(BrowserType); BrowserPreferences.SetChromiumSwitches(switches.ToArray()); _path = GetOrCreateContextParamsPath(); _browserContext = new BrowserContext(new BrowserContextParams(_path)); browser = BrowserFactory.Create(_browserContext, BrowserType); browser.Preferences.AllowDisplayingInsecureContent = false; browser.Preferences.AllowRunningInsecureContent = false; browser.Preferences.AllowScriptsToCloseWindows = false; browser.Preferences.ApplicationCacheEnabled = false; browser.Preferences.DatabasesEnabled = false; browser.Preferences.LocalStorageEnabled = false; browser.Preferences.PluginsEnabled = false; browser.Preferences.TransparentBackground = true; browser.Preferences.UnifiedTextcheckerEnabled = false; browser.Preferences.WebAudioEnabled = false; browser.ZoomEnabled = true; browser.DialogHandler = this; browser.LoadHandler = this; browser.Context.NetworkService.ResourceHandler = this; browser.RenderGoneEvent += Browser_RenderGoneEvent; browser.ScriptContextCreated += Browser_ScriptContextCreated; }
protected void OnInitialized() { var switches = DotNetBrowserSwitches.Create(BrowserType); BrowserPreferences.SetChromiumSwitches(switches.ToArray()); _path = GetOrCreateContextParamsPath(); _browserContext = new BrowserContext(new BrowserContextParams(_path)); var browser = BrowserFactory.Create(_browserContext, BrowserType); browser.Preferences.AllowDisplayingInsecureContent = false; browser.Preferences.AllowRunningInsecureContent = false; browser.Preferences.AllowScriptsToCloseWindows = false; browser.Preferences.ApplicationCacheEnabled = false; browser.Preferences.DatabasesEnabled = false; browser.Preferences.LocalStorageEnabled = false; browser.Preferences.PluginsEnabled = false; browser.Preferences.TransparentBackground = true; browser.Preferences.UnifiedTextcheckerEnabled = false; browser.Preferences.WebAudioEnabled = false; browser.ZoomEnabled = true; browser.DialogHandler = this; browser.LoadHandler = this; browser.Context.NetworkService.ResourceHandler = this; browser.RenderGoneEvent += Browser_RenderGoneEvent; browser.ScriptContextCreated += Browser_ScriptContextCreated; _browserView = new WPFBrowserView(browser); browser.ConsoleMessageEvent += Browser_ConsoleMessageEvent; _browserView.InputBindings.Add(new InputBinding(new BookmarkShortcut1Command(), new KeyChordGesture(ModifierKeys.Shift | ModifierKeys.Control, Key.OemQuestion, Key.D1))); _browserView.InputBindings.Add(new InputBinding(new BookmarkShortcut2Command(), new KeyChordGesture(ModifierKeys.Shift | ModifierKeys.Control, Key.OemQuestion, Key.D2))); _browserView.InputBindings.Add(new InputBinding(new BookmarkShortcut3Command(), new KeyChordGesture(ModifierKeys.Shift | ModifierKeys.Control, Key.OemQuestion, Key.D3))); _browserView.InputBindings.Add(new InputBinding(new BookmarkShortcut4Command(), new KeyChordGesture(ModifierKeys.Shift | ModifierKeys.Control, Key.OemQuestion, Key.D4))); _browserView.InputBindings.Add(new InputBinding(new BookmarkShortcut5Command(), new KeyChordGesture(ModifierKeys.Shift | ModifierKeys.Control, Key.OemQuestion, Key.D5))); _browserView.InputBindings.Add(new InputBinding(new BookmarkShortcut6Command(), new KeyChordGesture(ModifierKeys.Shift | ModifierKeys.Control, Key.OemQuestion, Key.D6))); _browserView.InputBindings.Add(new InputBinding(new BookmarkShortcut7Command(), new KeyChordGesture(ModifierKeys.Shift | ModifierKeys.Control, Key.OemQuestion, Key.D7))); _browserView.InputBindings.Add(new InputBinding(new BookmarkShortcut8Command(), new KeyChordGesture(ModifierKeys.Shift | ModifierKeys.Control, Key.OemQuestion, Key.D8))); _browserView.InputBindings.Add(new InputBinding(new BookmarkShortcut9Command(), new KeyChordGesture(ModifierKeys.Shift | ModifierKeys.Control, Key.OemQuestion, Key.D9))); #if DEBUG Log.Debug(GetDevToolsUrl()); #endif }