private void UpdateControl(Control controlToUpdate, Color newBackColor)
 {
     if (controlToUpdate != null)
     {
         if (controlToUpdate.ContextMenuStrip != null)
         {
             this.UpdateToolStrip(controlToUpdate.ContextMenuStrip, newBackColor);
         }
         MaterialTabControl materialTabControl = controlToUpdate as MaterialTabControl;
         if (materialTabControl != null)
         {
             foreach (TabPage tabPage in materialTabControl.TabPages)
             {
                 tabPage.BackColor = newBackColor;
             }
         }
         if (controlToUpdate is MaterialDivider)
         {
             controlToUpdate.BackColor = this.GetDividersColor();
         }
         if (controlToUpdate is MaterialListView)
         {
             controlToUpdate.BackColor = newBackColor;
         }
         foreach (Control control in controlToUpdate.Controls)
         {
             this.UpdateControl(control, newBackColor);
         }
         controlToUpdate.Invalidate();
     }
 }
Beispiel #2
0
 void genera(Nodo nodo, Panel appoggio, bool contruttore)
 {
     tabelle          = new MaterialTabControl();
     tabelle.Location = new Point(0, 275);
     tabelle.Size     = new Size(800, 291);
     if (contruttore)
     {
         Panel panel = new Panel();
         panel.Size      = appoggio.Size;
         panel.Location  = new Point(280, 80);
         panel.BackColor = appoggio.BackColor;
         foreach (Control control in appoggio.Controls)
         {
             panel.Controls.Add(Program.creaLabel(control.Location, control.Text, control.Text, control.Tag.ToString()));
         }
         Controls.Add(panel);
     }
     caricaDati(nodo);
     selector                = new MaterialTabSelector();
     selector.Location       = new Point(0, 246);
     selector.Size           = new Size(800, 29);
     selector.BaseTabControl = tabelle;
     selector.Name           = "selector";
     if (tabelle.TabPages.Count > 0)
     {
         Controls.Add(tabelle);
         Controls.Add(selector);
     }
     else
     {
         modifica.Visible     = btnElimina.Visible = false;
         eliminaPanel.Visible = true;
     }
 }
Beispiel #3
0
        public static void AddTab(MaterialTabControl mainTab, Control ctrl)
        {
            TabPage tab = new TabPage();

            tab.Controls.Add(ctrl);
            mainTab.TabPages.Add(tab);
            mainTab.SelectedTab = tab;
        }
Beispiel #4
0
 public static bool isTabExist(MaterialTabControl tab, string tabname)
 {
     foreach (TabPage tabpage in tab.TabPages)
     {
         if (tabpage.Text == tabname)
         {
             return(true);
         }
     }
     return(false);
 }
Beispiel #5
0
        /// <summary>
        /// When the user interacts with the context menu
        /// </summary>
        public bool OnContextMenuCommand(IWebBrowser browserControl, IBrowser browser, IFrame frame, IContextMenuParams parameters, CefMenuCommand commandId, CefEventFlags eventFlags)
        {
            // Custom Commands //

            //Copy link Address
            if ((int)commandId == Copy)
            {
                //Save the link into windows clipboard
                if (parameters.LinkUrl != "")
                {
                    Clipboard.SetText(parameters.LinkUrl);
                }
            }

            if ((int)commandId == OpenInNewTab)
            {
                //Validates that the LinkURL isn't null
                if (parameters.LinkUrl == "")
                {
                    return(false);
                }

                //Getting the TabControl
                MaterialTabControl basedTabControl = (MaterialTabControl)mainTabPage.Parent;

                //Creating a new Tab
                MaterialTabPage newTab = new Igloo.Control.Browser.IBrowser().getIBrowserTab(parameters.LinkUrl, basedTabControl.Size);

                //Inovke on UI thread
                if (basedTabControl.InvokeRequired)
                {
                    basedTabControl.Invoke(new Action(() =>
                    {
                        //Add the new TabPage to the TabControl and then selects it
                        basedTabControl.TabPages.Add(newTab);
                        basedTabControl.SelectTab(newTab);
                    }));
                }
            }

            return(false);
        }
Beispiel #6
0
        public BgTemplate(MaterialTabControl tbcHome, frmMain progEdit)
        {
            InitializeComponent();

            this.tbcHome  = tbcHome;
            this.progEdit = progEdit;
            btn           = new MaterialSkin.Controls.MaterialRaisedButton();
            btn.AutoSize  = false;
            btn.Text      = "使用此模板";
            //btn.AutoSizeMode = AutoSizeMode.GrowAndShrink;
            btn.AutoEllipsis = false;
            btn.Hide();
            btn.Click += selectBg;
            this.Controls.Add(btn);

            this.Text = Resource1.select_file;

            //lbTips.ForeColor = Color.Red;
            filter = "Images (*.BMP;*.JPG;*.PNG)|*.BMP;*.JPG;*.PNG|All files (*.*)|*.*";
        }
        /// <summary>
        /// Used to show the popup of the browser in a new tab
        /// </summary>
        /// <param name="browserControl">The ChromiumWebBrowser control</param>
        /// <param name="browser">IBRowser control of the browser</param>
        /// <param name="frame">IFrame?</param>
        /// <param name="targetUrl">Target URL of the popup</param>
        /// <param name="targetFrameName">Frame of the target</param>
        /// <param name="targetDisposition"></param>
        /// <param name="userGesture">User movement</param>
        /// <param name="popupFeatures">Features of the popup (Currently not supported)</param>
        /// <param name="windowInfo">Window Info (name, etc)</param>
        /// <param name="browserSettings">Settings</param>
        /// <param name="noJavascriptAccess">Java Script Access</param>
        /// <param name="newBrowser">New browser window for the popup</param>
        /// <returns>Returns nothing to prevent a popup</returns>
        public bool OnBeforePopup(IWebBrowser browserControl, IBrowser browser, IFrame frame, string targetUrl, string targetFrameName, WindowOpenDisposition targetDisposition, bool userGesture, IPopupFeatures popupFeatures, IWindowInfo windowInfo, IBrowserSettings browserSettings, ref bool noJavascriptAccess, out IWebBrowser newBrowser)
        {
            //Getting the TabControl
            MaterialTabControl basedTabControl = (MaterialTabControl)tabPage.Parent;

            //Creating a new Tab
            MaterialTabPage newTab = new Igloo.Control.Browser.IBrowser().getIBrowserTab(targetUrl, basedTabControl.Size);

            //Inovke on UI thread
            if (basedTabControl.InvokeRequired)
            {
                basedTabControl.Invoke(new Action(() =>
                {
                    //Add the new TabPage to the TabControl and then selects it
                    basedTabControl.TabPages.Add(newTab);
                    basedTabControl.SelectTab(newTab);
                }));
            }

            //Returns false
            newBrowser = null; return(true);
        }
