/// <summary> /// 服务器同步删除节点 /// </summary> public void Delete_Item(ConferenceAudioItemTransferEntity academicReviewItemTransferEntity) { try { ConferenceAudioItem academicReviewItem = null; //记录所有语音研讨的记录清除指定语音节点(递减的方式) for (int i = ConferenceAudio_View.ConferenceAudioItemList.Count - 1; i > -1; i--) { academicReviewItem = ConferenceAudio_View.ConferenceAudioItemList[i]; //协议实体与当前遍历到的实体 if (academicReviewItem.ACA_Guid.Equals(academicReviewItemTransferEntity.Guid)) { //语音控件删除指定项 this.stackDiscussContent.Children.Remove(academicReviewItem); //设置当前协议实体为null ConferenceAudio_View.ConferenceAudioItemList[i].AcademicReviewItemTransferEntity = null; //记录所有语音研讨的记录删除该语音节点 ConferenceAudio_View.ConferenceAudioItemList.Remove(academicReviewItem); break; } } } catch (Exception ex) { LogManage.WriteLog(typeof(ConferenceAudio_View), ex); } }
/// <summary> /// 当前用户手动删除节点 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void DeleteDiscussInformation(ConferenceAudioItem academicReviewItem) { try { //把需要删除的语音几点交给服务器,让服务器去通知其他终端进行删除的操作 ModelManage.ConferenceAudio.Delete(Constant.ConferenceName, academicReviewItem.AcademicReviewItemTransferEntity, new Action <bool>((result) => { if (result) { //验证是否包含语音 if (!String.IsNullOrEmpty(academicReviewItem.AudioUrl)) { string url = string.Empty; //将其转为ftp的地址,才可以进行ftp的移除(将保存到服务器的语音文件进行删除) if (academicReviewItem.AudioUrl.Contains(Constant.TreeServiceAddressFront)) { //htp路径转成ftp路径 url = academicReviewItem.AudioUrl.Replace(Constant.TreeServiceAddressFront, Constant.ConferenceFtpWebAddressFront); } ThreadPool.QueueUserWorkItem((o) => { //删除子节点所包含的语音文件 FtpManage.DeleteFile(url, Constant.FtpUserName, Constant.FtpPassword); }); } } })); } catch (Exception ex) { LogManage.WriteLog(typeof(ConferenceAudio_View), ex); } }
/// <summary> /// 语音讨论删除节点 /// </summary> /// <param name="item"></param> void academicReviewItem_ItemRemoveClick(ConferenceAudioItem item) { try { this.DeleteDiscussInformation(item); } catch (Exception ex) { LogManage.WriteLog(this.GetType(), ex); } }
public static void ControlChangeDealWidthCenter(ConferenceAudioItem conferenceAudioItem, bool isReflesh) { try { AudioItemType audioItemType = default(AudioItemType); if (Constant.IsMeetingPresenter) { //是否包含音频文件 if (!string.IsNullOrEmpty(conferenceAudioItem.AudioUrl)) { audioItemType = AudioItemType.LimitHasAudio; } else { audioItemType = AudioItemType.LimitNoAudio; } } else { //是否包含音频文件 if (!string.IsNullOrEmpty(conferenceAudioItem.AudioUrl)) { audioItemType = AudioItemType.NoLimitHasAudio; } else { audioItemType = AudioItemType.NoLimitNoAudio; } } //控件调整 conferenceAudioItem.MesuareAudioItem(audioItemType, isReflesh); } catch (Exception ex) { LogManage.WriteLog(typeof(ConferenceAudio_View), ex); } finally { } }
/// <summary> /// 语音讨论播放节点 /// </summary> /// <param name="item"></param> void academicReviewItem_ItemPlayClick(ConferenceAudioItem item) { try { //如果该语音节点包含语音url,说明包含语音文件 if (!string.IsNullOrEmpty(item.AudioUrl)) { if (this.vlcPlayer == null) { string pluginPath = System.Environment.CurrentDirectory + "\\plugins\\"; this.vlcPlayer = new VlcPlayer(pluginPath); } this.vlcPlayer.PlayFile(item.AudioUrl); } else { MessageBox.Show("播放的文件不存在或无效", "操作提示", MessageBoxButton.OK, MessageBoxImage.Information); } } catch (Exception ex) { LogManage.WriteLog(this.GetType(), ex); } }
/// <summary> /// 服务器同步添加节点 /// </summary> /// <param name="academicReviewItemTransferEntity"></param> public void Add_Item(ConferenceAudioItemTransferEntity academicReviewItemTransferEntity) { try { lock (obj1) { if (!this.retunList.Contains(academicReviewItemTransferEntity.Guid)) { //添加索引 this.retunList.Add(academicReviewItemTransferEntity.Guid); //本地语音节点 ConferenceAudioItem academicReviewItem = null; //控件加载(关联)Header = academicReviewItemTransferEntity.MessageHeader, academicReviewItem = new ConferenceAudioItem() { ACA_Guid = academicReviewItemTransferEntity.Guid, Message = academicReviewItemTransferEntity.AudioMessage, AudioUrl = academicReviewItemTransferEntity.AudioUrl, PersonalImg = academicReviewItemTransferEntity.PersonalImg, PersonName = academicReviewItemTransferEntity.MessageSendName }; //如果是自己发的则在左侧(验证该子节点是否为自己所创建) if (academicReviewItemTransferEntity.AddAuthor.Equals(Constant.LoginUserName)) { //设置为左侧 academicReviewItem.HorizontalAlignment = System.Windows.HorizontalAlignment.Right; //若为自己所创建则设置为可编辑 academicReviewItem.txtAudio.IsReadOnly = false; //整体布局更改 academicReviewItem.LayoutChange(); } else { //设置为右侧 academicReviewItem.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; } //协议实体填充 academicReviewItem.AcademicReviewItemTransferEntity = academicReviewItemTransferEntity; //具体语音文本信息 academicReviewItem.AcademicReviewItemTransferEntity.AudioMessage = academicReviewItemTransferEntity.AudioMessage; //控件调整处理中心 ConferenceAudio_View.ControlChangeDealWidthCenter(academicReviewItem, false); //语音控件添加子项 this.stackDiscussContent.Children.Add(academicReviewItem); //滚动到末尾(判断是否可以执行该操作,比如正在翻页,不允许强制进行) if (ConferenceAudio_View.CanScroll) { this.AudioTextScrollView.ScrollToEnd(); } #region 注册事件 //语音讨论子节点播放事件 academicReviewItem.ItemPlayClick += academicReviewItem_ItemPlayClick; //语音讨论子节点删除事件 academicReviewItem.ItemRemoveClick += academicReviewItem_ItemRemoveClick; #endregion //根记录进行自增1(其实就是GUID唯一标识符) ConferenceAudio_View.RootCount++; //记录所有语音研讨的记录添加语音节点 ConferenceAudioItemList.Add(academicReviewItem); } } } catch (Exception ex) { LogManage.WriteLog(typeof(ConferenceAudio_View), ex); } }
/// <summary> /// 刷新语音所有节点 /// </summary> /// <param name="result"></param> void Reflesh(ConferenceAudioInitRefleshEntity result) { try { //先判断获取到的信息 if (result.AcademicReviewItemTransferEntity_ObserList != null && result.AcademicReviewItemTransferEntity_ObserList.Count() > 0) { //进行后续的关联 foreach (var transferItem in result.AcademicReviewItemTransferEntity_ObserList) { //添加索引 this.retunList.Add(transferItem.Guid); //控件加载(关联)Header = transferItem.MessageHeader, ConferenceAudioItem academicReviewItem = new ConferenceAudioItem() { Message = transferItem.AudioMessage, ACA_Guid = transferItem.Guid, AudioUrl = transferItem.AudioUrl, PersonalImg = transferItem.PersonalImg, PersonName = transferItem.MessageSendName }; //如果是自己发的则在左侧 (验证该子节点是否为自己所创建) if (transferItem.AddAuthor.Equals(Constant.LoginUserName)) { //设置为左侧 academicReviewItem.HorizontalAlignment = System.Windows.HorizontalAlignment.Right; //若为自己所创建则设置为可编辑 academicReviewItem.txtAudio.IsReadOnly = false; //整体布局更改 academicReviewItem.LayoutChange(); } else { //设置为右侧 academicReviewItem.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; } //控件调整处理中心 ConferenceAudio_View.ControlChangeDealWidthCenter(academicReviewItem, true); #region 注册事件 //研讨语音播放 academicReviewItem.ItemPlayClick += academicReviewItem_ItemPlayClick; //研讨语音移除 academicReviewItem.ItemRemoveClick += academicReviewItem_ItemRemoveClick; #endregion //设置协议实体 academicReviewItem.AcademicReviewItemTransferEntity = transferItem; //语音研讨节点集合(添加) ConferenceAudioItemList.Add(academicReviewItem); //添加到研讨语音容器里 this.stackDiscussContent.Children.Add(academicReviewItem); //添加索引 //ConferenceAudio_View.retunList.Add(academicReviewItem.ACA_Guid); } //同步到最后一个节点 this.AudioTextScrollView.ScrollToEnd(); //设置节点 ConferenceAudio_View.RootCount = result.RootCount; } } catch (Exception ex) { LogManage.WriteLog(typeof(ConferenceAudio_View), ex); } }