示例#1
0
 private void dispatcherTimer_Tick(object sender, EventArgs e)
 {
     if (timerMin == 0 && timerSec <= 1)
     {
         MessageBox.Show("Время вышло!");
         Content = new resultControl(answers, questions);
         ((System.Windows.Threading.DispatcherTimer)sender).Stop();
     }
     timerSec--;
     if (timerSec <= 0)
     {
         timerMin--;
         timerSec = 59;
     }
     timerLabel.Content = string.Format("{0:00}:{1:00}", timerMin, timerSec);
 }
示例#2
0
        private void nextAnsw_Click(object sender, RoutedEventArgs e)
        {
            if (testGrid.Children[0] is UserControl3)
            {
                if (((UserControl3)testGrid.Children[0]).isTrue)
                {
                    answers[Qnum] = true;
                }
                else
                {
                    answers[Qnum] = false;
                }
            }
            else if (testGrid.Children[0] is UserControl2)
            {
                if (((UserControl2)testGrid.Children[0]).answTB.Text.Trim(' ') == ((UserControl2)testGrid.Children[0]).True.Trim(' '))
                {
                    answers[Qnum] = true;
                }
                else
                {
                    answers[Qnum] = false;
                }
            }

            if (Qnum == answers.Length - 1)
            {
                Content = new resultControl(answers, questions);
            }
            else
            {
                testGrid.Children.Clear();
                testGrid.Children.Add(questions[++Qnum]);
            }
            foreach (bool a in answers)
            {
                System.Diagnostics.Debug.WriteLine(a);
            }

            if (Qnum == 1)
            {
                prevAnsw.IsEnabled = true;
            }
        }