Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
1.4 kB
0
Indexable
Never
using System;
using System.Windows.Forms;
using TicTacToe;

public class NetworkGameForm : Form
{
    private TextBox usernameTextBox;
    private NumericUpDown arenaNumberNumericUpDown;
    private Button okButton;
    private Game game;

    public string Username { get; private set; }
    public int ArenaNumber { get; private set; }

    public NetworkGameForm(Game game)
    {
        this.game = game;
        this.Text = "Network Game";
        this.Size = new Size(300, 200);

        usernameTextBox = new TextBox() { Text = "Username", Location = new Point(50, 30), Size = new Size(200, 30) };
        arenaNumberNumericUpDown = new NumericUpDown() { Value = 1, Location = new Point(50, 70), Size = new Size(200, 30), Minimum = 1, Maximum = 9999 };
        okButton = new Button()
        {
            Text = "OK",
            Location = new Point(50, 110),
            Size = new Size(200, 30)
        };
        okButton.Click += OkButton_Click;

        this.Controls.Add(usernameTextBox);
        this.Controls.Add(arenaNumberNumericUpDown);
        this.Controls.Add(okButton);
    }

    private void OkButton_Click(object sender, EventArgs e)
    {
        Username = usernameTextBox.Text;
        ArenaNumber = (int)arenaNumberNumericUpDown.Value;
        this.DialogResult = DialogResult.OK;
        this.Close();
    }
}