private void DrawFamilyDetails() { var familyLineage = new FamilyLineage(TaskRunner.GARun.Population); UpdateFamily(Controls.Family1Lbl, Controls.Family1ProgressBar, 0, familyLineage); UpdateFamily(Controls.Family2Lbl, Controls.Family2ProgressBar, 1, familyLineage); UpdateFamily(Controls.Family3Lbl, Controls.Family3ProgressBar, 2, familyLineage); UpdateFamily(Controls.Family4Lbl, Controls.Family4ProgressBar, 3, familyLineage); UpdateFamily(Controls.Family5Lbl, Controls.Family5ProgressBar, 4, familyLineage); }
private void UpdateFamily(Label familyLabel, ProgressBar progressBar, int familyRanking, FamilyLineage lineageDetails) { var familyName = ""; var percentage = 0.0; if (lineageDetails.GetRankingCount() > familyRanking) { var family = lineageDetails.GetFamilyAtRanking(familyRanking); familyName = family.ToString(); var count = lineageDetails.GetCountOfFamilyAtRanking(familyRanking); percentage = (100.0 * count) / (lineageDetails.TotalLineages); } UIUpdater.SetText(Form, familyLabel, familyName); UIUpdater.SetProgressBar(Form, progressBar, percentage); }