Пример #1
0
        /// <summary>
        /// Handles the Click event of the Start_Button 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_Button_Click(object sender, RoutedEventArgs e)
        {
            if (this.MenuUserControl.TxtMazeName.Text.Equals(string.Empty) ||
                this.MenuUserControl.TxtRows.Text.Equals(string.Empty) ||
                this.MenuUserControl.TxtCols.Text.Equals(string.Empty))
            {
                CheckArgsWindow win = new CheckArgsWindow();
                win.Show();
            }
            else
            {
                try
                {
                    this.model.StartGame();
                }
                catch (Exception excp)
                {
                    this.NoConnection();
                    this.Close();
                    return;
                }

                SinglePlayerWindow win = new SinglePlayerWindow(this.model);
                win.Show();
                this.Close();
            }
        }
 /// <summary>
 /// Handles the Click event of the btnOK 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 btnOK_Click(object sender, RoutedEventArgs e)
 {
     if (this.TxtIp.Text.Equals(string.Empty) ||
         this.TxtPort.Text.Equals(string.Empty) ||
         this.TxtCols.Text.Equals(string.Empty) ||
         this.TxtRows.Text.Equals(string.Empty))
     {
         CheckArgsWindow win = new CheckArgsWindow();
         win.Show();
     }
     else
     {
         this.vm.SaveSettings();
         MainWindow win = (MainWindow)Application.Current.MainWindow;
         win.Show();
         this.Close();
     }
 }
Пример #3
0
 private void Start_Button_Click(object sender, RoutedEventArgs e)
 {
     if (this.MenuUserControl.TxtMazeName.Text.Equals(string.Empty) ||
         this.MenuUserControl.TxtRows.Text.Equals(string.Empty) ||
         this.MenuUserControl.TxtCols.Text.Equals(string.Empty))
     {
         CheckArgsWindow win = new CheckArgsWindow();
         win.Show();
     }
     else
     {
         WaitWindow win = new WaitWindow();
         win.Show();
         this.surpriseClose = false;
         this.Close();
         this.vm.StartGame();
         while (this.vm.NotReady)
         {
         }
         MultiPlayerWindow mulWin = new MultiPlayerWindow(this.model);
         mulWin.Show();
         win.Close();
     }
 }