Example #1
0
        private void buttonNewGame_Click(object sender, EventArgs e)
        {
            //открытие игровой формы
            UserChoosingPuzzle ch = new UserChoosingPuzzle(login);

            ch.Show();
            this.Hide();
        }
 public GalleryForCreate(UserChoosingPuzzle choosingPuzzle, int number)
 {
     InitializeComponent();
     picSelected = null;
     p           = choosingPuzzle;
     userChoose(number);
     admin = false;
 }
Example #3
0
        /*обработчик события продолжения игры
         */
        private void buttonContinue_Click(object sender, EventArgs e)
        {
            MemoryStream    stream    = new MemoryStream();
            BinaryFormatter formatter = new BinaryFormatter();

            sqlConnection = new SqlConnection(connectionString);
            //   await sqlConnection.OpenAsync();

            //проверка на существовании незаконченного пазла
            SqlCommand command = new SqlCommand("SELECT TOP 1 unfinished FROM [Game] where login=@login and unfinished is not null Order by id_game DESC", sqlConnection);

            command.Parameters.AddWithValue("login", login);
            sqlConnection.Open();
            //  await command.ExecuteNonQueryAsync();

            byte[] array = (byte[])command.ExecuteScalar();

            if (array != null)
            {
                //открытие игровой формы
                ContinueGame continueGame = new ContinueGame(login);
                continueGame.Show();
                this.Hide();
            }
            else
            {
                //предупреждение об отсутствии незаконченых сохраненных игр
                DialogResult dialogResult = MessageBox.Show("Нет сохраненных игр. Хотите начать новую игру?", "Все игры оконченны", MessageBoxButtons.OK, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly);
                if (dialogResult == DialogResult.OK)
                {
                    UserChoosingPuzzle userChoosingPuzzle = new UserChoosingPuzzle(login);
                    userChoosingPuzzle.Show();
                    this.Hide();
                }
            }
        }