Example #1
0
        /// <summary>
        /// Initialize the browser
        /// </summary>
        public void CreateBrowserHandle(string URL, MaterialTabPage tabPage)
        {
            //Initializing the new browser
            browser = new ChromiumWebBrowser(URL);

            //Setting all of the events of the browser
            browser.TitleChanged        += browser_TitleChanged;
            browser.AddressChanged      += browser_AddressChanged;
            browser.LoadingStateChanged += browser_LoadingStateChanged;
            browser.FrameLoadEnd        += (sender, args) =>
            {
                browser.InvokeOnUiThreadIfRequired(() =>
                {
                    //Runs the first load event args
                    if (!isFirstLoad)
                    {
                        isFirstLoad = true; FirstLoad?.Invoke(this, new EventArgs());
                    }
                });
            };

            //Setting the main tab page
            mainTabPage           = tabPage;
            mainTabPage.BackColor = Color.Black;

            //Setting the browser objects
            browser.DownloadHandler = new DownloadHandler();
            browser.DisplayHandler  = new DisplayHandler(this);
            browser.LifeSpanHandler = new LifespanHandler(tabPage);
            browser.MenuHandler     = new ContextMenuHandler(tabPage);
        }
        public void CreateBrowserHandle(string URL, MaterialTabPage tabPage)
        {
            webBrowser = new WebBrowser();

            webBrowser.DocumentTitleChanged += (obj, args) =>
            {
                DefaultVermeerVars vermeerVars = new DefaultVermeerVars(this, vermeerEngine.GetBrowserInstance(this));
                OnDocumentTitleChange?.Invoke(this, new DocumentTitleChange {
                    DocumentTitle = webBrowser.DocumentTitle, VermeerVars = vermeerVars
                });
                OnDocumentLoadChange?.Invoke(this, new DocumentLoadingChange {
                    Status = true, VermeerVars = vermeerVars
                });
            };
            webBrowser.DocumentCompleted += (obj, args) =>
            {
                _currentURL = args.Url.OriginalString;
                DefaultVermeerVars vermeerVars = new DefaultVermeerVars(this, vermeerEngine.GetBrowserInstance(this));
                OnDocumentURLChange?.Invoke(this, new DocumentURLChange {
                    DocumentURL = webBrowser.Url.OriginalString, VermeerVars = vermeerVars
                });
            };

            webBrowser.Navigate(URL);
        }
        public void OnInit(MaterialTabPage page, string StartURL, string ProxyURI)
        {
            hostedTabPage = page;

            CreateBrowserHandle(StartURL, page);
            if (ProxyURI != null)
            {
                VermeerAPI.LogEvent(this, "WARNING", "Internet Explorer Interface does not support TorProxy!");
            }
        }
Example #4
0
        public BrowserWindow(bool startMousePoint = false, MaterialTabPage page = null)
        {
            if (page != null)
            {
                draggedTab = page;
            }
            this.Size = new Size(1280, 720);

            this.InitializeComponent();

            StartMousePoint = startMousePoint;
        }
Example #5
0
        private void tabHeader_NewTabButtonClick(object sender, NewTabButtonClickedArgs e)
        {
            //Set a private var as a local tab page
            MaterialTabPage tabPage = e.NewTabpage;

            //Set an instance of the TabBrowser
            IBrowser tabControlInst = new IBrowser();

            //Change the local tabpage of the TabBrowser to the new Tab Page
            //Then create the instance.
            tabControlInst.tabPage = tabPage;
            tabControlInst.getIBrowserTab(IBrowser.BrowserType.CefSharp, "google.com", tabPage.Size);
        }
