Exemplo n.º 1
0
 public void ShowDownloader()
 {
     string canshowdownloader;
     canshowdownloader = "yes";
     foreach (Form f in Application.OpenForms)
     {
         if (f.Name == "MainDownloadForm")
         {
             canshowdownloader = "no";
         }
     }
     if (canshowdownloader == "yes")
     {
         MyDownloader.App.UI.MainDownloadForm newd = new MyDownloader.App.UI.MainDownloadForm();
         newd.Show();
     }
     else
     {
         ((MyDownloader.App.UI.MainDownloadForm)Application.OpenForms["MainDownloadForm"]).Show();
         
     }
 }
Exemplo n.º 2
0
        void DownloadFileUsingDefaultDownloader(string url, string filename)
        {
            string canshowdownloader;
            canshowdownloader = "yes";
            foreach (Form f in Application.OpenForms)
            {
                if (f.Name == "MainDownloadForm")
                {
                    canshowdownloader = "no";
                }
            }
            if (canshowdownloader == "yes")
            {
                MyDownloader.App.UI.MainDownloadForm newd = new MyDownloader.App.UI.MainDownloadForm();
                newd.Show();
                newd.downloadList1.NewFileDownload(url, filename, true);
            }
            else
            {
                ((MyDownloader.App.UI.MainDownloadForm)Application.OpenForms["MainDownloadForm"]).Focus();
                ((MyDownloader.App.UI.MainDownloadForm)Application.OpenForms["MainDownloadForm"]).downloadList1.NewFileDownload(url, filename, true);
				((MyDownloader.App.UI.MainDownloadForm)Application.OpenForms["MainDownloadForm"]).Show ();
            }
        }
Exemplo n.º 3
0
        private void downloadDelegate_DecideDestinationWithSuggestedFilename(WebDownload download, string fileName)
        {
            download.setDeletesFileUponFailure(1);
            if (string.IsNullOrEmpty(fileName) == false)
            {
                string url = download.request().url();
                if (GlobalPreferences.WillHandleDownloadsManually)
                {
                    FileDownloadBeginEventArgs args = new FileDownloadBeginEventArgs(download.request().url(), fileName, download);
                    DownloadBegin(this, args);
                }
                else
                {
                    if (!(canornot == download))
                    {
                        canornot = download;
                        candownload = "yes";
                    }
                    else { canornot = null; }
                    if (!url.StartsWith("file://"))
                        foreach (Form hello in Application.OpenForms)
                        {
                            if (hello.Name == "MainDownloadForm")
                            {
                                candownload = "no";
                            }
                        }
                    if (candownload == "yes")
                    {
                        MyDownloader.App.UI.MainDownloadForm newd = new MyDownloader.App.UI.MainDownloadForm();
                        newd.Show();
                        newd.downloadList1.NewFileDownload(url, fileName, true, false);
                    }
                    else
                    {
                        ((MyDownloader.App.UI.MainDownloadForm)Application.OpenForms["MainDownloadForm"]).Show();
                        ((MyDownloader.App.UI.MainDownloadForm)Application.OpenForms["MainDownloadForm"]).downloadList1.NewFileDownload(url, fileName, true, false);

                    }
                    download.cancelForResume();
                }
            }
        }