Beispiel #1
0
        private void btnBack_Click(object sender, RoutedEventArgs e)
        {
            TestMenu testMenu = new TestMenu();

            testMenu.Show();
            this.Close();
        }
Beispiel #2
0
        private void btnBack_Click(object sender, RoutedEventArgs e)
        {
            Window MenuWindow = new TestMenu();

            MenuWindow.Show();
            this.Close();
        }
        private void BtnTests_Click(object sender, RoutedEventArgs e)
        {
            //player.Stop();
            TestMenu myTestMenu = new TestMenu();

            this.Close();
            myTestMenu.Show();
        }
Beispiel #4
0
        private void btnOK_Click(object sender, RoutedEventArgs e)
        {
            TestMenu mytestMenu = new TestMenu();

            try
            {
                if ((string)btnOK.Content == "Add")
                {
                    myTester = bl.getTestersList().FirstOrDefault(x => x.ID == Convert.ToInt32(textTesterID.Text));
                    BE.Address address = new BE.Address(myCity: textCity.Text, Street: textStreet.Text, Building: textBuilding.Text);

                    if (myTester != null && address != null)
                    {
                        Thread thread = new Thread(() => checkRange(address, myTester));
                        thread.Start();
                    }
                    int numId1 = Convert.ToInt32(textTesterID.Text);
                    if (numId1 < 100000000 || numId1 > 999999999)//9 numbers for id
                    {
                        throw new Exception("Non-valid Id of tester. Please enter a valid Id.");
                    }
                    int numId = Convert.ToInt32(txTtraineeID.Text);
                    if (numId < 100000000 || numId > 999999999)//9 numbers for id
                    {
                        throw new Exception("Non-valid Id of trainee. Please enter a valid Id.");
                    }

                    if ((textTesterID.Text == "") || (txTtraineeID.Text == "") || (textCity.Text == "") || (textBuilding.Text == "") || (textStreet.Text == "") ||
                        (cmbgearBox.Text == "") || (cmbkindOfvehicle.Text == ""))   // empty checkBox
                    {
                        throw new Exception("Not all fields are filled in.");
                    }

                    bl.addTest(MyTest);
                    MyTest = new Test();

                    this.Close();
                    mytestMenu.Show();
                }

                else if ((string)btnOK.Content == "Update")
                {
                    var mbResult = MessageBox.Show("Are you sure you want to update this test?", "", MessageBoxButton.OKCancel, MessageBoxImage.Question, MessageBoxResult.Yes);
                    if (mbResult == MessageBoxResult.OK)
                    {
                        MyTest.Reverse   = chReverse.IsChecked.Value;
                        MyTest.Parking   = chParking.IsChecked.Value;
                        MyTest.Mirror    = chMirrors.IsChecked.Value;
                        MyTest.priority  = chPriority.IsChecked.Value;
                        MyTest.Parking   = chParking.IsChecked.Value;
                        MyTest.Signaling = chSignaling.IsChecked.Value;
                        bl.updateTest(MyTest);
                        MyTest           = new Test();
                        this.DataContext = MyTest;
                        this.Close();
                        MessageBox.Show("Test updated");
                        mytestMenu.Show();
                    }


                    else
                    {
                        this.Close();
                        mytestMenu.Show();
                    }
                }

                else
                {
                    MyTest           = new Test();
                    this.DataContext = MyTest;
                    this.Close();
                    mytestMenu.Show();
                }
            }



            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }