/// <summary>
 /// 音频文件上传完成通知
 /// </summary>
 /// <param name="academicReviewItemTransferEntity"></param>
 public void NotifyUploadCompleate(ConferenceAudioItemTransferEntity academicReviewItemTransferEntity)
 {
     try
     {
         //遍历语音节点
         foreach (var item in ConferenceAudioItemList)
         {
             //对应相应GUID
             if (item.ACA_Guid.Equals(academicReviewItemTransferEntity.Guid))
             {
                 //控件调整处理中心
                 ConferenceAudio_View.ControlChangeDealWidthCenter(item, true);
                 break;
             }
         }
     }
     catch (Exception ex)
     {
         LogManage.WriteLog(this.GetType(), 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);
            }
        }
Exemplo n.º 3
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);
            }
        }