protected override void OnCreate(Bundle savedInstance) { base.OnCreate(savedInstance); SetContentView(R.Layouts.TopPilotsActivity_Layout); this.ActionBar.NavigationMode = ActionBar.NAVIGATION_MODE_TABS; this.ActionBar.SetDisplayHomeAsUpEnabled(true); confluxKillsAdapter = CreateTab("Conflux Kills"); pilotKillsAdapter = CreateTab("Pilot Kills"); deathsAdapter = CreateTab("Deaths"); creditsAdapter = CreateTab("Credits"); missionsAdapter = CreateTab("Missions Completed"); dutyHoursAdapter = CreateTab("Duty Hours"); experienceAdapter = CreateTab("Experience"); var pilotStats = LastNonConfigurationInstance as PilotStats; if (pilotStats != null) { PopulatePilotStats(pilotStats); _savedInstance = pilotStats; } else { RefreshPilotStats(); } }
void PopulatePilotStats(PilotStats pilotStats) { confluxKillsAdapter.Update(pilotStats.FluxKills); pilotKillsAdapter.Update(pilotStats.PilotKills); deathsAdapter.Update(pilotStats.Deaths); creditsAdapter.Update(pilotStats.Credits); missionsAdapter.Update(pilotStats.MissionsCompleted); dutyHoursAdapter.Update(pilotStats.DutyHours); experienceAdapter.Update(pilotStats.Experience); if (pd != null) { pd.Dismiss(); } }
void ParsePilotStats(string httpRes) { var xml = XDocument.Parse(httpRes); { XElement root = xml.Root; PilotStats stats = new PilotStats(); stats.FluxKills = ParseStatList(root.Element("conflux_leaderboard")); stats.PilotKills = ParseStatList(root.Element("pilotskilled_leaderboard")); stats.Deaths = ParseStatList(root.Element("deaths_leaderboard")); stats.Credits = ParseStatList(root.Element("credits_leaderboard")); stats.MissionsCompleted = ParseStatList(root.Element("missionscompleted_leaderboard")); stats.DutyHours = ParseStatList(root.Element("dutyhours_leaderboard")); stats.Experience = ParseStatList(root.Element("experience_leaderboard")); _savedInstance = stats; } RunOnUiThread(() => { PopulatePilotStats(_savedInstance); }); }