public ConferenceAudioInitRefleshEntity GetAll(int conferenceID) { //上锁,达到线程互斥作用 lock (objGetAll) { ConferenceAudioInitRefleshEntity initRefleshEntity = new ConferenceAudioInitRefleshEntity(); try { //会议信息不为null if (conferenceID != 0) { //后续进入的成员进行一次初始化的加载 if (ConferenceDiscussInitRefleshEntity_dic.ContainsKey(conferenceID)) { //获取整个语音节点 initRefleshEntity = ConferenceDiscussInitRefleshEntity_dic[conferenceID]; } else { //若不存在,添加一个新实例(语音节点) ConferenceDiscussInitRefleshEntity_dic.Add(conferenceID, initRefleshEntity); } } } catch (Exception ex) { LogManage.WriteLog(this.GetType(), ex); } return(initRefleshEntity); } }
/// <summary> /// 信息添加辅助 /// </summary> /// <param name="conferenceName"></param> /// <param name="json"></param> /// <returns></returns> public string AddOneByJsonHelper(int conferenceID, string json, string audioUri) { string result = null; List <ConferenceAudioItemTransferEntity> conferenceAudioItemTransferEntityList = JsonToEntity <ConferenceAudioItemTransferEntity>(json); if (conferenceAudioItemTransferEntityList.Count > 0) { ConferenceAudioItemTransferEntity ConferenceAudioItem_TransferEntity = conferenceAudioItemTransferEntityList[0]; try { //当前会议为null,则不执行下列操作 if (conferenceID == 0) { return(result); } //是否包含 if (ConferenceDiscussInitRefleshEntity_dic.ContainsKey(conferenceID)) { //类型设置 ConferenceAudioItem_TransferEntity.Operation = ConferenceAudioOperationType.AddType; //个人头像 ConferenceAudioItem_TransferEntity.PersonalImg = Constant.PersonImgHttp + ConferenceAudioItem_TransferEntity.AddAuthor + ".png"; if (audioUri != null) { //信息语音地址 ConferenceAudioItem_TransferEntity.AudioUrl = audioUri; } //获取相应的语音树 ConferenceAudioInitRefleshEntity conferenceAudioInitRefleshEntity = ConferenceDiscussInitRefleshEntity_dic[conferenceID]; //guid绑定为当前rootcount ConferenceAudioItem_TransferEntity.Guid = conferenceAudioInitRefleshEntity.RootCount; //参数递增 conferenceAudioInitRefleshEntity.RootCount++; //语音节点实体集合添加子节点 conferenceAudioInitRefleshEntity.AcademicReviewItemTransferEntity_ObserList.Add(ConferenceAudioItem_TransferEntity); //实时同步 InformClient(conferenceID, ConferenceAudioItem_TransferEntity); } } catch (Exception ex) { LogManage.WriteLog(this.GetType(), ex); } finally { } } return(result); }
public int AddOne(int conferenceID, ConferenceAudioItemTransferEntity academicReviewItemTransferEntity) { //上锁,达到线程互斥作用 lock (objAdd) { int guid = -1; try { //当前会议为null,则不执行下列操作 if (conferenceID == 0) { return(guid); } //语音集实体 ConferenceAudioInitRefleshEntity audioReflesh = ConferenceDiscussInitRefleshEntity_dic[conferenceID]; //是否包含 if (ConferenceDiscussInitRefleshEntity_dic.ContainsKey(conferenceID)) { //类型设置 academicReviewItemTransferEntity.Operation = ConferenceAudioOperationType.AddType; //获取相应的语音树 ConferenceAudioInitRefleshEntity conferenceAudioInitRefleshEntity = audioReflesh; //guid绑定为当前rootcount academicReviewItemTransferEntity.Guid = conferenceAudioInitRefleshEntity.RootCount; guid = academicReviewItemTransferEntity.Guid; //参数递增 conferenceAudioInitRefleshEntity.RootCount++; //语音节点实体集合添加子节点 conferenceAudioInitRefleshEntity.AcademicReviewItemTransferEntity_ObserList.Add(academicReviewItemTransferEntity); //实时同步 InformClient(conferenceID, academicReviewItemTransferEntity); } } catch (Exception ex) { LogManage.WriteLog(this.GetType(), ex); } finally { } return(guid); } }
/// <summary> /// 获取元数据 /// </summary> /// <param name="conferenceName">会议名称</param> /// <returns>返回语音所有节点</returns> public string GetAllByMobile(string strConferenceID) { string json = null; ConferenceAudioInitRefleshEntity initRefleshEntity = null; MessageInfo mi = new MessageInfo(); mi.State = "0000"; mi.Message = ""; try { int conferenceID = 0; int.TryParse(strConferenceID, out conferenceID); if (conferenceID != 0) { initRefleshEntity = GetAll(conferenceID); if (initRefleshEntity == null) { mi.State = "0001"; mi.Message = "当前会议无信息"; } else { json = CommonMethod.Serialize(initRefleshEntity); mi.Result = json; } } } catch (Exception ex) { LogManage.WriteLog(this.GetType(), ex); } Context.Response.ContentType = "application/json"; Context.Response.Charset = Encoding.UTF8.ToString(); //设置字符集类型 Context.Response.ContentEncoding = System.Text.Encoding.UTF8; Context.Response.Write(CommonMethod.Serialize(mi)); Context.Response.End(); return(json); }
public void UpdateOne(int conferenceID, ConferenceAudioItemTransferEntity academicReviewItemTransferEntity) { //上锁,达到线程互斥作用 lock (objUpdate) { try { //会议名称为null则不执行以下操作 if (conferenceID == 0) { return; } //语音集实体 ConferenceAudioInitRefleshEntity audioReflesh = ConferenceDiscussInitRefleshEntity_dic[conferenceID]; //语音节点集合 List <ConferenceAudioItemTransferEntity> audioList = audioReflesh.AcademicReviewItemTransferEntity_ObserList; //找到对应的节点进行更改 for (int i = 0; i < audioList.Count; i++) { //获取遍历中的一个节点 var item = audioList[i]; if (item.Equals(academicReviewItemTransferEntity)) { //操作类型更改为更新 academicReviewItemTransferEntity.Operation = ConferenceAudioOperationType.UpdateType; //设置文本信息(对应的节点) audioList[i] = academicReviewItemTransferEntity; //实时同步 InformClient(conferenceID, academicReviewItemTransferEntity); break; } } } catch (Exception ex) { LogManage.WriteLog(this.GetType(), ex); } } }
public void NotifyAudioFileUploadCompleate(string conferenceName, ConferenceAudioItemTransferEntity academicReviewItemTransferEntity) { lock (objUploadCompleate) { try { //会议名称为null则不执行以下操作 if (string.IsNullOrEmpty(conferenceName)) { return; } //语音集实体 ConferenceAudioInitRefleshEntity audioReflesh = ConferenceDiscussInitRefleshEntity_dic[conferenceName]; //语音节点集合 List <ConferenceAudioItemTransferEntity> audioList = audioReflesh.AcademicReviewItemTransferEntity_ObserList; //找到对应的节点进行更改 for (int i = 0; i < audioList.Count; i++) { //获取遍历中的一个节点 var item = audioList[i]; if (item.Equals(academicReviewItemTransferEntity)) { //操作类型更改为提交完成 academicReviewItemTransferEntity.Operation = ConferenceAudioOperationType.UploadCompleateType; ////设置文本信息(对应的节点) //audioList[i] = academicReviewItemTransferEntity; //实时同步 InformClient(conferenceName, academicReviewItemTransferEntity); break; } } } catch (Exception ex) { LogManage.WriteLog(this.GetType(), ex); } } }
public void DeleteOne(int conferenceID, ConferenceAudioItemTransferEntity academicReviewItemTransferEntity) { //上锁,达到线程互斥作用 lock (objDelete) { try { //当前会议为null,则不执行下列操作 if (conferenceID == 0) { return; } //语音集实体 ConferenceAudioInitRefleshEntity audioReflesh = ConferenceDiscussInitRefleshEntity_dic[conferenceID]; //语音节点集合 List <ConferenceAudioItemTransferEntity> audioList = audioReflesh.AcademicReviewItemTransferEntity_ObserList; //判断是否包含该节点,从而进行删除操作 if (audioList.Contains(academicReviewItemTransferEntity)) { //操作类型改为删除 academicReviewItemTransferEntity.Operation = ConferenceAudioOperationType.DeleteType; //删除该子节点 audioList.Remove(academicReviewItemTransferEntity); //实时同步 InformClient(conferenceID, academicReviewItemTransferEntity); } } catch (Exception ex) { LogManage.WriteLog(this.GetType(), 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); } }