Started work with player registration

This commit is contained in:
2022-07-05 23:41:43 +02:00
parent 1696dab42b
commit 3cc9b652ed
2 changed files with 114 additions and 3 deletions

View File

@ -30,6 +30,13 @@
{
this.label1 = new System.Windows.Forms.Label();
this.btnSpela = new System.Windows.Forms.Button();
this.lvMemberList = new System.Windows.Forms.ListView();
this.Spelare = new System.Windows.Forms.ColumnHeader();
this.Vunnit = new System.Windows.Forms.ColumnHeader();
this.Points = new System.Windows.Forms.ColumnHeader();
this.btnAddPlayer = new System.Windows.Forms.Button();
this.txtNewName = new System.Windows.Forms.TextBox();
this.btnAddOk = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// label1
@ -44,7 +51,7 @@
//
// btnSpela
//
this.btnSpela.Location = new System.Drawing.Point(34, 142);
this.btnSpela.Location = new System.Drawing.Point(25, 97);
this.btnSpela.Name = "btnSpela";
this.btnSpela.Size = new System.Drawing.Size(134, 23);
this.btnSpela.TabIndex = 1;
@ -52,11 +59,78 @@
this.btnSpela.UseVisualStyleBackColor = true;
this.btnSpela.Click += new System.EventHandler(this.btnSpela_Click);
//
// lvMemberList
//
this.lvMemberList.Activation = System.Windows.Forms.ItemActivation.OneClick;
this.lvMemberList.BackColor = System.Drawing.SystemColors.Window;
this.lvMemberList.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.Spelare,
this.Vunnit,
this.Points});
this.lvMemberList.GridLines = true;
this.lvMemberList.HoverSelection = true;
this.lvMemberList.Location = new System.Drawing.Point(387, 97);
this.lvMemberList.Name = "lvMemberList";
this.lvMemberList.Size = new System.Drawing.Size(302, 166);
this.lvMemberList.TabIndex = 2;
this.lvMemberList.UseCompatibleStateImageBehavior = false;
this.lvMemberList.View = System.Windows.Forms.View.Details;
//
// Spelare
//
this.Spelare.Text = "S p e l a r e";
this.Spelare.Width = 100;
//
// Vunnit
//
this.Vunnit.Text = "V u n n i t";
this.Vunnit.Width = 80;
//
// Points
//
this.Points.Text = "Poäng";
this.Points.Width = 100;
//
// btnAddPlayer
//
this.btnAddPlayer.Location = new System.Drawing.Point(27, 129);
this.btnAddPlayer.Name = "btnAddPlayer";
this.btnAddPlayer.Size = new System.Drawing.Size(132, 23);
this.btnAddPlayer.TabIndex = 3;
this.btnAddPlayer.Text = "Lägg till Spelare";
this.btnAddPlayer.UseVisualStyleBackColor = true;
this.btnAddPlayer.Click += new System.EventHandler(this.btnAddPlayer_Click);
//
// txtNewName
//
this.txtNewName.Location = new System.Drawing.Point(165, 130);
this.txtNewName.Name = "txtNewName";
this.txtNewName.Size = new System.Drawing.Size(177, 23);
this.txtNewName.TabIndex = 4;
this.txtNewName.Visible = false;
this.txtNewName.TextChanged += new System.EventHandler(this.txtNewName_TextChanged);
//
// btnAddOk
//
this.btnAddOk.Location = new System.Drawing.Point(350, 129);
this.btnAddOk.Name = "btnAddOk";
this.btnAddOk.Size = new System.Drawing.Size(31, 23);
this.btnAddOk.TabIndex = 5;
this.btnAddOk.Text = "Ok";
this.btnAddOk.UseCompatibleTextRendering = true;
this.btnAddOk.UseVisualStyleBackColor = true;
this.btnAddOk.Visible = false;
this.btnAddOk.Click += new System.EventHandler(this.btnAddOk_Click);
//
// frmStart
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Controls.Add(this.btnAddOk);
this.Controls.Add(this.txtNewName);
this.Controls.Add(this.btnAddPlayer);
this.Controls.Add(this.lvMemberList);
this.Controls.Add(this.btnSpela);
this.Controls.Add(this.label1);
this.Name = "frmStart";
@ -71,5 +145,12 @@
private Label label1;
private Button btnSpela;
private ListView lvMemberList;
private ColumnHeader Spelare;
private ColumnHeader Vunnit;
private ColumnHeader Points;
private Button btnAddPlayer;
private TextBox txtNewName;
private Button btnAddOk;
}
}

View File

@ -10,9 +10,39 @@ namespace WinGreed
private void btnSpela_Click(object sender, EventArgs e)
{
fPR = new frmPersonRound("Tommy");
fPR.Show();
if (lvMemberList.Items.Count > 0)
{
fPR = new frmPersonRound("Tommy");
fPR.Show();
}
}
private void btnAddPlayer_Click(object sender, EventArgs e)
{
txtNewName.Visible = true;
}
private void btnAddOk_Click(object sender, EventArgs e)
{
var item=lvMemberList.Items.Add(txtNewName.Text.Trim());
item.SubItems.Add("0");
item.SubItems.Add("0");
txtNewName.Text = "";
txtNewName.Visible = false;
btnAddOk.Visible = false;
}
private void txtNewName_TextChanged(object sender, EventArgs e)
{
if (txtNewName.Text.Trim().Length > 0)
{
btnAddOk.Visible = true;
}
else
{
btnAddOk.Visible = false;
}
}
}
}