/// <summary>
 /// 服务器同步删除节点
 /// </summary>
 /// <param name="academicReviewItemTransferEntity">语音信息协议实体</param>
 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="item"></param>
 void academicReviewItem_ItemPlayClick(ConferenceAudioItem item)
 {
     try
     {
         //如果该语音节点包含语音url,说明包含语音文件
         if (!string.IsNullOrEmpty(item.AudioUrl))
         {
             if (this.vlcPlayer == null)
             {
                 //给vlc指定组件路径
                 string pluginPath = System.Environment.CurrentDirectory + "\\plugins\\";
                 //初始化vlc播放器
                 this.vlcPlayer = new VlcPlayer(pluginPath);
             }
             //vlc播放器播放音频文件
             this.vlcPlayer.PlayFile(item.AudioUrl);
         }
         else
         {
             MessageBox.Show("播放的文件不存在或无效", "操作提示", MessageBoxButton.OK, MessageBoxImage.Information);
         }
     }
     catch (Exception ex)
     {
         LogManage.WriteLog(this.GetType(), ex);
     }
 }
 /// <summary>
 /// 当前用户手动删除节点
 /// </summary>
 /// <param name="academicReviewItem">语音实体</param>
 public void DeleteDiscussInformation(ConferenceAudioItem academicReviewItem)
 {
     try
     {
         //把需要删除的语音几点交给服务器,让服务器去通知其他终端进行删除的操作
         ModelManage.ConferenceAudio.Delete(IMMCodeEnterEntity.ConferenceName, academicReviewItem.AcademicReviewItemTransferEntity, new Action <bool>((result) =>
         {
             if (result)
             {
                 //验证是否包含语音
                 if (!String.IsNullOrEmpty(academicReviewItem.AudioUrl))
                 {
                     string url = string.Empty;
                     //将其转为ftp的地址,才可以进行ftp的移除(将保存到服务器的语音文件进行删除)
                     if (academicReviewItem.AudioUrl.Contains(IMMCodeEnterEntity.TreeServiceAddressFront))
                     {
                         //htp路径转成ftp路径
                         url = academicReviewItem.AudioUrl.Replace(IMMCodeEnterEntity.TreeServiceAddressFront, IMMCodeEnterEntity.ConferenceFtpWebAddressFront);
                     }
                     ThreadPool.QueueUserWorkItem((o) =>
                     {
                         //删除子节点所包含的语音文件
                         FtpManage.DeleteFile(url, IMMCodeEnterEntity.FtpUserName, IMMCodeEnterEntity.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);
     }
 }
Esempio n. 5
0
        /// <summary>
        /// 控件调整处理中心
        /// </summary>
        /// <param name="conferenceAudioItem">语音信息子项</param>
        /// <param name="isReflesh">是否进行更新</param>
        public static void ControlChangeDealWidthCenter(ConferenceAudioItem conferenceAudioItem, bool isReflesh)
        {
            try
            {
                //语音信息类型
                AudioItemType audioItemType = default(AudioItemType);
                //是否为主持人
                if (IMMCodeEnterEntity.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="academicReviewItemTransferEntity">语音协议实体</param>
        public void Add_Item(ConferenceAudioItemTransferEntity academicReviewItemTransferEntity)
        {
            try
            {
                lock (ItemAddObject)
                {
                    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(IMMCodeEnterEntity.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);
            }
        }
Esempio n. 7
0
        /// <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(IMMCodeEnterEntity.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);
            }
        }