public PictureViewerViewModel(string filePath, GlobalVariable.BurnFlag flag, string index, List <AddImgUrlDto> imgUrl) { _isNoSend = false; this._imgUrl = imgUrl; imagePath = filePath; IsBurn = flag; _currentIndex = ImgUrl.FindIndex(v => v.ChatIndex == index); _oldIndex = _currentIndex; if (ImgUrl.Count > _currentIndex) { this._chatIndex = ImgUrl[_currentIndex].ChatIndex; } SetButtonVisibility(); if (IsBurn == GlobalVariable.BurnFlag.IsBurn) { ContextMenuVisibility = Visibility.Collapsed; BorderVisibility = Visibility.Collapsed; } LogHelper.WriteDebug("图片查看器图片路径:" + filePath); }
/// <summary> /// 初始化用户信息 /// 多人 /// </summary> /// <param name="id"></param> /// <param name="isBurn"></param> public void InitUserInfo(string id, GlobalVariable.BurnFlag isBurn) { targetId = id; ATVisibility = Visibility.Visible; if (id == AntSdkService.AntSdkLoginOutput.userId) { ATVisibility = Visibility.Collapsed; SendVisibility = Visibility.Collapsed; if (!string.IsNullOrEmpty(AntSdkService.AntSdkCurrentUserInfo.userNum)) { UserName = AntSdkService.AntSdkCurrentUserInfo.userNum + AntSdkService.AntSdkCurrentUserInfo.userName; } else { UserName = AntSdkService.AntSdkCurrentUserInfo.userName; } if (string.IsNullOrEmpty(AntSdkService.AntSdkCurrentUserInfo.picture)) { SetPicture("pack://application:,,,/AntennaChat;Component/Images/198-头像.png"); } else { SetPicture(AntSdkService.AntSdkCurrentUserInfo.picture); } Signature = !string.IsNullOrEmpty(AntSdkService.AntSdkCurrentUserInfo.signature) ? AntSdkService.AntSdkCurrentUserInfo.signature : "这个人很懒,什么都没留下"; DepartName = AntSdkService.AntSdkCurrentUserInfo.departName; Position = AntSdkService.AntSdkCurrentUserInfo.position; Phone = AntSdkService.AntSdkCurrentUserInfo.phone; Email = AntSdkService.AntSdkCurrentUserInfo.email; } else { QueryUserInfo(id); } if (isBurn == GlobalVariable.BurnFlag.IsBurn) { ATVisibility = Visibility.Collapsed; } }
/// <summary> /// 多人 /// </summary> /// <param name="id"></param> /// <param name="isBurn"></param> public UserInfoViewModel(string id, GlobalVariable.BurnFlag isBurn) { targetId = id; InitUserInfo(id, isBurn); }
/// <summary> /// 讨论组聊天消息 /// </summary> public SessionInfoViewModel(AntSdkGroupInfo groupInfo, BurnFlag isBurnMode, List <AntSdkGroupMember> groupMembers, SessionInfoModel model) { this.IsBurnMode = isBurnMode; this.ImageBurnVisibility = isBurnMode == BurnFlag.IsBurn ? Visibility.Visible : Visibility.Collapsed; _SessionType = SessionType.GroupChat; IsGroup = true; this.GroupInfo = groupInfo; if (groupInfo.state == (int)GlobalVariable.MsgRemind.NoRemind) { MessageNoticeIsChecked = false; MessageHideIsChecked = true; ImageNoRemindVisibility = Visibility.Visible; } else { MessageNoticeIsChecked = true; MessageHideIsChecked = false; ImageNoRemindVisibility = Visibility.Collapsed; } if (groupInfo.groupOwnerId == AntSdkService.AntSdkCurrentUserInfo.userId) { DeleteGroupVisibility = Visibility.Visible; } if (groupMembers != null && groupMembers.Any()) { this.GroupMembers = groupMembers; } else { System.Diagnostics.Stopwatch stopWatch = new System.Diagnostics.Stopwatch(); stopWatch.Start(); //AsyncHandler.Call(Application.Current.Dispatcher, () => //{ // this.GroupMembers = GetMembers(); //},DispatcherPriority.Background); stopWatch.Stop(); LogHelper.WriteDebug(string.Format("[SessionInfoViewModel_GetMembers({0}毫秒)]", stopWatch.Elapsed.TotalMilliseconds)); } this.SessionId = model.SessionId; //if (!string.IsNullOrWhiteSpace(model.photo)) //{ // this.Photo = model.photo; //} //else //{ // this.Photo = "pack://application:,,,/AntennaChat;Component/Images/44-头像.png"; //} SetContactPhoto(true); this.Name = model.name; this.LastMessage = model.lastMessage; this.LastChatIndex = model.lastChatIndex; this.TopIndex = model.topIndex; SetUnreadCount(model.unreadCount); if (string.IsNullOrWhiteSpace(model.lastTime)) { this.LastTime = string.Empty; } else { try { this.LastTime = DataConverter.FormatTimeByTimeStamp(model.lastTime);//从消息来的为时间戳 this.LastMsgTimeStamp = model.lastTime; } catch { //this.LastTime = model.lastTime;//从Sqlite来的为时间格式 } } }