/// <summary> /// 生成文件(realDisplay) /// </summary> /// <param name="folderList">文件夹目录</param> /// <param name="row1Height">行1高</param> /// <param name="fileHeigth">文件高</param> /// <param name="fileWidth">文件宽</param> private void DataLoad_File(List <SPVirtualFile> fileList) { try { //文件类型 fileType file_Type = default(fileType); //生成文件(根据文件类型去匹配) foreach (var item in fileList) { if (item.Name.Contains(".")) { //文件类型 string extention = IOPath.GetExtension(item.Name); //去掉点 extention = extention.Replace(".", string.Empty); //文件名称 string fileName = IOPath.GetFileNameWithoutExtension(item.Name); //转换为枚举 Enum.TryParse(extention, true, out file_Type); //图片 string imageUri = null; imageUri = SpaceCodeEnterEntity.extetionImageFolderName + extention + SpaceCodeEnterEntity.pictureExtension; string imageUri_Small = null; imageUri_Small = SpaceCodeEnterEntity.extetionImageFolderName_Small + extention + SpaceCodeEnterEntity.pictureExtension; SpaceListViewItem listViewItem = new SpaceListViewItem(imageUri, ViewType) { Title = fileName, SpaceType = this.SpaceType, UpdateTime = item.UpdateTime, BookType = BookType.File, FileType = file_Type, Self_File = item, ParentView = this.listView, }; listViewItem.SetSmallImg(imageUri_Small); listViewItem.SizeDisplay = FileManage.GetFileSize_MB_KB_Display(item.Length);; //添加书 this.ItemsAdd(listViewItem); } } } catch (Exception ex) { LogManage.WriteLog(this.GetType(), ex); } finally { } }
protected void Resource_Upload(Action beginCallBack, Action <string, int, string> compleateCallBack) { try { if (this.currentBreadLine != null && this.currentBreadLine.Folder != null) { //使用打开对话框 System.Windows.Forms.OpenFileDialog dialog = new System.Windows.Forms.OpenFileDialog(); dialog.Multiselect = true; //点击确定 if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { if (dialog.FileNames.Count() > 0) { MainWindow._MainWindow.BeginUploadCallBack = beginCallBack; MainWindow._MainWindow.AllUploadCompleateCallBack = compleateCallBack; MainWindow._MainWindow.Upload_Title_Tip = "文件上传"; MainWindow._MainWindow.Open_Upload_View(); foreach (var item in dialog.FileNames) { FileInfo fileInfo = new FileInfo(item); FileUploadItem entity = new FileUploadItem() { AllSize = fileInfo.Length, FolderID = currentBreadLine.Folder.ID, File_Size = FileManage.GetFileSize_MB_KB_Display(fileInfo.Length), FileName = fileInfo.Name, FilePath = item, Style = MainWindow.Upload_Item_Style, }; MainWindow._MainWindow.UploadItems_Add(entity); } MainWindow._MainWindow.Begin_Resource_Upload(); } } } } catch (Exception ex) { LogManage.WriteLog(this.GetType(), ex); } finally { } }
protected void Resource_Upload(List <string> filesList, Action beginCallBack, Action <string, int, string> compleateCallBack) { try { if (this.currentBreadLine != null && this.currentBreadLine.Folder != null) { MainWindow._MainWindow.BeginUploadCallBack = beginCallBack; MainWindow._MainWindow.AllUploadCompleateCallBack = compleateCallBack; MainWindow._MainWindow.Upload_Title_Tip = "文件上传"; MainWindow._MainWindow.Open_Upload_View(); foreach (var item in filesList) { FileInfo fileInfo = new FileInfo(item); FileUploadItem entity = new FileUploadItem() { AllSize = fileInfo.Length, FolderID = currentBreadLine.Folder.ID, File_Size = FileManage.GetFileSize_MB_KB_Display(fileInfo.Length), FileName = fileInfo.Name, FilePath = item, Style = MainWindow.Upload_Item_Style, }; MainWindow._MainWindow.UploadItems_Add(entity); } MainWindow._MainWindow.Begin_Resource_Upload(); } } catch (Exception ex) { LogManage.WriteLog(this.GetType(), ex); } finally { } }
/// <summary> /// 生成文件 /// </summary> private void DataLoad_File(SPItemEntity sPVirtualFile) { try { //等待提示 //this.ShowTip(); SPVirtualFile file = new SPVirtualFile() { ID = Convert.ToInt32(sPVirtualFile.ID), Name = sPVirtualFile.LinkFilename, }; long length; bool isSuccessed = long.TryParse(sPVirtualFile.FileSizeDisplay, out length); if (isSuccessed) { file.Length = length; } //文件类型 fileType file_Type = default(fileType); if (file.Name.Contains(".")) { //文件类型 string extention = IOPath.GetExtension(file.Name); //去掉点 extention = extention.Replace(".", string.Empty); //文件名称 string fileName = IOPath.GetFileNameWithoutExtension(file.Name); //转换为枚举 Enum.TryParse(extention, true, out file_Type); //图片 string imageUri = null; imageUri = SpaceCodeEnterEntity.extetionImageFolderName + extention + SpaceCodeEnterEntity.pictureExtension; string imageUri_Small = null; imageUri_Small = SpaceCodeEnterEntity.extetionImageFolderName_Small + extention + SpaceCodeEnterEntity.pictureExtension; SpaceListViewItem listViewItem = new SpaceListViewItem(imageUri, ViewType) { Title = fileName, SpaceType = this.SpaceType, BookType = BookType.File, FileType = file_Type, Self_File = file, ParentView = this.listView, }; listViewItem.SetSmallImg(imageUri_Small); listViewItem.SizeDisplay = FileManage.GetFileSize_MB_KB_Display(file.Length); DateTime dateTime; bool isSuccessed_1 = DateTime.TryParse(sPVirtualFile.Modified, out dateTime); if (isSuccessed_1) { listViewItem.UpdateTime = dateTime; } //添加书 this.ItemsAdd(listViewItem); } } catch (Exception ex) { LogManage.WriteLog(this.GetType(), ex); } finally { } }