Beispiel #8
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);
        }
Beispiel #9
0
 private void MaterialTabControl_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     MaterialTabControl.Focus();
 }
Beispiel #10
0
 private void InitializeComponent()
 {
     this.pictureBox2    = new PictureBox();
     this.subTabs        = new MaterialTabControl();
     this.dummyTab       = new TabPage();
     this.subTabSelector = new MaterialTabSelector();
     this.subWorker      = new BackgroundWorker();
     this.btnSettings    = new MaterialRaisedButton();
     ((ISupportInitialize)this.pictureBox2).BeginInit();
     this.subTabs.SuspendLayout();
     base.SuspendLayout();
     this.pictureBox2.Anchor    = AnchorStyles.Right | AnchorStyles.Top;
     this.pictureBox2.BackColor = Color.Transparent;
     this.pictureBox2.Image     = Resources.platinumcheats_wide_compressed_white;
     this.pictureBox2.Location  = new Point(660, 0x1c);
     this.pictureBox2.Name      = "pictureBox2";
     this.pictureBox2.Size      = new Size(0xa8, 0x20);
     this.pictureBox2.SizeMode  = PictureBoxSizeMode.Zoom;
     this.pictureBox2.TabIndex  = 5;
     this.pictureBox2.TabStop   = false;
     this.subTabs.Anchor        = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Top;
     this.subTabs.Controls.Add(this.dummyTab);
     this.subTabs.Depth                       = 0;
     this.subTabs.Location                    = new Point(12, 0x7d);
     this.subTabs.MouseState                  = MouseState.HOVER;
     this.subTabs.Name                        = "subTabs";
     this.subTabs.SelectedIndex               = 0;
     this.subTabs.Size                        = new Size(0x330, 0x1b7);
     this.subTabs.TabIndex                    = 6;
     this.dummyTab.Location                   = new Point(4, 0x16);
     this.dummyTab.Name                       = "dummyTab";
     this.dummyTab.Size                       = new Size(0x328, 0x19d);
     this.dummyTab.TabIndex                   = 0;
     this.dummyTab.Text                       = "Null";
     this.dummyTab.UseVisualStyleBackColor    = true;
     this.subTabSelector.Anchor               = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top;
     this.subTabSelector.BaseTabControl       = this.subTabs;
     this.subTabSelector.Depth                = 0;
     this.subTabSelector.Location             = new Point(-1, 0x3f);
     this.subTabSelector.MouseState           = MouseState.HOVER;
     this.subTabSelector.Name                 = "subTabSelector";
     this.subTabSelector.Size                 = new Size(0x34b, 0x2e);
     this.subTabSelector.TabIndex             = 7;
     this.subTabSelector.Text                 = "materialTabSelector1";
     this.subWorker.DoWork                   += new DoWorkEventHandler(this.subWorker_DoWork);
     this.subWorker.RunWorkerCompleted       += new RunWorkerCompletedEventHandler(this.subWorker_RunWorkerCompleted);
     this.btnSettings.Anchor                  = AnchorStyles.Right | AnchorStyles.Top;
     this.btnSettings.Depth                   = 0;
     this.btnSettings.Location                = new Point(0x2db, 0x44);
     this.btnSettings.MouseState              = MouseState.HOVER;
     this.btnSettings.Name                    = "btnSettings";
     this.btnSettings.Primary                 = true;
     this.btnSettings.Size                    = new Size(0x61, 0x20);
     this.btnSettings.TabIndex                = 0x11;
     this.btnSettings.Text                    = "Settings";
     this.btnSettings.UseVisualStyleBackColor = true;
     this.btnSettings.Click                  += new EventHandler(this.btnSettings_Click);
     base.AutoScaleDimensions                 = new SizeF(6f, 13f);
     base.AutoScaleMode                       = AutoScaleMode.Font;
     base.ClientSize = new Size(840, 0x240);
     base.Controls.Add(this.btnSettings);
     base.Controls.Add(this.subTabSelector);
     base.Controls.Add(this.subTabs);
     base.Controls.Add(this.pictureBox2);
     base.Name          = "MainForm";
     base.StartPosition = FormStartPosition.CenterScreen;
     this.Text          = "Select a Subscription";
     base.Load         += new EventHandler(this.MainForm_Load);
     base.Controls.SetChildIndex(this.pictureBox2, 0);
     base.Controls.SetChildIndex(this.subTabs, 0);
     base.Controls.SetChildIndex(this.subTabSelector, 0);
     base.Controls.SetChildIndex(this.btnSettings, 0);
     ((ISupportInitialize)this.pictureBox2).EndInit();
     this.subTabs.ResumeLayout(false);
     base.ResumeLayout(false);
 }