Esempio n. 1
0
        /// <summary>
        /// Handles the Click event of the StartGameBtn 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 StartGameBtn_Click(object sender, RoutedEventArgs e)
        {
            vm = new StartSingleGameViewModel(new SingleModel());
            //getting the game details
            string name = gameDetails.mazeNameTxtBox.Text;
            string rows = gameDetails.mazeRowsTxtBox.Text;
            string cols = gameDetails.mazeColsTxtBox.Text;

            //sending start command to the model through the vm
            vm.StartGame(name, rows, cols);
            SingleGame win = new SingleGame(vm);

            win.Show();
            this.Close();
            Application.Current.MainWindow.Hide();
        }
Esempio n. 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SingleGame"/> class.
 /// </summary>
 /// <param name="vm">The vm.</param>
 public SingleGame(StartSingleGameViewModel vm)
 {
     InitializeComponent();
     menuVm      = vm;
     DataContext = menuVm;
 }