public PopUpWindow(TridentWebBrowser webBrowser, Guid identifier) { ArgumentUtility.CheckNotNull ("webBrowser", webBrowser); InitializeComponent(); _browserHost = new WebBrowserHost (webBrowser); Content = _browserHost; Width = _browserHost.WebBrowser.Width; _browserHost.WebBrowser.WindowSetWidth += (s, w) => Width = w; Height = _browserHost.WebBrowser.Height; _browserHost.WebBrowser.WindowSetHeight += (s, h) => Height = h; Left = _browserHost.WebBrowser.Left; _browserHost.WebBrowser.WindowSetLeft += (s, l) => Left = l; Top = _browserHost.WebBrowser.Top; _browserHost.WebBrowser.WindowSetTop += (s, t) => Top = t; ResizeMode = _browserHost.WebBrowser.IsResizable ? ResizeMode.CanResize : ResizeMode.NoResize; _browserHost.WebBrowser.WindowSetResizable += (s, r) => ResizeMode = r ? ResizeMode.CanResize : ResizeMode.NoResize; _browserHost.WebBrowser.DocumentTitleChanged += (s, e) => Title = _browserHost.WebBrowser.Title; Identifier = identifier; Closing += OnBeforeClose; webBrowser.DocumentsFinished += (s, e) => Icon = webBrowser.GetFavicon (s_defaultImageUri); }
public BrowserTab(TridentWebBrowser webBrowser, Guid identifier, IDictionary<Tuple<TargetAddressType, TabType>, BrowserTabState> states) { ArgumentUtility.CheckNotNull ("webBrowser", webBrowser); ArgumentUtility.CheckNotNull ("states", states); InitializeComponent(); Identifier = identifier; _states = states; TabHeaderViewModel = new TabHeaderViewModel ( Visibility.Collapsed, new BitmapImage (s_defaultImageUri), webBrowser.Url.ToString(), Brushes.Transparent); TabHeaderViewModel.CloseClicked += (s, e) => { if (ShouldClose()) CloseView(); }; webBrowser.DocumentTitleChanged += OnDocumentTitleChanged; webBrowser.DocumentsFinished += (s, e) => TabHeaderViewModel.Icon = webBrowser.GetFavicon (s_defaultImageUri); webBrowser.Navigated += (s, e) => OnPropertyChanged("Url"); WebBrowserHost = new WebBrowserHost (webBrowser); DataContext = this; webBrowser.BeforeNavigate += OnBeforeNavigate; Type = TabType.CommonTab; }