/// <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 { } }
/// <summary> /// 生成文件夹 /// </summary> /// <param name="folderList">文件夹目录</param> /// <param name="row1Height">行1高</param> /// <param name="fileHeigth">文件高</param> /// <param name="fileWidth">文件宽</param> private void DataLoad_Directory(List <SPVirtualFolder> folderList) { try { string folder_Img_Small = null; folder_Img_Small = SpaceCodeEnterEntity.folderPngUriPart_Small; string folder_Img = null; folder_Img = SpaceCodeEnterEntity.folderPngUriPart; //生成书本形式的文件夹 foreach (var folderItem in folderList) { SpaceListViewItem listViewItem = new SpaceListViewItem(folder_Img, ViewType) { Title = folderItem.Name, SpaceType = this.SpaceType, BookType = BookType.Folder, UpdateTime = folderItem.UpdateTime, Self_Folder = folderItem, SizeDisplay = "-", IsShowOperationIcon = false, ParentView = this.listView, }; this.ItemsAdd(listViewItem); listViewItem.SetSmallImg(folder_Img_Small); //创建一个面包线(目前在这里创建和根面包线【书架自带】) BreadLine breadLine = new BreadLine() { Folder = folderItem, Title = folderItem.Name }; //关联指定生成的面包线() listViewItem.BreadLine = breadLine; //面包线点击事件 breadLine.LineClickEventCallBack = breadLine_LineClickEvent; } } 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 { } }