/// <summary> /// Sets up the view with the given criteria object /// </summary> /// <param name="criteria">The criteria that the view should be loaded with</param> private void LoadCriteria(GradingPercentage criteria) { // Hide errors and edit states CriteriaChanged = false; InvalidDataError = false; // Get values to the view model's properties Criteria = criteria; Name = criteria.Name; EditingCriteriaOldName = criteria.Name; Criteria.IsMarkAIncluded = criteria.IsMarkAIncluded; TopValueMarkA = criteria.MarkA.TopLimit.ToString(); BottomValueMarkA = criteria.MarkA.BottomLimit.ToString(); TopValueMarkB = criteria.MarkB.TopLimit.ToString(); BottomValueMarkB = criteria.MarkB.BottomLimit.ToString(); TopValueMarkC = criteria.MarkC.TopLimit.ToString(); BottomValueMarkC = criteria.MarkC.BottomLimit.ToString(); TopValueMarkD = criteria.MarkD.TopLimit.ToString(); BottomValueMarkD = criteria.MarkD.BottomLimit.ToString(); TopValueMarkE = criteria.MarkE.TopLimit.ToString(); BottomValueMarkE = criteria.MarkE.BottomLimit.ToString(); TopValueMarkF = criteria.MarkF.TopLimit.ToString(); BottomValueMarkF = criteria.MarkF.BottomLimit.ToString(); }
/// <summary> /// Fired when an item is selected from criteria list /// </summary> /// <param name="newGrading">Item that has been clicked</param> private void CriteriaItemSelected(GradingPercentage newGrading) { PointsGrading = newGrading.ToPoints(mTestEditor.Builder.CurrentPointScore); IsCriteriaEditModeOn = false; ErrorMessage = ""; MatchPropertiesWithCriteria(); }
/// <summary> /// Default constructor /// </summary> public TestEditorAttachCriteriaViewModel() { // Create commands GoPreviousPageCommand = new RelayCommand(GoPreviousPage); SubmitCriteriaCommand = new RelayCommand(SubmitCriteria); EditCommand = new RelayCommand(BeginEdit); CriteriaListViewModel.Instance.LoadItems(); CriteriaListViewModel.Instance.ShouldSelectIndicatorBeVisible = false; CriteriaListViewModel.Instance.ItemSelected += CriteriaItemSelected; PointsGrading = new GradingPercentage().ToPoints(IoCServer.TestEditor.CurrentPointScore); MatchPropertiesWithCriteria(); }
/// <summary> /// Default constructor /// </summary> public TestEditorAttachCriteriaViewModel(ServerNetwork serverNetwork, TestHost testHost, TestEditor testEditor) { // Inject DI services mServerNetwork = serverNetwork; mTestHost = testHost; mTestEditor = testEditor; // Create commands GoPreviousPageCommand = new RelayCommand(GoPreviousPage); SubmitCriteriaCommand = new RelayCommand(SubmitCriteria); EditCommand = new RelayCommand(BeginEdit); CriteriaListViewModel.Instance.LoadItems(); CriteriaListViewModel.Instance.ShouldSelectIndicatorBeVisible = false; CriteriaListViewModel.Instance.ItemSelected += CriteriaItemSelected; PointsGrading = new GradingPercentage().ToPoints(mTestEditor.CurrentPointScore); MatchPropertiesWithCriteria(); }