/// <summary> /// A function that is triggered when a criterion is changed in the criterion and also changes within the list /// </summary> private void Update_criterion(object sender, RoutedEventArgs e) { // Get the criterion from the list BE.Criterion criterion = Criteria_list[Grid.GetRow(sender as ListBox)]; // Update the criterion according to what was entered by the user switch ((sender as ListBox).SelectedIndex) { case 2: criterion.Score = BE.Score.Bad; break; case 1: criterion.Score = BE.Score.OK; break; case 0: criterion.Score = BE.Score.Good; break; default: break; } // Enter the criteria back to the list Criteria_list[Grid.GetRow(sender as ListBox)] = criterion; // Update the test result according to the new criterion tgb_result.IsChecked = iBL_Imp.Pass_Test(Criteria_list); }
public UpdateTestWindow(BE.Test test) { InitializeComponent(); //Comparison of the general test that is represented in the test window that the constructor received Test = test; // Start the Binding this.DataContext = Test; hour.Text = Test.Test_time.ToShortTimeString(); date.Text = Test.Test_time.ToLongDateString(); switch (Test.Student_car_Type) { case BE.Car_type.Private_car: car_type.Text = "רכב פרטי"; break; case BE.Car_type.Two_wheeled_vehicle: car_type.Text = "רכב דו-גלגלי"; break; case BE.Car_type.Medium_truck: car_type.Text = "משאית בינונית"; break; case BE.Car_type.Heavy_truck: car_type.Text = "משאית כבדה"; break; default: car_type.Text = "שגיאה לא הגיונית"; break; } // Fill out the list of criteria according to the criteria written in the XML code foreach (var item in grd_criteria.Children) { if (item is StackPanel) { foreach (var item1 in (item as StackPanel).Children) { if (item1 is TextBlock) { BE.Criterion criterion = new BE.Criterion(BE.Score.Bad, (item1 as TextBlock).Text); Criteria_list.Add(criterion); } } } } }