From 4c56a4086ea5a658076fef290881abe0ee4a48fe Mon Sep 17 00:00:00 2001 From: pp Date: Fri, 25 Mar 2022 12:03:26 +0100 Subject: [PATCH] Felkesz1 --- Futoverseny/Form1.Designer.cs | 204 +++++++++++++++++++++++++++++++++- Futoverseny/Form1.cs | 32 ++++++ Futoverseny/Form1.resx | 3 + Futoverseny/Resztvevo.cs | 2 +- 4 files changed, 237 insertions(+), 4 deletions(-) diff --git a/Futoverseny/Form1.Designer.cs b/Futoverseny/Form1.Designer.cs index 26f3c65..f0b0ead 100644 --- a/Futoverseny/Form1.Designer.cs +++ b/Futoverseny/Form1.Designer.cs @@ -1,7 +1,7 @@  namespace Futoverseny { - partial class Form1 + public partial class Form1 { /// /// Required designer variable. @@ -29,20 +29,218 @@ namespace Futoverseny /// private void InitializeComponent() { + this.label1 = new System.Windows.Forms.Label(); + this.menuStrip1 = new System.Windows.Forms.MenuStrip(); + this.fájlToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.megnyitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.eredménylistaToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.label2 = new System.Windows.Forms.Label(); + this.listBox1 = new System.Windows.Forms.ListBox(); + this.button1 = new System.Windows.Forms.Button(); + 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.textBox1 = new System.Windows.Forms.TextBox(); + this.textBox2 = new System.Windows.Forms.TextBox(); + this.textBox3 = new System.Windows.Forms.TextBox(); + this.textBox4 = new System.Windows.Forms.TextBox(); + this.button2 = new System.Windows.Forms.Button(); + this.menuStrip1.SuspendLayout(); this.SuspendLayout(); // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("Segoe UI", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point); + this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this.label1.Location = new System.Drawing.Point(312, 24); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(225, 30); + this.label1.TabIndex = 0; + this.label1.Text = "Maratoni futóverseny"; + // + // menuStrip1 + // + this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.fájlToolStripMenuItem, + this.eredménylistaToolStripMenuItem}); + this.menuStrip1.Location = new System.Drawing.Point(0, 0); + this.menuStrip1.Name = "menuStrip1"; + this.menuStrip1.Size = new System.Drawing.Size(600, 24); + this.menuStrip1.TabIndex = 1; + this.menuStrip1.Text = "menuStrip1"; + // + // fájlToolStripMenuItem + // + this.fájlToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.megnyitToolStripMenuItem}); + this.fájlToolStripMenuItem.Name = "fájlToolStripMenuItem"; + this.fájlToolStripMenuItem.Size = new System.Drawing.Size(37, 20); + this.fájlToolStripMenuItem.Text = "Fájl"; + // + // megnyitToolStripMenuItem + // + this.megnyitToolStripMenuItem.Name = "megnyitToolStripMenuItem"; + this.megnyitToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.megnyitToolStripMenuItem.Text = "Megnyit"; + this.megnyitToolStripMenuItem.Click += new System.EventHandler(this.megnyitToolStripMenuItem_Click); + // + // eredménylistaToolStripMenuItem + // + this.eredménylistaToolStripMenuItem.Name = "eredménylistaToolStripMenuItem"; + this.eredménylistaToolStripMenuItem.Size = new System.Drawing.Size(93, 20); + this.eredménylistaToolStripMenuItem.Text = "Eredménylista"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(30, 52); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(75, 15); + this.label2.TabIndex = 2; + this.label2.Text = "RÉSZTVEVŐK"; + // + // listBox1 + // + this.listBox1.FormattingEnabled = true; + this.listBox1.ItemHeight = 15; + this.listBox1.Location = new System.Drawing.Point(30, 79); + this.listBox1.Name = "listBox1"; + this.listBox1.Size = new System.Drawing.Size(198, 304); + this.listBox1.TabIndex = 3; + this.listBox1.SelectedIndexChanged += new System.EventHandler(this.listBox1_SelectedIndexChanged); + // + // button1 + // + this.button1.Location = new System.Drawing.Point(30, 401); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(166, 23); + this.button1.TabIndex = 4; + this.button1.Text = "adatBe"; + this.button1.UseVisualStyleBackColor = true; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(268, 82); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(54, 15); + this.label3.TabIndex = 5; + this.label3.Text = "Rajtszám"; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Location = new System.Drawing.Point(268, 143); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(41, 15); + this.label4.TabIndex = 6; + this.label4.Text = "ország"; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Location = new System.Drawing.Point(268, 212); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(77, 15); + this.label5.TabIndex = 7; + this.label5.Text = "időeredmény"; + // + // label6 + // + this.label6.AutoSize = true; + this.label6.Location = new System.Drawing.Point(268, 285); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(43, 15); + this.label6.TabIndex = 8; + this.label6.Text = "életkor"; + // + // textBox1 + // + this.textBox1.Location = new System.Drawing.Point(374, 79); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(163, 23); + this.textBox1.TabIndex = 9; + // + // textBox2 + // + this.textBox2.Location = new System.Drawing.Point(374, 140); + this.textBox2.Name = "textBox2"; + this.textBox2.Size = new System.Drawing.Size(163, 23); + this.textBox2.TabIndex = 10; + // + // textBox3 + // + this.textBox3.Location = new System.Drawing.Point(374, 209); + this.textBox3.Name = "textBox3"; + this.textBox3.Size = new System.Drawing.Size(163, 23); + this.textBox3.TabIndex = 11; + // + // textBox4 + // + this.textBox4.Location = new System.Drawing.Point(374, 282); + this.textBox4.Name = "textBox4"; + this.textBox4.Size = new System.Drawing.Size(163, 23); + this.textBox4.TabIndex = 12; + // + // button2 + // + this.button2.Location = new System.Drawing.Point(374, 401); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(163, 23); + this.button2.TabIndex = 13; + this.button2.Text = "bezár"; + this.button2.UseVisualStyleBackColor = true; + // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(678, 450); + this.ClientSize = new System.Drawing.Size(600, 450); + this.Controls.Add(this.button2); + this.Controls.Add(this.textBox4); + this.Controls.Add(this.textBox3); + this.Controls.Add(this.textBox2); + this.Controls.Add(this.textBox1); + this.Controls.Add(this.label6); + this.Controls.Add(this.label5); + this.Controls.Add(this.label4); + this.Controls.Add(this.label3); + this.Controls.Add(this.button1); + this.Controls.Add(this.listBox1); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.Controls.Add(this.menuStrip1); + this.MainMenuStrip = this.menuStrip1; this.Name = "Form1"; - this.Text = "Form1"; + this.Text = "Futóverseny"; + this.menuStrip1.ResumeLayout(false); + this.menuStrip1.PerformLayout(); this.ResumeLayout(false); + this.PerformLayout(); } #endregion + + private System.Windows.Forms.Label label1; + private System.Windows.Forms.MenuStrip menuStrip1; + private System.Windows.Forms.ToolStripMenuItem fájlToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem megnyitToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem eredménylistaToolStripMenuItem; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.ListBox listBox1; + private System.Windows.Forms.Button button1; + 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.TextBox textBox1; + private System.Windows.Forms.TextBox textBox2; + private System.Windows.Forms.TextBox textBox3; + private System.Windows.Forms.TextBox textBox4; + private System.Windows.Forms.Button button2; } } diff --git a/Futoverseny/Form1.cs b/Futoverseny/Form1.cs index 0dfe6da..800bc6a 100644 --- a/Futoverseny/Form1.cs +++ b/Futoverseny/Form1.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; +using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -12,10 +13,41 @@ namespace Futoverseny { public partial class Form1 : Form { + List futok; public Form1() { InitializeComponent(); } + private void megnyitToolStripMenuItem_Click(object sender, EventArgs e) + { + futok = new List(); + OpenFileDialog ofd = new OpenFileDialog(); + ofd.Title= "Beolvasás:"; + if (ofd.ShowDialog() == DialogResult.OK) { + StreamReader sr = new StreamReader(ofd.FileName, Encoding.UTF8); + while (!sr.EndOfStream) { + futok.Add(new Resztvevo(sr.ReadLine())); + } + sr.Close(); + foreach (Resztvevo item in futok) + { + listBox1.Items.Add(item.nev); + } + } + } + + private void listBox1_SelectedIndexChanged(object sender, EventArgs e) + { + int kiv = listBox1.SelectedIndex; + if (kiv > -1) + { + textBox1.Text = futok[kiv].rajtszam; + textBox2.Text = futok[kiv].orszag; + textBox3.Text = futok[kiv].idoperc+":"+futok[kiv].idomasodperc; + int kor = 2022 - int.Parse(futok[kiv].szuldatum.Substring(0, 4)); + textBox4.Text = kor.ToString(); + } + } } } diff --git a/Futoverseny/Form1.resx b/Futoverseny/Form1.resx index f298a7b..938108a 100644 --- a/Futoverseny/Form1.resx +++ b/Futoverseny/Form1.resx @@ -57,4 +57,7 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 17, 17 + \ No newline at end of file diff --git a/Futoverseny/Resztvevo.cs b/Futoverseny/Resztvevo.cs index 19fe7f1..503423a 100644 --- a/Futoverseny/Resztvevo.cs +++ b/Futoverseny/Resztvevo.cs @@ -21,7 +21,7 @@ namespace Futoverseny szuldatum = t[2]; orszag = t[3]; idoperc = double.Parse(t[4].Split(":")[0]); - idomasodperc = double.Parse(t[4].Split(":")[1]); + idomasodperc = double.Parse(t[4].Split(":")[1].Replace('.', ',')); } } }