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;
        }
        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);
        }
Example #3
0
        public WebBrowserHost(TridentWebBrowser tridentWebBrowser)
        {
            ArgumentUtility.CheckNotNull ("tridentWebBrowser", tridentWebBrowser);
              WebBrowser = tridentWebBrowser;

              Content = new WindowsFormsHost { Child = tridentWebBrowser };
        }
        public WebBrowserEvents(
        TridentWebBrowser browserControl,
        IUrlFilter nonApplicationUrlFilter,
        IUrlFilter applicationUrlFiler,
        IUrlFilter entryPointFilter)
        {
            ArgumentUtility.CheckNotNull ("browserControl", browserControl);
              ArgumentUtility.CheckNotNull ("nonApplicationUrlFilter", nonApplicationUrlFilter);
              ArgumentUtility.CheckNotNull ("applicationUrlFiler", applicationUrlFiler);

              ArgumentUtility.CheckNotNull ("entryPointFilter", entryPointFilter);

              _browserControl = browserControl;
              _nonApplicationUrlFilter = nonApplicationUrlFilter;
              _applicationUrlFiler = applicationUrlFiler;
              _entryPointFilter = entryPointFilter;

              _isExternal = false;
        }
        public IExtendedWebBrowser CreateBrowser()
        {
            var browser = new TridentWebBrowser (
              HtmlDocumentHandleRegistry,
              SubscriptionProvider,
              NonApplicationUrlFilter,
              EntryPointFilter,
              ApplicationUrlFilter);

              return browser;
        }
    public void OnBrowserKeyDown (TridentWebBrowser extendedTridentWebBrowser, KeyEventArgs keyEventArgs)
    {
      var keyCode = keyEventArgs.KeyCode | ModifierKeys;

      if (keyCode == (Keys.Control | Keys.NumPad0)
          || (keyCode == (Keys.Control | Keys.D0)))
        Zoom (100);


      if (ModifierKeys == 0 || !Enum.IsDefined (typeof (Shortcut), (Shortcut) keyCode))
        return;

      switch (keyCode)
      {
        case Keys.Control | Keys.A: // Select All
        case Keys.Control | Keys.C: // Copy
        case Keys.Control | Keys.V: // Paste
        case Keys.Control | Keys.X: // Cut
        case Keys.Control | Keys.F: // Find
        case Keys.Control | Keys.NumPad0: // reset zoom
        case Keys.Delete: // Delete
          keyEventArgs.Handled = !EnableWebBrowserEditingShortcuts;
          break;
        default:
          keyEventArgs.Handled = !EnableWebBrowserShortcuts;
          break;
      }
    }
 public DocumentHostUIHandler(TridentWebBrowser browser)
     : base(browser)
 {
     _extendedTridentWebBrowser = browser;
 }