private void RenderTable() { string strCatScore; int intCatScore; var stepsSection = new TableSection(); foreach (var s in StepNames.StepDictionary) { var currentTasksForThisStep = App.Database.GetCurrentTasksByStep(s.Key); intCatScore = StartPage.CalculateScore(currentTasksForThisStep); strCatScore = intCatScore > 0 ? string.Format("({0} points earned)", intCatScore) : string.Empty; stepsSection.Add(new TextCell { Text = s.Value, Detail = strCatScore, DetailColor = Color.Red, Command = navigateCommand, CommandParameter = s.Key, }); } ; this.Content = new TableView { Root = new TableRoot { stepsSection, }, Intent = TableIntent.Menu, }; }
private void ListSubTasks() { string detailLine; int stepTotal = 0; ts.Clear(); tableRoot.Clear(); var activityList = ActivityTable.Activities [theStep]; foreach (var act in activityList) { int subScore = StartPage.CalculateScore(App.Database.GetCurrentTasksBySubStep(act.SubStep)); stepTotal += subScore; detailLine = string.Empty; if (subScore > 0) { if (act.OneTimeOnly) { detailLine = string.Format("({0} points, 1-time only task)", subScore); } else { detailLine = string.Format("({0} points earned)", subScore); } } ts.Add(new TextCell { Text = string.Format("{0} (worth {1} points)", act.FullName, act.Score), Detail = detailLine, DetailColor = Color.Red, Command = navigateCommand, CommandParameter = act, }); } ; tableRoot.Add(ts); tableView.Root = tableRoot; if (stepTotal > 0) { lblStepTotal.Text = string.Format("{0} points earned for this step", stepTotal); } // Build the page. this.Content = new StackLayout { Children = { lblStepTotal, tableView } }; }