T
T
TheEvilUser2020-07-20 15:09:01
WPF
TheEvilUser, 2020-07-20 15:09:01

How to make transition to new page (window) in if() check?

private void handler_Click(object sender, RoutedEventArgs e)
{
    Test_Verification_System();
    for (int j = 0; j < 1; j++)
    {
        MessageBoxResult result = MessageBox.Show("Ви дійсно хочете завершити тест?", "Создать еще ", MessageBoxButton.YesNo, MessageBoxImage.Question);
        for (int i = 0; i < radioButtons.Count; i++)
        {
            //Проблема здесь,почему у мене не работает переход,когда пользователь нажимает   "Да"        
            if (result == MessageBoxResult.Yes)
            {
                yourBall += ball;

                this.Hide();
                Results results = new Results();
                results.Show();
                // break;
            }
            else if (result == MessageBoxResult.No)
            {
                radioButtons[i].IsEnabled = true;
                handler.IsEnabled = true;
            }

            MessageBox.Show($"Ваш бал", yourBall.ToString());
            break;
        }
    }
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Sorokin, 2020-08-03
@DIMANRUS

Hello! First, I advise you to check with a breakpoint whether this construction works at all, if so, then try writing a transition to a new window, like this:
Results results = new Results();
this.Close();
results.Show();

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question