public void Handle(CommunityBlockChanged message) { if (message.CommunityId != this.CommunityId) { return; } Execute.ExecuteOnUIThread((Action)(() => { User loggedInUser = AppGlobalStateManager.Current.GlobalState.LoggedInUser; LinkHeader linkHeader = this.Users.Collection.FirstOrDefault <LinkHeader>((Func <LinkHeader, bool>)(u => u.Id == message.User.id)); if (!message.IsEditing && linkHeader == null) { this.Users.Insert(new LinkHeader(message.User) { Description = string.Format("{0} {1}", loggedInUser.sex != 1 ? (object)CommonResources.Photo_AddedMale : (object)CommonResources.Photo_AddedFemale, (object)loggedInUser.Name) }, 0); } else { if (linkHeader == null) { return; } linkHeader.Description = string.Format("{0} {1}", loggedInUser.sex != 1 ? (object)CommonResources.Photo_AddedMale : (object)CommonResources.Photo_AddedFemale, (object)loggedInUser.Name); if (message.IsEditing) { return; } linkHeader.User = message.User; this.Users.Delete(linkHeader); this.Users.Insert(linkHeader, 0); } })); }
public void Handle(CommunityBlockChanged message) { if (message.CommunityId != this.CommunityId || message.User.ban_info.end_date != 0) { return; } LinkHeader linkHeader1 = this.All.Collection.FirstOrDefault <LinkHeader>((Func <LinkHeader, bool>)(u => u.Id == message.User.id)); if (linkHeader1 != null) { this.All.Delete(linkHeader1); } LinkHeader linkHeader2 = this.Unsure.Collection.FirstOrDefault <LinkHeader>((Func <LinkHeader, bool>)(u => u.Id == message.User.id)); if (linkHeader2 != null) { this.Unsure.Delete(linkHeader2); } LinkHeader linkHeader3 = this.Friends.Collection.FirstOrDefault <LinkHeader>((Func <LinkHeader, bool>)(u => u.Id == message.User.id)); if (linkHeader3 != null) { this.Friends.Delete(linkHeader3); } GenericCollectionViewModel2 <VKList <User>, LinkHeader> searchViewModel = this.SearchViewModel; if ((searchViewModel != null ? searchViewModel.GroupedCollection : (ObservableCollection <Group <LinkHeader> >)null) == null || this.SearchViewModel.GroupedCollection.Count <= 1) { return; } LinkHeader linkHeader4 = this.SearchViewModel.GroupedCollection[1].FirstOrDefault <LinkHeader>((Func <LinkHeader, bool>)(u => u.Id == message.User.id)); if (linkHeader4 == null) { return; } this.SearchViewModel.GroupedCollection[1].Remove(linkHeader4); }
public void SaveChanges(NavigationService navigationService) { int reason = 0; if (this.Reason.Name == CommonResources.Group_BanReason_Spam) { reason = 1; } else if (this.Reason.Name == CommonResources.Group_BanReason_VerbalAbuse) { reason = 2; } else if (this.Reason.Name == CommonResources.Group_BanReason_StrongLanguage) { reason = 3; } else if (this.Reason.Name == CommonResources.Group_BanReason_IrrelevantMessages) { reason = 4; } this.SetInProgress(true, ""); this.IsFormEnabled = false; GroupsService current1 = GroupsService.Current; long communityId = this._communityId; long id = this._user.id; int durationUnixTime = this.DurationUnixTime; int reason1 = reason; string comment = this.Comment; bool? isCommentVisible1 = this.IsCommentVisible; bool flag1 = true; int num1 = isCommentVisible1.GetValueOrDefault() == flag1 ? (isCommentVisible1.HasValue ? 1 : 0) : 0; Action <BackendResult <int, ResultCode> > callback = (Action <BackendResult <int, ResultCode> >)(result => Execute.ExecuteOnUIThread((Action)(() => { if (result.ResultCode == ResultCode.Succeeded) { this._user.ban_info.date = Extensions.DateTimeToUnixTimestamp(DateTime.Now.ToUniversalTime(), true); this._user.ban_info.end_date = this.DurationUnixTime; this._user.ban_info.reason = reason; this._user.ban_info.comment = this.Comment; BlockInformation banInfo = this._user.ban_info; bool?isCommentVisible2 = this.IsCommentVisible; bool flag2 = true; int num2 = (isCommentVisible2.GetValueOrDefault() == flag2 ? (isCommentVisible2.HasValue ? 1 : 0) : 0) != 0 ? 1 : 0; banInfo.comment_visible = num2; this._user.ban_info.admin_id = AppGlobalStateManager.Current.LoggedInUserId; this._user.ban_info.manager = AppGlobalStateManager.Current.GlobalState.LoggedInUser; EventAggregator current2 = EventAggregator.Current; CommunityBlockChanged communityBlockChanged = new CommunityBlockChanged(); communityBlockChanged.CommunityId = this._communityId; communityBlockChanged.User = this._user; int num3 = this._manager != null ? 1 : 0; communityBlockChanged.IsEditing = num3 != 0; current2.Publish((object)communityBlockChanged); if (!this._isEditing && !this._isOpenedWithoutPicker) { navigationService.RemoveBackEntry(); } Navigator.Current.GoBack(); } else { this.SetInProgress(false, ""); this.IsFormEnabled = true; GenericInfoUC.ShowBasedOnResult((int)result.ResultCode, "", null); } }))); current1.BlockUser(communityId, id, durationUnixTime, reason1, comment, num1 != 0, callback); }