public ConversationInfo(bool isChat, long userOrChatId, User user, ChatExtended chat) { this.UserOrChatId = userOrChatId; this.IsChat = isChat; this.User = user; this.Chat = chat; }
private void RefreshUIPropertiesSafe() { if (this._isChat) { Deployment.Current.Dispatcher.BeginInvoke((Action)(() => { ChatExtended chatExtended = this._chat; if ((chatExtended != null ? chatExtended.users : null) == null) { return; } this.ConversationAvatarVM.Initialize(this._chat.photo_200, true, this._chat.users.Select <User, long>((Func <User, long>)(u => u.uid)).ToList <long>(), this._chat.users); })); } else { Deployment.Current.Dispatcher.BeginInvoke((Action)(() => { if (this._user == null) { return; } this.ConversationAvatarVM.Initialize(this._user.photo_max, false, new List <long>(), new List <User>()); })); } }
public void LoadHeaderInfo() { if (this._isBusyLoadingHeaderInfo) { return; } if (this._isChat) { if (this._chat == null) { this._isBusyLoadingHeaderInfo = true; BackendServices.MessagesService.GetChat(this._userOrChatId, (Action <BackendResult <ChatExtended, ResultCode> >)(res => { if (res.ResultCode == ResultCode.Succeeded) { this._chat = res.ResultData; } this.RefreshUIPropertiesSafe(); this._isBusyLoadingHeaderInfo = false; })); } else { this.RefreshUIPropertiesSafe(); } } else if (this._user == null) { this._isBusyLoadingHeaderInfo = true; UsersService instance = UsersService.Instance; List <long> userIds = new List <long>(); userIds.Add(this._userOrChatId); Action <BackendResult <List <User>, ResultCode> > callback = (Action <BackendResult <List <User>, ResultCode> >)(r => { if (r.ResultCode == ResultCode.Succeeded) { this._user = (User)Enumerable.First <User>(r.ResultData); this.RefreshUIPropertiesSafe(); UsersService.Instance.GetStatus(this._userOrChatId, (Action <BackendResult <UserStatus, ResultCode> >)(res => { if (res.ResultCode == ResultCode.Succeeded) { this.RefreshUIPropertiesSafe(); } this._isBusyLoadingHeaderInfo = false; })); } else { this._isBusyLoadingHeaderInfo = false; } }); instance.GetUsers(userIds, callback); } else { this.RefreshUIPropertiesSafe(); } }
public GraffitiDrawViewModel(long userOrChatId, bool isChat, User user = null, ChatExtended chat = null) { this.ConversationAvatarVM = new ConversationAvatarViewModel(); this._userOrChatId = userOrChatId; this._isChat = isChat; this._user = user; this._chat = chat; }
protected override void HandleOnNavigatedTo(NavigationEventArgs e) { base.HandleOnNavigatedTo(e); SystemTray.IsVisible = false; this.SubscribeToFrameReported(); AccelerometerHelper.Instance.IsActive = true; DeviceOrientationHelper.Instance.OrientationChanged += new EventHandler <DeviceOrientationChangedEventArgs>(this.OnOrientationChanged); if (!this._isInitialized) { User user = null; ChatExtended chat = null; IDictionary <string, string> queryString = base.NavigationContext.QueryString; string index1 = "UserOrChatId"; long result1; long.TryParse(queryString[index1], out result1); string index2 = "IsChat"; bool result2; bool.TryParse(queryString[index2], out result2); string index3 = "Title"; this.textBlockRecipientName.Text = (HttpUtility.UrlDecode(queryString[index3])); this.textBlockRecipientName.CorrectText(480.0 - ((FrameworkElement)this.gridRecipientAvatar).Width - 32.0 - 12.0); this.AlignRecipientInfo(); ConversationInfo parameterForIdAndReset = ParametersRepository.GetParameterForIdAndReset("ConversationInfo") as ConversationInfo; if (parameterForIdAndReset != null) { user = parameterForIdAndReset.User; chat = parameterForIdAndReset.Chat; } this._viewModel = new GraffitiDrawViewModel(result1, result2, user, chat); base.DataContext = this._viewModel; this._viewModel.LoadHeaderInfo(); this._graffitiDrawService.StrokeBrush = new SolidColorBrush(this.ucGraffitiPallete.CurrentColor); this._graffitiDrawService.StrokeThickness = this.ucBrushThickness.CurrentThickness; this.ucBrushThickness.SetFillColor(this.ucGraffitiPallete.CurrentColor); this._isInitialized = true; } this.HandleOrientationChange(DeviceOrientationHelper.Instance.CurrentOrientation); if (!base.State.ContainsKey("GraffitiPageState")) { return; } this.RestoreState(base.State["GraffitiPageState"] as GraffitiCacheData); }