Esempio n. 1
0
 private void ProcessField(Field NewField)
 {
     if (gamemode)
     {
         WaitForPlayerForm LookForParnter = new WaitForPlayerForm();
         LookForParnter.Owner = this;
         if (LookForParnter.ShowDialog() == DialogResult.OK)
         {
             GameForm       = new FieldForm(new Game(NewField, true));
             GameForm.Owner = this;
             this.Hide();
             GameForm.ShowDialog();
         }
     }
     else
     {
         ConnectToTheGameForm ConnectForm = new ConnectToTheGameForm();
         ConnectForm.Owner = this;
         if (ConnectForm.ShowDialog() == DialogResult.OK)
         {
             GameForm       = new FieldForm(new Game(NewField, false));
             GameForm.Owner = this;
             this.Hide();
             GameForm.ShowDialog();
         }
     }
     this.Show();
 }
Esempio n. 2
0
 ///////////////////////CallBackHandlers-----------------------------------------------------------------------------------------------------------------------------
 private void OnConnectionLostHandler(object sender, EventArgs e)
 {
     /*
      * after restoring connection server takes the move
      */
     if (MessageBox.Show("Соединение с партнером было потеряно. Хотите подключиться заново? ", "Ошибка", MessageBoxButtons.YesNo, MessageBoxIcon.Error) == DialogResult.Yes)
     {
         bool rep  = true;
         bool Mode = Program.ConnectionManager.Mode; //mode will be reset to default if user close connection form without success
         while (rep)
         {
             if (Mode)
             {
                 WaitForPlayerForm WaitForm = new WaitForPlayerForm();
                 if (WaitForm.ShowDialog() == DialogResult.Cancel)
                 {
                     if (MessageBox.Show("Вы уверены что хотите завершить текущую игру?", "Потдверждение", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
                     {
                         rep = false;
                         SafeClose(this);
                     }
                 }
                 else
                 {
                     rep = false;
                     GameObject.CurrentMove = true;
                     updateMoveLabel();
                     SafeEnable(EnemyField, true);
                 }
             }
             else
             {
                 ConnectToTheGameForm ConnectForm = new ConnectToTheGameForm();
                 if (ConnectForm.ShowDialog() == DialogResult.Cancel)
                 {
                     if (MessageBox.Show("Вы уверены что хотите завершить текущую игру?", "Потдверждение", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
                     {
                         rep = false;
                         SafeClose(this);
                     }
                 }
                 else
                 {
                     rep = false;
                     GameObject.CurrentMove = false;
                     updateMoveLabel();
                     SafeEnable(EnemyField, false);
                 }
             }
         }
     }
     else
     {
         SafeClose(this);
     }
 }