Ejemplo n.º 1
0
        private void Poddanie_Click(object sender, EventArgs e)
        {
            string            message = "Przegrałeś czy chcesz zagrać jeszcze raz ?";
            string            title   = "PRZEGRANA";
            MessageBoxButtons buttons = MessageBoxButtons.YesNoCancel;
            DialogResult      result  = MessageBox.Show(message, title, buttons);

            if (result == DialogResult.No)
            {
                this.Close();
            }
            else if (result == DialogResult.Cancel)
            {
                System.Threading.Thread.Sleep(1);
            }
            else
            {
                NowaGra.Enabled = true;
                textBoxdo.Clear();
                textBoxod.Clear();
                PodanaLiczba.Clear();
                textBoxod.Enabled       = true;
                textBoxdo.Enabled       = true;
                groupBox1.Visible       = false;
                Losuj.Visible           = true;
                Sprawdzanie_Box.Visible = false;
                //Application.Restart();
            }
        }
Ejemplo n.º 2
0
        private void Sprawdz_Click_Click(object sender, EventArgs e)
        {
            komunikat.Visible = true;

            string test3 = PodanaLiczba.Text;

            if (string.IsNullOrEmpty(test3))
            {
                MessageBox.Show("Musisz podać swoją propozycję");
            }
            else
            {
                int c = int.Parse(PodanaLiczba.Text);
                if (Convert.ToString(g.Ocena(c)) == "ZaMalo")
                {
                    komunikat.Text = "Za Mało";
                }
                else if (Convert.ToString(g.Ocena(c)) == "ZaDuzo")
                {
                    komunikat.Text = "Za Dużo";
                }
                else
                {
                    string            message = $"Wygrałes czy chcesz zagrać jeszcze raz ? \n Ilość Ruchów: {Convert.ToString(g.LicznikRuchow - 1)}\n";
                    string            title   = "WYGRANA";
                    MessageBoxButtons buttons = MessageBoxButtons.YesNo;
                    DialogResult      result  = MessageBox.Show(message, title, buttons);
                    if (result == DialogResult.No)
                    {
                        this.Close();
                    }
                    else
                    {
                        NowaGra.Enabled = true;
                        textBoxdo.Clear();
                        textBoxod.Clear();
                        PodanaLiczba.Clear();
                        textBoxod.Enabled       = true;
                        textBoxdo.Enabled       = true;
                        groupBox1.Visible       = false;
                        Losuj.Visible           = true;
                        Sprawdzanie_Box.Visible = false;
                        //Application.Restart();
                    }
                }
            }
        }