public static Tab CreateTab(String url) { Browser browser = BrowserFactory.Create(BrowserType); BrowserView browserView = new WPFBrowserView(browser); browser.DialogHandler = new WPFDefaultDialogHandler((UIElement)browserView); browser.DownloadHandler = new WPFDefaultDownloadHandler((UIElement)browserView); browser.ContextMenuHandler = new WPFDefaultContextMenuHandler((FrameworkElement)browserView, true); browser.Preferences.FireKeyboardEventsEnabled = false; browser.Preferences.FireMouseEventsEnabled = false; TabContent tabContent = new TabContent(browserView); TabCaption tabCaption = new TabCaption(); tabCaption.SetTitle("about:blank"); browserView.Browser.LoadURL(url); return(new Tab(tabCaption, tabContent)); }
public Tab(TabCaption caption, TabContent content) { this.Header = caption; this.Content = content; if (content == null || !(content is TabContent)) { return; } content.PropertyChangeEvent += delegate(string propertyName, object oldValue, object newValue) { if (propertyName == "PageTitleChanged") { Application.Current.Dispatcher.BeginInvoke( DispatcherPriority.Input, (ThreadStart) delegate { caption.SetTitle(newValue.ToString()); }); } }; }