Пример #1
0
        /// <summary>
        /// 实例化一个文件上传的窗口
        /// </summary>
        /// <param name="factory">第一大类</param>
        /// <param name="group">第二大类</param>
        /// <param name="id">第三大类</param>
        public FormSimplyFileUpload(string factory, string group, string id)
        {
            InitializeComponent();

            Icon       = UserClient.GetFormWindowIcon();
            fileItem   = new GroupFileItem();
            fileClient = UserClient.Net_File_Client;
            Factory    = factory;
            Group      = group;
            Id         = id;
        }
Пример #2
0
 private bool DeleteCheck(GroupFileItem item)
 {
     if (item.Owner != UserClient.UserAccount.UserName)
     {
         MessageBox.Show("无法删除不是自己上传的文件。");
         return(false);
     }
     else
     {
         return(MessageBox.Show("请确认是否真的删除?", "删除确认", MessageBoxButton.YesNo) == MessageBoxResult.Yes);
     }
 }
Пример #3
0
        /// <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;                 // 一般都是允许下载,如果不允许下载,在此处设置
        }