Ejemplo n.º 1
0
        public void CrossThreadNewTab()
        {
            // InvokeRequired required compares the thread ID of the
            // calling thread to the thread ID of the creating thread.
            // If these threads are different, it returns true.
            if (this.InvokeRequired)
            {
                CallbackDownload d = new CallbackDownload(CrossThreadClose);
                try { this.Invoke(d, new object[] { this.Tabs }); } catch { }
            }
            else
            {
                TabPage newPage = new TabPage();
                newPage.Text = "New Tab";
                Tabs.TabPages.Add(newPage);
                Tabs.SelectTab(newPage);

                chromeBrowser                 = new ChromiumWebBrowser("www.google.com");
                chromeBrowser.Parent          = newPage;
                chromeBrowser.Dock            = DockStyle.Fill;
                AddressBar.Text               = "www.google.com";
                chromeBrowser.AddressChanged += chromeBrowser_AddressChanged;
                chromeBrowser.TitleChanged   += chromeBrowser_TitleChanged;

                TabPage newTabPage = new TabPage();
                newTabPage.Text = "+";
                Tabs.Controls.Add(newTabPage);
            }
        }
Ejemplo n.º 2
0
 private void CrossThreadClose()
 {
     // InvokeRequired required compares the thread ID of the
     // calling thread to the thread ID of the creating thread.
     // If these threads are different, it returns true.
     if (this.InvokeRequired)
     {
         CallbackDownload d = new CallbackDownload(CrossThreadClose);
         try { this.Invoke(d, new object[] { this }); } catch { }
     }
     else
     {
         this.Close();
     }
 }
Ejemplo n.º 3
0
        public static void Download(String ID, String Type, CallbackDownload Callback)
        {
            PrepareDownload(ID, Type);

            var Client = new WebClient();

            Client.Headers["UserAgent"] = Project.UserAgent;

            Extension Ext;

            if (Type == "Extension")
            {
                Ext = Project.Extension[ID];
            }
            else
            {
                Ext = Project.Dependencies[ID];
            }

            Client.DownloadFile(Ext.FileURL, Project.DownloadFolder + "\\" + Ext.FileName);

            Callback(ID);
        }
Ejemplo n.º 4
0
        public static void AsyncDownload(String ID, String Type, CallbackDownload Callback)
        {
            var ThreadAsyncDownload = new Thread(() => Download(ID, Type, Callback));

            ThreadAsyncDownload.Start();
        }