private void BrowserIsAttached(IWebBrowser browser) { NavigationItemViewModel.SetBrowser(browser); TabHeaderViewModel.SetBrowser(browser); ScriptRunner = new CefScriptRunner(browser); browser.FrameLoadEnd += BrowserOnFrameLoadEnd; browser.ConsoleMessage += BrowserOnConsoleMessage; browser.LoadError += BrowserLoadError; browser.DisplayHandler = new DisplayHandler((favIcon) => { _dispatcher.Invoke(() => { TabHeaderViewModel.FavIcon = favIcon; }); }); LazyRegisterWebObserver(); WebPageObserver = new WebPageObserver(ScriptRunner, Id); WebPageObserver.FocusChanged += WebPageObserverOnFocusChanged; WebPageObserver.Mutated += WebPageObserverOnMutated; WebPageObserver.MouseOverChanged += WebPageObserverOnMouseOverChanged; WebPageObserver.BeaconEvent += WebPageObserverOnBeaconEvent; }
public BrowserTabViewModel(string startingAddress, ILogger logger, CloseTabCommandFactory closeTabCommandFactory, Dispatcher dispatcher) { Id = Guid.NewGuid(); _logger = logger; _dispatcher = dispatcher; _embeddedDb = new EmbeddableDocumentStore() { DataDirectory = "data" + Id }.Initialize(); TabHeaderViewModel = new TabHeaderViewModel(closeTabCommandFactory.Create(this), Id); NavigationItemViewModel = new NavigationElementViewModel(dispatcher); AddressBarViewModel = new AddressBarViewModel(startingAddress, _logger); _logger.Info("open page tab " + Id + " with address: " + startingAddress, LogEventTypes.Common); }