private void SolveMazeButton_Click(object sender, RoutedEventArgs e)
 {
     if (MessageBox.Show("Are you sure you want to solve the maze?", "Solve the maze", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
     {
         vm.SolveMaze();
     }
 }
예제 #2
0
        private void SolveMaze_Click(object sender, RoutedEventArgs e)
        {
            string soultion = vm.SolveMaze();
            string sol      = FromJSON(soultion);

            for (int i = 0; i < sol.Length; i++)
            {
                Application.Current.Dispatcher.Invoke(DispatcherPriority.Background,
                                                      new Action(() => move(sender, sol, i)));
            }
        }
예제 #3
0
 /// <summary>
 /// Handles the Click event of the SolveMaze control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param>
 private void SolveMaze_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         string soultion = vm.SolveMaze();
         string sol      = FromJSON(soultion);
         for (int i = 0; i < sol.Length; i++)
         {
             Application.Current.Dispatcher.Invoke(DispatcherPriority.Background,
                                                   new Action(() => move(sender, sol, i)));
         }
     } catch (Exception)
     {
         MessageBox.Show("Connection error");
         this.Close();
         MainWindow win = (MainWindow)Application.Current.MainWindow;
         win.Show();
     }
 }