public async void LoadAllCachedActivities() { Items.Clear(); await Task.Delay(5000); MyListView.BackgroundColor = Color.FromHex("#ffffff"); foreach (var activity in await activityCacheHandler.FindAll()) { try { ActivitySummary activitySummary = await activitySummaryCacheHandler.Find(activity.activityId); activity.label1 = FormatterHandler.Instance.ConvertGMTToDDMMYYYY(activity.startDate); activity.label2 = "Moving Time: " + FormatterHandler.Instance.ConvertEpochTimeTohhmmssfff(Convert.ToDouble(activitySummary.movingTime)); Items.Add(activity); } catch (Exception e) { activity.label1 = activity.name; Items.Add(activity); } } MyListView.ItemsSource = Items; }
public async void LoadScreen() { DropDownBox.ItemsSource = DropDownBoxItems; this.LeaderboardData = await DataManipulatorHandler.Instance.GetDailyPeakAverages(MenuSelection, "all", Seconds); var leaderboardDataSorted = LeaderboardData.ToList(); int rank = 1; foreach (KeyValuePair <long, int> leaderboardEntry in from entry in leaderboardDataSorted orderby entry.Value descending select entry) { ActivitySummary activitySummary = await activitySummaryCacheHandler.Find(leaderboardEntry.Key); Activity activity = await activityCacheHandler.Find(leaderboardEntry.Key); string startDate = FormatterHandler.Instance.ConvertGMTToDDMMYYYY(activity.startDate); string movingtime = FormatterHandler.Instance.ConvertEpochTimeTohhmmssfff(Convert.ToDouble(activitySummary.movingTime)); Items.Add(new Activity(leaderboardEntry.Key, IconSelector(rank++), leaderboardEntry.Value.ToString() + " " + LabelHandler.Instance.GetPeaksLabel(MenuSelection), startDate + "\n" + "Moving Time: " + movingtime)); } Loading_Icon.IsVisible = false; Loading_Icon.IsPlaying = false; Loading_Icon.IsEnabled = false; LeaderboardListView.ItemsSource = Items; }