/// <summary> /// 根据文件的类型使用相应的方式打开 /// </summary> public void FileOpenByExtension(wpfHelperFileType fileType, string uri) { try { //保存当前打开的文件地址 TreeCodeEnterEntity.currentFileUri = uri; //设置当前文件类型 TreeCodeEnterEntity.currentFileType = fileType; if (TreeCodeEnterEntity.Tree_LeftContentType == Common.Tree_LeftContentType.OfficeFile) { if (this.officeFile == null) { this.officeFile = new OfficeFile(); } this.borLeftMain.Child = this.officeFile; } //根据文件的类型使用相应的方式打开 TreeCodeEnterEntity.fileOpenManage.FileOpenByExtension(fileType, uri); } catch (Exception ex) { LogManage.WriteLog(this.GetType(), ex); } }
/// <summary> /// 文件推送 /// </summary> /// <param name="uri">文件地址</param> /// <param name="fileType">文件类型</param> public void ucBook_SendFile(string uri, fileType fileType) { try { //使用前先判断 if (SpaceCodeEnterEntity.ConferenceName != null) { if (this.SendFileCallBack != null) { this.SendFileCallBack(uri, fileType); } //填充word服务缓存数据 //ModelManage.ConferenceWordAsync.FillConferenceOfficeServiceData(SpaceCodeEnterEntity.ConferenceName, SpaceCodeEnterEntity.SelfName, uri, (ConferenceModel.ConferenceSpaceAsyncWebservice.FileType)fileType, new Action<bool>((isSuccessed) => //{ //})); } else { MessageBox.Show("共享之前先进入一个会议", "操作提示", MessageBoxButton.OK, MessageBoxImage.Information); } } catch (Exception ex) { LogManage.WriteLog(this.GetType(), ex); } }
/// <summary> /// 生成文件 /// </summary> /// <param name="folderList">文件夹目录</param> /// <param name="row1Height">行1高</param> /// <param name="fileHeigth">文件高</param> /// <param name="fileWidth">文件宽</param> private void DataLoad_File(List <SP.File> fileList, double row1Height, double fileHeigth, double fileWidth) { try { //生成文件(根据文件类型去匹配) foreach (var item in fileList) { if (item.Name.Contains(".")) { //文件类型 var extention = System.IO.Path.GetExtension(item.ServerRelativeUrl); //文件名称 var fileName = System.IO.Path.GetFileNameWithoutExtension(item.ServerRelativeUrl); //去掉点 extention = extention.Replace(".", string.Empty); //文件类型 fileType fileType = default(fileType); //转换为枚举 Enum.TryParse(extention, true, out fileType); //图片 string imageUri = "/" + this.extetionImageFolderName + "/" + extention + ".png"; //文件具体地址 string uri = SpaceCodeEnterEntity.SPSiteAddressFront + item.ServerRelativeUrl; //生成书 UCBook ucBook = new UCBook(fileName, imageUri) { BookType = BookType.File, Uri = uri, FileType = fileType, Width = fileWidth, Height = fileHeigth, Row1Height = row1Height }; //添加书 this.Items_Add(ucBook); //删除文件 ucBook.FileDeleteCallBack = ucBook_DeleteFile; //下载文件 ucBook.FileDownLoadCallBack = ucBook_DownLoadFile; //推送文件 ucBook.FileSendCallBack = ucBook_SendFile; //实时共享 ucBook.FileShareCallBack = ucBook_RealShareFile; } } } catch (Exception ex) { LogManage.WriteLog(this.GetType(), ex); } finally { } }
/// <summary> /// 实时共享 /// </summary> /// <param name="uri"></param> /// <param name="fileType"></param> void ucBook_RealShareFile(string uri, fileType fileType) { try { if (ShareInConversationSelfNavicateCallBack != null) { this.ShareInConversationSelfNavicateCallBack(new Action <bool>((canSharing) => { if (canSharing) { //获取文件名称(包含扩展名称) var fileName = System.IO.Path.GetFileName(uri); ////获取文件名称(不包含扩展名称) //var fileNameWithoutExtension = System.IO.Path.GetFileNameWithoutExtension(uri); //if (fileType == fileType.one) //{ // fileNameWithoutExtension = this.OneNoteFuzzy; //} //本地地址 var loaclF = SpaceCodeEnterEntity.LocalTempRoot + "\\" + fileName; //创建一个下载管理实例 WebClientManage webClientManage = new WebClientManage(); webClientManage.FileDown(uri, loaclF, SpaceCodeEnterEntity.LoginUserName, SpaceCodeEnterEntity.WebLoginPassword, SpaceCodeEnterEntity.UserDomain, new Action <int>((intProcess) => { }), new Action <Exception, bool>((ex, IsSuccessed) => { if (IsSuccessed) { if (this.FileShareCallBack != null) { this.FileShareCallBack(loaclF, fileType); } } })); } else { MessageBox.Show("共享之前请先选择一个会话", "操作提示", MessageBoxButton.OK, MessageBoxImage.Information); } })); } } catch (Exception ex) { LogManage.WriteLog(this.GetType(), ex); } }