/// <summary>
        /// Execute.
        /// </summary>
        /// <param name="result"></param>
        /// <param name="viewModel"></param>
        /// <returns></returns>
        public Window Execute(string result, ViewModel viewModel)
        {
            InvalidCommand windowInvalid = new InvalidCommand(viewModel, result);

            windowInvalid.ShowDialog();
            return(windowInvalid);
        }
        /// <summary>
        /// Handles the Click event of the Start 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 Start_Click(object sender, RoutedEventArgs e)
        {
            ifStartPressed = true;
            string[] args = { name_text.Text, rows_text.Text, maze_columns_txt.Text };
            this.commands.Invoke(this, new MazeCommand("start", args));

            start_game.IsEnabled = false;
            waitWindow           = new InvalidCommand(viewModel, "waiting for partner");
            waitWindow.ShowDialog();
        }
예제 #3
0
        /// <summary>
        /// Updates the screen.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The e.</param>
        private void UpdateScreen(object sender, Recive e)
        {
            this.Dispatcher.Invoke(() =>
            {
                this.Show();
                singleplayer_button.IsEnabled = true;
                multiplayer_button.IsEnabled  = true;
                settings_button.IsEnabled     = true;

                if (sender is IServerModel)
                {
                    currentWindow.Close();
                    // send a command window - disconnected
                    InvalidCommand invalidCommand = new InvalidCommand(viewModel, "Partner disconnected");
                    invalidCommand.ShowDialog();
                }
            });
        }