void _client_GetAttachmentUploadSetCompleted(object sender, GetAttachmentUploadSetCompletedEventArgs e) { try { UploadSetInfo uploadsetinfo = e.Result; if (!string.IsNullOrEmpty(uploadsetinfo.ErrMessage)) { ShowMessageBox("\r\n" + uploadsetinfo.ErrMessage); return; } if (!uploadsetinfo.CanPostAttach || uploadsetinfo.AttachSize <= 0) { SetUploadButton(false); return; } //设置最大上传参数 _maxFileSize = uploadsetinfo.MaxAttachSize; _todayAttachSize = uploadsetinfo.AttachSize; _maxAttachments = uploadsetinfo.Maxattachments < _maxAttachments ? uploadsetinfo.Maxattachments : _maxAttachments; string allAllowExtname = ""; //设置选择框参数 foreach (string extname in uploadsetinfo.AttachExtensionsNoSize.ToLower().Split(',')) { if (string.IsNullOrEmpty(_fileFilter)) { _fileFilter += extname + "Files (*." + extname + ")|*." + extname; allAllowExtname += "*." + extname; } else { _fileFilter += "|" + extname + "Files (*." + extname + ")|*." + extname; allAllowExtname += ";*." + extname; } } _fileFilter = "所有格式(" + allAllowExtname + ")|" + allAllowExtname + "|" + _fileFilter; Message.Text = "单个附件大小:" + Math.Round((decimal)uploadsetinfo.MaxAttachSize / 1024 / 1024, 2) + "MB\r\n"; Message.Text += "今天可上传大小:" + Math.Round((decimal)uploadsetinfo.AttachSize / 1024 / 1024, 2) + "MB\r\n"; Message.Text += "附件类型: " + uploadsetinfo.AttachExtensionsNoSize; OtherMessage.Text = "已上传大小:" + Math.Round((decimal)_todayUploadSize / 1024 / 1024, 2) + "MB"; SetUploadButton(true); } catch (Exception ex) { ShowMessageBox("\r\n错误的文件过滤配置: " + ex.Message); } finally{} }
void _client_GetAttachmentUploadSetCompleted(object sender, GetAttachmentUploadSetCompletedEventArgs e) { try { UploadSetInfo uploadsetinfo = e.Result; if (!string.IsNullOrEmpty(uploadsetinfo.ErrMessage)) { ShowMessageBox("\r\n" + uploadsetinfo.ErrMessage); return; } if (!uploadsetinfo.CanPostAttach || uploadsetinfo.AttachSize <= 0) { SetUploadButton(false); return; } //设置最大上传参数 _maxFileSize = uploadsetinfo.MaxAttachSize; _todayAttachSize = uploadsetinfo.AttachSize; _maxAttachments = uploadsetinfo.Maxattachments < _maxAttachments ? uploadsetinfo.Maxattachments : _maxAttachments; string allAllowExtname = ""; //设置选择框参数 foreach (string extname in uploadsetinfo.AttachExtensionsNoSize.ToLower().Split(',')) { if (string.IsNullOrEmpty(_fileFilter)) { _fileFilter += extname + "Files (*." + extname + ")|*." + extname; allAllowExtname += "*." + extname ; } else { _fileFilter += "|" + extname + "Files (*." + extname + ")|*." + extname; allAllowExtname += ";*." + extname ; } } _fileFilter = "所有格式(" + allAllowExtname + ")|" + allAllowExtname + "|" + _fileFilter; Message.Text = "单个附件大小:" + Math.Round((decimal)uploadsetinfo.MaxAttachSize / 1024 / 1024, 2) + "MB\r\n"; Message.Text +="今天可上传大小:" + Math.Round((decimal)uploadsetinfo.AttachSize / 1024 / 1024, 2) + "MB\r\n"; Message.Text +="附件类型: " + uploadsetinfo.AttachExtensionsNoSize; OtherMessage.Text = "已上传大小:" + Math.Round((decimal)_todayUploadSize / 1024 / 1024, 2) + "MB"; SetUploadButton(true); } catch (Exception ex) { ShowMessageBox("\r\n错误的文件过滤配置: " + ex.Message); } finally{} }