Esempio n. 1
0
        private void QueryTaskTimer_Tick()
        {
            XLPlatformEx.GatherDownloadInfo();
            this.Invoke(DoRefreshLayout, CODE_PRGRESS_BAR, (int)(XLPlatformEx.DownloadingPercent() * 100));
            this.Invoke(DoRefreshLayout, CODE_DOWNLOAD_SPEED, AssignSpeed_Size(XLPlatformEx.ProvideSpeed(), "/s"));

            if (pgb_Downloading.Value == 100)
            {
                this.Invoke(DoRefreshLayout, CODE_BTN_END, null);
            }

            if (lbl_FileSize.Text == "0 B")
            {
                if (File.Exists(strSaveFileName_WithExt_td))
                {
                    Invoke(DoRefreshLayout, CODE_FILE_SIZE, AssignSpeed_Size(XLPlatformEx.ProvideFileSize(), ""));
                }
                else
                {
                    nTimeoutCount++;
                    if (nTimeoutCount > 80)
                    {
                        nTimeoutCount = 0;
                        this.Invoke(DoRefreshLayout, CODE_BTN_END, null);
                    }
                }
            }
        }
Esempio n. 2
0
 public void Btn_StopDownload_Click(object sender, EventArgs e)
 {
     timer1.Stop();
     this.btn_BeginDownload.Enabled = true;
     XLPlatformEx.EndDownload();
     this.btn_StopDownload.Enabled = false;
     this.bisDownloaded            = true;
 }
Esempio n. 3
0
        public void InitThunderEngine()
        {
            bool b = XLPlatformEx.InitXunLei();

            if (!b)
            {
                dotNetLab.Data.Tipper.Tip_Info_Error("云加速组件初始化失败");
            }
        }
Esempio n. 4
0
        public void Btn_BeginDownload_Click(object sender, EventArgs e)
        {
            if (sender != null)
            {
                InitThunderEngine();
            }
            this.bisDownloaded = false;
            this.txb_Url.Text  = Clipboard.GetText();
            if (txb_FileName.Text == this.strPreviousFileName)
            {
                txb_FileName.Text = null;
            }
            if (String.IsNullOrWhiteSpace(txb_FileName.Text))
            {
                int n = txb_Url.Text.LastIndexOf('/');
                txb_FileName.Text = txb_Url.Text.Substring(n + 1);
            }
            this.lbl_FileSize.Text = AssignSpeed_Size(XLPlatformEx.ProvideFileSize(), "");
            if (XLPlatformEx.ProvideFileSize() == 0)
            {
                this.strSaveFileName_WithExt_td = this.txb_FolderPath.Text + txb_FileName.Text + ".td";
            }

            timer1.Start();
            this.btn_BeginDownload.Enabled = false;
            this.btn_StopDownload.Enabled  = true;

            bool b = XLPlatformEx.BeginDownload(Clipboard.GetText(), txb_FolderPath.Text.Trim(), txb_FileName.Text.Trim());

            if (!b)
            {
                lbl_Status.Text = "下载失败,是否下载文件夹失效?";
            }
            XLPlatformEx.Download();
            strPreviousFileName = txb_FileName.Text;
        }