public PracticeWnd(PracticeModel model) { Debug.Assert(model != null); _model = model; _animationOpacity = new DoubleAnimation(0, 1.0, new Duration(new TimeSpan(0, 0, 0, 0, 200))); _animationOpacity.RepeatBehavior = new RepeatBehavior(3.5); _animationOpacity.AutoReverse = true; InitializeComponent(); DataContext = _model; Loaded += new RoutedEventHandler(PracticeWnd_Loaded); _model.RuleTextChanged += new EventHandler(Model_RuleTextChanged); _answer.TextInput += new TextCompositionEventHandler(Answer_TextInput); _answer.TextChanged += new TextChangedEventHandler(Answer_TextChanged); }
private void OnPractice(Object sender, ExecutedRoutedEventArgs e) { using (PracticeModel model = new PracticeModel((TopicModel)_topics.SelectedItem)) { if (model.IsEmpty) { MessageBox.Show("Selected topic does not contain active examples to exercise", Strings.WINDOW_TITLE, MessageBoxButton.OK, MessageBoxImage.Warning); } else { PracticeWnd wnd = new PracticeWnd(model); wnd.Owner = this; wnd.ShowDialog(); } } }