Example #1
0
        public void AddMember(User user)
        {
            this.IsMemberAdding = true;
            this.SetInProgress(true, "");
            IChatService chatService = BackendServices.ChatService;
            long         chatId      = this._chatId;
            List <long>  userIds     = new List <long>();

            userIds.Add(user.id);
            Action <BackendResult <VKClient.Common.Backend.DataObjects.ResponseWithId, ResultCode> > callback = (Action <BackendResult <VKClient.Common.Backend.DataObjects.ResponseWithId, ResultCode> >)(result => Execute.ExecuteOnUIThread((Action)(() =>
            {
                if (result.ResultCode == ResultCode.Succeeded)
                {
                    User loggedInUser = AppGlobalStateManager.Current.GlobalState.LoggedInUser;
                    this.Members.Add(new ChatMember(new ChatUser(user, loggedInUser.id), loggedInUser, long.Parse(this._chatInformation.chat.admin_id)));
                }
                else
                {
                    GenericInfoUC.ShowBasedOnResult(result.ResultCode, "", (VKRequestsDispatcher.Error)null);
                }
                this.SetInProgress(false, "");
                this.IsMemberAdding = false;
            })));

            chatService.AddChatUsers(chatId, userIds, callback);
        }