コード例 #1
0
ファイル: ProfileViewModel.cs プロジェクト: agangal/Strava
        public async void RefreshAthleteInfo()
        {
            string res = await HttpHelper.GetRequestAsync(StravaUri.BaseUri, StravaUri.AthleteResourse);

            AthleteInfo = JsonConvert.DeserializeObject <Athlete>(res);
            ShoesCollection.Clear();
            if (AthleteInfo.shoes != null && AthleteInfo.shoes.Count > 0)
            {
                foreach (var shoe in AthleteInfo.shoes)
                {
                    ShoesCollection.Add(shoe);
                }
            }
            ClubsCollection.Clear();
            if (AthleteInfo.clubs != null && AthleteInfo.clubs.Count > 0)
            {
                foreach (var club in AthleteInfo.clubs)
                {
                    ClubsCollection.Add(club);
                }
            }
            await FileHelper.WriteFile(AppConstants.ProfileFile, res);
        }
コード例 #2
0
ファイル: ProfileViewModel.cs プロジェクト: agangal/Strava
        public async void LoadAthleteInfo()
        {
            string json = await FileHelper.ReadFile(AppConstants.ProfileFile);

            AthleteInfo = JsonConvert.DeserializeObject <Athlete>(json);

            ShoesCollection.Clear();
            if (AthleteInfo.shoes != null && AthleteInfo.shoes.Count > 0)
            {
                foreach (var shoe in AthleteInfo.shoes)
                {
                    ShoesCollection.Add(shoe);
                }
            }
            ClubsCollection.Clear();
            if (AthleteInfo.clubs != null && AthleteInfo.clubs.Count > 0)
            {
                foreach (var club in AthleteInfo.clubs)
                {
                    ClubsCollection.Add(club);
                }
            }
        }