Exemple #1
0
        private void UpdateTable()
        {
            _tableView.ClearAll();

            // Display summary info
            _tableView.AddDescriptionCell("Edit grade options for this class.");

            _tableView.StartNewGroup();

            // Add items
            _tableView.AddValueCell(PowerPlannerResources.GetString("ClassPage_TextBoxEditCredits.Header"),
                                    bindingHost: m_classBindingHost,
                                    bindingValuePropertyName: nameof(ViewModel.Class.Credits),
                                    converter: ConvertCreditsToString,
                                    invokeAction: ViewModel.ConfigureCredits);

            _tableView.AddCell(PowerPlannerResources.GetString("ConfigureClassGrades_Items_WeightCategories.Title"), ViewModel.ConfigureWeightCategories);

            _tableView.AddValueCell(PowerPlannerResources.GetString("Settings_GradeOptions_ListItemGpaType.Title"),
                                    bindingHost: m_classBindingHost,
                                    bindingValuePropertyName: nameof(ViewModel.Class.GpaType),
                                    converter: ConvertGpaTypeToString,
                                    invokeAction: ViewModel.ConfigureGpaType);

            if (ViewModel.Class.GpaType == PowerPlannerSending.GpaType.PassFail)
            {
                _tableView.AddValueCell(PowerPlannerResources.GetString("Settings_GradeOptions_ListItemPassingGrade.Title"),
                                        bindingHost: m_classBindingHost,
                                        bindingValuePropertyName: nameof(ViewModel.Class.PassingGrade),
                                        converter: (val) => { return(((double)val).ToString("0.##%")); },
                                        invokeAction: ViewModel.ConfigurePassingGrade);
            }
            else
            {
                _tableView.AddCell(PowerPlannerResources.GetString("ConfigureClassGrades_Items_GradeScale.Title"), ViewModel.ConfigureGradeScale);
            }

            _tableView.AddValueCell(PowerPlannerResources.GetString("ClassPage_TextBlockAverageGradesHelpHeader.Text"),
                                    bindingHost: m_classBindingHost,
                                    bindingValuePropertyName: nameof(ViewModel.Class.ShouldAverageGradeTotals),
                                    converter: ConvertBooleanToYesNo,
                                    invokeAction: ViewModel.ConfigureAverageGrades);

            _tableView.AddValueCell(PowerPlannerResources.GetString("ClassPage_TextBlockRoundGradesUpHelpHeader.Text"),
                                    bindingHost: m_classBindingHost,
                                    bindingValuePropertyName: nameof(ViewModel.Class.DoesRoundGradesUp),
                                    converter: ConvertBooleanToYesNo,
                                    invokeAction: ViewModel.ConfigureRoundGradesUp);

            _tableView.Compile();
        }