private async void GetUserInfo(string accessToken)
        {
            TwitchUser user = await TwitchWrapper.Instance.GetUser(accessToken);

            ToolbarItem userButton = new ToolbarItem(user.display_name, "", Logout);
            string      name       = user.display_name;
            CCGWrapper  ccgWrapper = new CCGWrapper();

            ToolbarController.AddToolbarItem(userButton);
            Navigation.PushModalAsync(new NavigationPage(new MainPage()));
            User ccgUser;

            try
            {
                ccgUser = await ccgWrapper.GetUser(user.id, IdType.Twitch);
            }
            catch (Exception ex)
            {
                //CCG Server most likely not available
#if DEBUG
                ccgUser          = new User();
                ccgUser.Name     = "LocalDebugger";
                ccgUser.TwitchID = user.id;
#else
                //Warn the user that CCG servers could not be reached
#endif
            }

            if (ccgUser.Name == null)
            {
                int id = await ccgWrapper.CreateUser(user.id, user.display_name);
            }
        }
Beispiel #2
0
 private void HandleAuthentication(TwitchUser user)
 {
     //Silent authenticate
     MainPage = new MainPage();
     InitializeComponent();
 }