예제 #1
0
        protected override void GetGui()
        {
            bool enabled = GUI.enabled;

            if (this.Button("VK.Init"))
            {
                try
                {
                    VKSDK.Init(OnInitComplete);
                    this.Status = "VK.Init() called with " + VKSDK.AppId;
                }
                catch (Exception exc)
                {
                    Status = "VK.Init faled: " + exc.Message;
                }

                VKSDK.OnAccessTokenChanged = (at) =>
                {
                    this.Status += Environment.NewLine + " AccessToken changed!";
                };
            }

            GUI.enabled = enabled && VKSDK.IsInitialized;
            if (this.Button("Login"))
            {
                this.CallLogin();
                this.Status = "Login called";
            }

            GUI.enabled = enabled && VKSDK.IsLoggedIn;
            if (this.Button("Logout"))
            {
                CallLogout();
                Status = "Logout called";
            }

            GUI.enabled = enabled && VKSDK.IsLoggedIn;
            if (this.Button("API call (user.get)"))
            {
                CallApi();
                Status = "API.user.get is called";
            }

            if (Button("API call (friends.get)"))
            {
                CallGetFriends();
                Status = "API.friends.get is called";
            }

            if (Button("Test validation"))
            {
                TestValidation();
                Status = "API.account.testValidation is called";
            }

            GUI.enabled = enabled;
        }