예제 #1
0
        public void Go_DowndLoad(object p)
        {
            if (Down_list_Selete == null)
            {
                return;
            }
            if (DownInfo[Down_list_Selete.ID].State == "下载")
            {
                return;
            }
            DownLoad    d    = new DownLoad();
            string      name = DownInfo[Down_list_Selete.ID].filename;
            Information inf  = d.RSerialization(name);

            if (inf.filename == null)
            {
                MessageBox.Show("文件不存在!");
                int i = Down_list_Selete.ID;
                DownInfo.RemoveAt(Down_list_Selete.ID);
                for (; i < DownInfo.Count; i++)
                {
                    DownInfo[i].ID = i;
                }
                Serialization(@"./config/ImportDownLoadInfo", DownInfo);
                return;
            }
            d.ContinuousDownLoad(inf);
            DownInfo[Down_list_Selete.ID].ID    = Down_d.Count;
            DownInfo[Down_list_Selete.ID].State = "下载";
            Down_d.Add(d);
            for (int i = 0; i < Down_d.Count; i++)
            {
                Down_d[i].Maxseepd = Limit_DownLoad_Speed;
                Down_d[i].Sum      = Down_d.Count;
            }
            Task <int> task = _client.DownloadRequestAsync(Down_list_Selete.Hash, d.Port);

            task.ContinueWith(T =>
            {
            });
            Serialization(@"./config/ImportDownLoadInfo", DownInfo);
        }