示例#1
0
        private void btnQuestion_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                _questionWindow         = new QuestionWindow();
                _questionWindow.Closed += new EventHandler(displayAnswer);

                _questionWindow.ShowDialog();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
示例#2
0
        private void displayAnswer(object sender, EventArgs e)
        {
            if (_questionWindow.Answer == QuestionWindow.ANSWER_CANCELLED)
            {
                lblAnswerVal.Content = "Cancelled!";
            }
            else if (_questionWindow.Answer == QuestionWindow.ANSWER_INCORRECT)
            {
                lblAnswerVal.Content = "Incorrect!";
            }

            else
            {
                lblAnswerVal.Content = "Correct!";

                // animation
                double left = Canvas.GetLeft(rect);
                Anim = new DoubleAnimation(left, 120 + left, new Duration(TimeSpan.FromSeconds(3)));
                rect.BeginAnimation(Canvas.LeftProperty, Anim);
            }

            _questionWindow = null;
        }