/// <summary> /// 设置文件数据 /// </summary> /// <param name="file">文件的信息对象</param> /// <param name="deleteEnable">删除控件的使能委托</param> /// <exception cref="ArgumentNullException">file参数不能为空</exception> public void SetFile(GroupFileItem file, Func <bool> deleteEnable) { fileItem = file; // 设置文件的图标 pictureBox_file.Image = FileSupport.GetFileIcon(file.FileName); label_file_name.Text = "文件名称:" + file.FileName; label_file_size.Text = "大小:" + file.GetTextFromFileSize(); label_file_date.Text = "日期:" + file.UploadTime.ToString("yyyy-MM-dd"); label_file_mark.Text = "文件备注:" + file.Description; label_upload_name.Text = "上传人:" + file.Owner; label_download_times.Text = "下载数:" + file.DownloadTimes; linkLabel_delete.Enabled = deleteEnable.Invoke(); linkLabel_download.Enabled = true; // 一般都是允许下载,如果不允许下载,在此处设置 }
/// <summary> /// 设置文件数据 /// </summary> /// <param name="file">文件的信息对象</param> /// <param name="deleteEnable">删除控件的使能委托</param> /// <exception cref="ArgumentNullException">file参数不能为空</exception> public void SetFile(GroupFileItem file, Func <bool> deleteEnable) { fileItem = file; // 设置文件图标 FileIcon.Source = BitmapToBitmapImage(FileSupport.GetFileIcon(file.FileName)); FileName.Text = "文件名称:" + file.FileName; FileSize.Text = "大小:" + file.GetTextFromFileSize(); FileDate.Text = "日期:" + file.UploadTime.ToString("yyyy-MM-dd"); FileDescription.Text = "文件备注:" + file.Description; FilePeople.Text = "上传人:" + file.Owner; FileDownloadTimes.Text = "下载数:" + file.DownloadTimes; FileDeleteButton.IsEnabled = deleteEnable.Invoke(); FileDownloadButton.IsEnabled = true; // 一般都是允许下载,如果不允许下载,在此处设置 }