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); }
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); } } }