using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace das.login { public class login_dialog : Form { public enum BoxResults { Server, Klient, Konec } private BoxResults buttonClicked = BoxResults.Konec; public BoxResults ButtonClicked { get { return buttonClicked; } } public login_dialog() { InitializeComponent(); } private void server_Click(object sender, EventArgs e) { DialogResult = DialogResult.OK; buttonClicked = BoxResults.Server; } private void klient_Click(object sender, EventArgs e) { DialogResult = DialogResult.OK; buttonClicked = BoxResults.Klient; } public string get_ip() { return ip.Text; } public string get_jmeno() { return jmeno.Text; } public string pocet_pocitacu() { return pocitac.Text; } public string pocet_lidi() { return clovek.Text; } private System.ComponentModel.IContainer components = null; protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } private void zavreni_formulare(object sender, System.ComponentModel.CancelEventArgs e) { if (buttonClicked == BoxResults.Konec) { if(MessageBox.Show(("Konec"), "DAS", MessageBoxButtons.YesNo) == DialogResult.Yes) { e.Cancel = false; Environment.Exit(0); } else { e.Cancel = true; } } } private void InitializeComponent() { this.Closing += new System.ComponentModel.CancelEventHandler(this.zavreni_formulare); this.ip = new System.Windows.Forms.TextBox(); this.jmeno = new System.Windows.Forms.TextBox(); this.pocitac = new System.Windows.Forms.TextBox(); this.clovek = new System.Windows.Forms.TextBox(); this.label3 = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label(); this.label5 = new System.Windows.Forms.Label(); this.label6 = new System.Windows.Forms.Label(); this.klient = new System.Windows.Forms.Button(); this.server = new System.Windows.Forms.Button(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.groupBox2 = new System.Windows.Forms.GroupBox(); this.groupBox1.SuspendLayout(); this.groupBox2.SuspendLayout(); this.SuspendLayout(); // // ip // this.ip.Location = new System.Drawing.Point(15, 41); this.ip.Name = "ip"; this.ip.Size = new System.Drawing.Size(100, 20); this.ip.TabIndex = 2; this.ip.Text = "127.0.0.1"; // // jmeno // this.jmeno.Location = new System.Drawing.Point(15, 80); this.jmeno.Name = "jmeno"; this.jmeno.Size = new System.Drawing.Size(100, 20); this.jmeno.TabIndex = 3; Random rand = new Random(); this.jmeno.Text = "jmeno"+rand.Next(6); // // pocitac // this.pocitac.Location = new System.Drawing.Point(20, 41); this.pocitac.Name = "pocitac"; this.pocitac.Size = new System.Drawing.Size(100, 20); this.pocitac.TabIndex = 4; this.pocitac.Text = "1"; // // clovek // this.clovek.Location = new System.Drawing.Point(20, 80); this.clovek.Name = "clovek"; this.clovek.Size = new System.Drawing.Size(100, 20); this.clovek.TabIndex = 5; this.clovek.Text = "1"; // // label3 // this.label3.AutoSize = true; this.label3.Location = new System.Drawing.Point(29, 25); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(53, 13); this.label3.TabIndex = 6; this.label3.Text = "Adresa IP"; // // label4 // this.label4.AutoSize = true; this.label4.Location = new System.Drawing.Point(29, 64); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(38, 13); this.label4.TabIndex = 7; this.label4.Text = "Jméno"; // // label5 // this.label5.AutoSize = true; this.label5.Location = new System.Drawing.Point(17, 25); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(111, 13); this.label5.TabIndex = 8; this.label5.Text = "Počet hráčů počítače"; // // label6 // this.label6.AutoSize = true; this.label6.Location = new System.Drawing.Point(17, 64); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(100, 13); this.label6.TabIndex = 9; this.label6.Text = "Počet hráčů člověk"; // // klient // this.klient.Location = new System.Drawing.Point(15, 106); this.klient.Name = "klient"; this.klient.Size = new System.Drawing.Size(100, 23); this.klient.TabIndex = 10; this.klient.Text = "Připojit"; this.klient.UseVisualStyleBackColor = true; this.klient.Click += new System.EventHandler(this.klient_Click); // // server // this.server.Location = new System.Drawing.Point(20, 106); this.server.Name = "server"; this.server.Size = new System.Drawing.Size(100, 23); this.server.TabIndex = 11; this.server.Text = "Spustit Server"; this.server.UseVisualStyleBackColor = true; this.server.Click += new System.EventHandler(this.server_Click); // // groupBox1 // this.groupBox1.Controls.Add(this.ip); this.groupBox1.Controls.Add(this.klient); this.groupBox1.Controls.Add(this.jmeno); this.groupBox1.Controls.Add(this.label3); this.groupBox1.Controls.Add(this.label4); this.groupBox1.Location = new System.Drawing.Point(16, 12); this.groupBox1.Name = "groupBox1"; this.groupBox1.Size = new System.Drawing.Size(132, 141); this.groupBox1.TabIndex = 12; this.groupBox1.TabStop = false; this.groupBox1.Text = "Klient"; // // groupBox2 // this.groupBox2.Controls.Add(this.server); this.groupBox2.Controls.Add(this.pocitac); this.groupBox2.Controls.Add(this.label6); this.groupBox2.Controls.Add(this.clovek); this.groupBox2.Controls.Add(this.label5); this.groupBox2.Location = new System.Drawing.Point(163, 12); this.groupBox2.Name = "groupBox2"; this.groupBox2.Size = new System.Drawing.Size(145, 141); this.groupBox2.TabIndex = 13; this.groupBox2.TabStop = false; this.groupBox2.Text = "Server"; // // login_dialog // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(326, 170); this.Controls.Add(this.groupBox2); this.Controls.Add(this.groupBox1); this.Name = "login_dialog"; this.Text = "Login"; this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); this.groupBox2.ResumeLayout(false); this.groupBox2.PerformLayout(); this.ResumeLayout(false); } private System.Windows.Forms.TextBox ip; private System.Windows.Forms.TextBox jmeno; private System.Windows.Forms.TextBox pocitac; private System.Windows.Forms.TextBox clovek; private System.Windows.Forms.Label label3; private System.Windows.Forms.Label label4; private System.Windows.Forms.Label label5; private System.Windows.Forms.Label label6; private System.Windows.Forms.Button klient; private System.Windows.Forms.Button server; private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.GroupBox groupBox2; } }