コード例 #1
0
        /// <summary>
        /// Handles the Click event of the joinGameBtn 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 JoinGameBtn_Click(object sender, RoutedEventArgs e)
        {
            int    gameIndex = gamesList.SelectedIndex;
            string name      = gamesList.Items[gameIndex].ToString();

            //sending join command to the model through the vm
            vm.JoinMultiGame(name);
            MultiGame win = new MultiGame(vm);

            win.Show();
            this.Close();
            Application.Current.MainWindow.Hide();
        }
コード例 #2
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)
        {
            //view a message that we are waiting for a player
            waitingWin.Show();

            //getting the game details
            string name = gameDetails.mazeNameTxtBox.Text;
            string rows = gameDetails.mazeRowsTxtBox.Text;
            string cols = gameDetails.mazeColsTxtBox.Text;

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

            win.Show();
            waitingWin.Close();
            this.Close();
            Application.Current.MainWindow.Hide();
        }