示例#1
0
        public void EditChatAdmin(TLUserBase user)
        {
            if (user == null)
            {
                return;
            }
            if (user.Index == StateService.CurrentUserId)
            {
                return;
            }
            if (!AdminsEnabled)
            {
                return;
            }

            IsWorking       = true;
            user.IsSelected = !user.IsSelected;
            Telegram.Api.Helpers.Execute.ShowDebugMessage(string.Format("messages.editChatAdmin chat_id={0} user_id={1} is_admin={2}", _currentChat.Id, user.Index, user.IsSelected));
            MTProtoService.EditChatAdminAsync(_currentChat.Id, user.ToInputUser(), new TLBool(user.IsSelected),
                                              result => Execute.BeginOnUIThread(() =>
            {
                IsWorking = false;
            }),
                                              error => Execute.BeginOnUIThread(() =>
            {
                IsWorking = false;

                Telegram.Api.Helpers.Execute.ShowDebugMessage("messages.editChatAdmin error " + error);
            }));
        }