예제 #1
0
 public void Save(SnookerMatchScore match)
 {
     try
     {
         Score score = new Score();
         match.PostToScore(score);
         score.IsUnfinished = true;
         string json = Newtonsoft.Json.JsonConvert.SerializeObject(score);
         keyChain.Add(KeyChainName, json);
     }
     catch (Exception)
     {
     }
 }
예제 #2
0
        public void SaveToKeyChain(IKeyChain keychain)
        {
            string str = Newtonsoft.Json.JsonConvert.SerializeObject(this);

            keychain.Add("FVOConfig", str);
        }
예제 #3
0
        private async Task register(string email, string pin)
        {
            await this.openWaitPage();

            try
            {
                string password = pin;

                bool ok = await webservice.Register(email, password, null, "", null);

                //throw new Exception("test");
                if (ok == false)
                {
                    await this.closeWaitPage();

                    if (webservice.IsLastExceptionDueToInternetIssues)
                    {
                        App.Navigator.DisplayAlertError("Couldn't register. Internet issues. Are you connected to the Internet?");
                    }
                    else
                    {
                        App.Navigator.DisplayAlertError("Couldn't register. Could it be that you already have a Byb account under this email address?");
                    }
                    return;
                }

                if (!await webservice.Login(email, password, null))
                {
                    throw new Exception("Registered, but failed to login");
                }

                var myAthlete = await webservice.GetMyAthlete();

                if (myAthlete == null)
                {
                    throw new Exception("Failed to complete registration operation");
                }

                repository.DeleteAllData();
                repository.SaveSecurity(                //accessToken,
                    myAthlete.AthleteID, false, myAthlete.TimeCreated);
                repository.UpdateAthlete(myAthlete);

                keyChain.Add(email, password);

                await registerDeviceTokenIfNecessary();
            }
            catch (Exception exc)
            {
                this.Unregister(true);
                App.Navigator.DisplayAlertError("Error while registering: " + exc.Message);
            }

            await this.closeWaitPage();

            if (RegistrationStatus != RegistrationStatusEnum.Registered)
            {
                StartSetup();
            }
            else
            {
                App.Navigator.OpenProfileEditPage(false, false);
            }
        }