Example #6
0
        public MaterialTabPage getIBrowserTab(BrowserType browserType, string URL, Size defaultSize)
        {
            // TabPage //
            tabPage.Size      = defaultSize;
            tabPage.BackColor = Color.White;
            //tabPage.ChangeTabIcon(Image.FromFile(Application.StartupPath + "\\settingslogo.ico"));

            // BrowserHandler //
            BrowserHeader          = new Igloo.Control.Browser.IBrowserHeader(defaultSize.Width);
            BrowserHeader.Anchor   = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right);
            BrowserHeader.Location = new Point(0, 0);

            tabPage.Controls.Add(BrowserHeader);

            // Browser Panel //
            pnl.Location  = new Point(0, BrowserHeader.Height);
            pnl.Size      = new Size(tabPage.Width, tabPage.Height - BrowserHeader.Height);
            pnl.Anchor    = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Bottom);
            pnl.BackColor = Color.White;

            tabPage.Controls.Add(pnl);

            // IBrowser //
            GenerateBrowserHandle();

            //Initialize the browser
            browser.CreateBrowserHandle(URL, tabPage);

            //Setting the browser event's
            BrowserHeader.SendForwardClick += ((obj, args) => { browser.OnForward(); });
            BrowserHeader.SendBackClick    += ((obj, args) => { browser.OnBack(); });
            BrowserHeader.VPNButtonClicked += ((obj, args) =>
            {
                bool vpnSuc = browser.ToggleVPNService();

                if (vpnSuc)
                {
                    if (browser.GetVPNStatus())
                    {
                        BrowserHeader.ChangeVPNStatus(true);
                    }
                    else
                    {
                        BrowserHeader.ChangeVPNStatus(false);
                    }
                }
            });
            BrowserHeader.TextSearch_EnterPressed += ((obj, args) =>
            {
                string searchEntry = null;

                if (!CheckURLValid(BrowserHeader.GetTXTSearchValue()))
                {
                    searchEntry = GetSearchLink(BrowserHeader.GetTXTSearchValue());
                }
                else
                {
                    searchEntry = BrowserHeader.GetTXTSearchValue();
                }

                browser.Navigate(searchEntry);
            });
            BrowserHeader.SettingsClicked += ((obj, args) =>
            {
                //Modifying the settings form
                SettingsForm settings = new SettingsForm();
                settings.TopLevel = false;
                settings.Visible = true;
                settings.FormBorderStyle = FormBorderStyle.None;
                settings.Dock = DockStyle.Fill;

                //Setting TabControl as local var
                MaterialTabControl parentControl = (MaterialTabControl)tabPage.Parent;

                //Creating a new MaterialTabPage and adding the form as a control
                MaterialTabPage settingsTab = new MaterialTabPage();
                settingsTab.Text = ResourceInformation.ApplicationName + " Settings";
                settingsTab.Controls.Add(settings);

                //Add MaterialTabPage to the TabControl and select that tab
                parentControl.TabPages.Add(settingsTab);
                parentControl.SelectTab(settingsTab);

                //Change the tab icon
                settingsTab.ChangeTabIcon(Image.FromFile(Application.StartupPath + "\\settingslogo.ico"));
            });
            BrowserHeader.SendReloadClick += ((obj, args) =>
            {
                //Check if the browser is loading
                if (browser.IsLoading())
                {
                    //Stop loading the page
                    ((ChromiumWebBrowser)browser.GetBrowser()).GetBrowser().StopLoad();
                }
                else
                {
                    //Reload the page
                    ((ChromiumWebBrowser)browser.GetBrowser()).GetBrowser().Reload();
                }
            });
            browser.OnTitleChange += ((obj, args) =>
            {
                DocumentTitleChange e = args;

                //Change the text of the TabPage to the title.
                tabPage.Text = e.DocumentTitle;
            });
            browser.OnDocumentURLChange += ((obj, args) =>
            {
                DocumentURLChange e = args;

                //Change the text of the Search Bar
                BrowserHeader.ChangeTXTSearchValue(e.DocumentURL);
            });
            browser.LoadingStateChanged += ((obj, args) =>
            {
                //Chanes the look of the reload button depending on the status of the browser
                BrowserHeader.ChangeReloadStatus(browser.IsLoading());

                //Changes the IHeaderBrowser button status's
                Action action = new Action(() =>
                {
                    BrowserHeader.CanGoBackBool(browser.IsBackAvailiable());
                    BrowserHeader.CanGoForwardBool(browser.IsForwardAvailable());
                }); BrowserHeader.Invoke(new MethodInvoker(action));
            });

            pnl.Controls.Add(browser.GetBrowser());

            //Send the browser to the home page
            Console.WriteLine(URL);
            if (URL != null)
            {
                Console.WriteLine("Url is not null"); browser.Navigate(URL);
            }
            else
            {
                browser.Navigate("google.com");
            }

            return(tabPage);
        }
 /// <summary>
 /// Sets the local DownloadItem from the Global Download Item
 /// </summary>
 /// <param name="DownloadHandler">Global Download Item to set the Local Download Item</param>
 public LifespanHandler(MaterialTabPage basedTabPage)
 {
     tabPage = basedTabPage;
 }
Example #8
0
 public ContextMenuHandler(MaterialTabPage i)
 {
     mainTabPage = i;
 }