Esempio n. 1
0
 private void DoOnFailedLogin()
 {
     OnFailedLogin?.Invoke(this, EventArgs.Empty);
 }
Esempio n. 2
0
        public static async Task <bool> Login(string id, string pwd, OnSuccessLogin loginCallback, OnFailedLogin failedCallback)
        {
            string x = await Launcher.Authenticate(id, pwd);

            dynamic json        = Newtonsoft.Json.JsonConvert.DeserializeObject(x);
            string  accessToken = "";
            string  username    = "";
            string  Puuid       = "";

            try
            {
                accessToken = json.accessToken;
                username    = json.selectedProfile.name;
                Puuid       = json.selectedProfile.id;
                if (accessToken != null)
                {
                    if (loginCallback != null)
                    {
                        loginCallback.Invoke();
                    }
                }
                else
                {
                    if (failedCallback != null)
                    {
                        failedCallback.Invoke();
                    }
                    return(false);
                }
            }
            catch (Exception eex)
            {
                if (failedCallback != null)
                {
                    failedCallback.Invoke();
                }

                return(false);
            }
            DATA.username    = username;
            DATA.premium     = true;
            DATA.uuidPremium = Puuid;
            DATA.accessToken = accessToken;
            return(true);
        }