Exemplo n.º 1
0
        /// <summary>
        /// 上传接口2.0
        /// </summary>
        /// <param name="scid"></param>
        public void NoticeFileUpload(AddAttachmentDto scid)
        {
            try
            {
                //string url = ConfigurationManager.AppSettings["NewUpLoadAddress"];
                var    url  = AntSdkService.AntSdkConfigInfo.AntSdkFileUpload;
                string parm = string.Format("?&key={0}&requestTime={1}&File={2}&token={3}", 20000, (DateTime.Now.ToUniversalTime().Ticks - 621355968000000000) / 10000, "file", AntSdkService.AntSdkToken);
                HttpWebClient <AddAttachmentDto> client = new HttpWebClient <AddAttachmentDto>();
                client.Encoding = Encoding.UTF8;


                client.UploadProgressChanged += Client_UploadProgressChanged;;
                client.UploadFileCompleted   += Client_UploadFileCompleted;;
                client.UploadFileAsync(new Uri(url + parm), "POST", scid.localPath);
                client.obj = scid;
            }
            catch (Exception ex)
            {
                LogHelper.WriteError("[NoticeAddWindowViewModel_NoticeFileUpload]:" + ex.Message + ex.StackTrace);
            }
        }