Пример #1
0
 // 下载展示
 private void Image_MouseDown_1(object sender, MouseButtonEventArgs e)
 {
     if (_files.Count > 0)
     {
         AsyncDownLoad ad = new AsyncDownLoad(DownLoad);
         ad.BeginInvoke(new AsyncCallback(CallBackDownload), null);
     }
 }
Пример #2
0
        // 异步回调
        private void CallBackDownload(IAsyncResult result)
        {
            AsyncDownLoad ad = (AsyncDownLoad)
                               ((System.Runtime.Remoting.Messaging.AsyncResult)result).AsyncDelegate;
            // 获取异步操作结果
            bool res = ad.EndInvoke(result);

            // 上传成功则显示分享码
            if (res)
            {
                syncContext.Post(Fail, "下载完成");
            }
            else
            {
                syncContext.Post(Fail, "下载失败");
            }
        }