Skip to content
This repository has been archived by the owner on Apr 19, 2024. It is now read-only.

Как получить id пользователя, за которого авторизовался? #23

Open
alk120ger opened this issue Jul 28, 2016 · 1 comment

Comments

@alk120ger
Copy link

Подключил sdk windows phone к проекту.
private List _scope = new List { VKScope.STATUS };

    public testpage()
    {
        this.InitializeComponent();
        this.navigationHelper = new NavigationHelper(this);
        this.navigationHelper.LoadState += this.NavigationHelper_LoadState;
        this.navigationHelper.SaveState += this.NavigationHelper_SaveState;
        VKSDK.Initialize("*****");
        VKSDK.WakeUpSession();
        VKSDK.Authorize(_scope, false, false, LoginType.VKApp);

    }

Как мне получить в дальнейшем после авторизации id пользователя за которого зашел?

@ValeraVegas
Copy link

ValeraVegas commented Aug 5, 2016

Я получил так...

        public static string UserName;
        public static BitmapImage bitmap;
        public static long UserID;

        public static void UserInfo()
        {
            VKRequest.Dispatch<List<VKUser>>(
                new VKRequestParameters(
                    "users.get",
                    "fields", "photo_400_orig, city, country"),
                (res) =>
                {
                    if (res.ResultCode == VKResultCode.Succeeded)
                    {
                        VKExecute.ExecuteOnUIThread(() =>
                        {
                            var user = res.Data[0];
                            bitmap = new BitmapImage(new Uri(user.photo_400_orig, UriKind.Absolute));

                            UserName = user.first_name + " " + user.last_name;

                            UserID = user.id;
                        });
                    }
                });
        }

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants