Exemplo n.º 1
0
        async Task GetUserInfo(VKUserModel vkUserModel)
        {
            var request  = VKApi.Users.Get(VKParameters.From(VKApiConst.Fields, @"photo_400_orig"));
            var response = await request.ExecuteAsync();

            var jsonArray = response.Json.OptJSONArray(@"response");
            var account   = jsonArray?.GetJSONObject(0);

            vkUserModel.Name = account.OptString(@"first_name") + " " + account.OptString(@"last_name");
            if (!string.IsNullOrEmpty(account.OptString(@"photo_400_orig")))
            {
                vkUserModel.Picture = new Uri(account.OptString(@"photo_400_orig"));
            }
        }
        async Task GetUserInfo()
        {
            var request  = VKApi.Users.Get(VKParameters.From(VKApiConst.Fields, @"photo_400_orig,"));
            var response = await request.ExecuteAsync();

            var jsonArray = response.Json.OptJSONArray(@"response");
            var account   = jsonArray?.GetJSONObject(0);

            if (account != null && _loginResult != null)
            {
                _loginResult.FirstName  = account.OptString(@"first_name");
                _loginResult.LastName   = account.OptString(@"last_name");
                _loginResult.ImageUrl   = account.OptString(@"photo_400_orig");
                _loginResult.LoginState = LoginState.Success;
                SetResult(_loginResult);
            }
            else
            {
                SetErrorResult(@"Unable to complete the request of user info");
            }
        }
Exemplo n.º 3
0
            private void GetWallPost(object sender, EventArgs e)
            {
                var request = VKApi.Wall.GetById(VKParameters.From(VKApiConst.Posts, WallPostId));

                StartApiCall(request);
            }