Ejemplo n.º 1
0
 public MainWindow()
 {
     InitializeComponent();
     vm = new MainWindowViewModel();
     DataContext = vm;
     Answer.Focus();
 }
Ejemplo n.º 2
0
 private void Answer_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Enter)
     {
         if(vm.CurrentProblem == null)
         {
             vm = new MainWindowViewModel();
             DataContext = vm;
         }
         int answer;
         if (int.TryParse(Answer.Text, out answer))
         {
             vm.AnswerCurrentProblem(answer);
         }
         Answer.Text = "";
     }
 }