diff --git a/Futoverseny/Form1.Designer.cs b/Futoverseny/Form1.Designer.cs index f0b0ead..16990bc 100644 --- a/Futoverseny/Form1.Designer.cs +++ b/Futoverseny/Form1.Designer.cs @@ -82,7 +82,7 @@ namespace Futoverseny // megnyitToolStripMenuItem // this.megnyitToolStripMenuItem.Name = "megnyitToolStripMenuItem"; - this.megnyitToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.megnyitToolStripMenuItem.Size = new System.Drawing.Size(118, 22); this.megnyitToolStripMenuItem.Text = "Megnyit"; this.megnyitToolStripMenuItem.Click += new System.EventHandler(this.megnyitToolStripMenuItem_Click); // @@ -91,6 +91,7 @@ namespace Futoverseny this.eredménylistaToolStripMenuItem.Name = "eredménylistaToolStripMenuItem"; this.eredménylistaToolStripMenuItem.Size = new System.Drawing.Size(93, 20); this.eredménylistaToolStripMenuItem.Text = "Eredménylista"; + this.eredménylistaToolStripMenuItem.Click += new System.EventHandler(this.eredménylistaToolStripMenuItem_Click); // // label2 // diff --git a/Futoverseny/Form1.cs b/Futoverseny/Form1.cs index 800bc6a..13d663e 100644 --- a/Futoverseny/Form1.cs +++ b/Futoverseny/Form1.cs @@ -45,9 +45,31 @@ namespace Futoverseny 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)); + int ev = DateTime.Now.Year; + int kor = ev - int.Parse(futok[kiv].szuldatum.Substring(0, 4)); textBox4.Text = kor.ToString(); } } + + private void eredménylistaToolStripMenuItem_Click(object sender, EventArgs e) + { + List rendezett = new List(futok); + //rendezett.Sort(new Comparison()) + for (int i = 0; i < rendezett.Count-1; i++) + { + for (int j = i+1; j < rendezett.Count; j++) + { + if (rendezett[j].masodperc + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.label1 = new System.Windows.Forms.Label(); + this.listBox1 = new System.Windows.Forms.ListBox(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("Segoe UI", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + this.label1.Location = new System.Drawing.Point(127, 23); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(206, 25); + this.label1.TabIndex = 0; + this.label1.Text = "Verseny eredmény lista"; + // + // listBox1 + // + this.listBox1.FormattingEnabled = true; + this.listBox1.ItemHeight = 15; + this.listBox1.Location = new System.Drawing.Point(49, 76); + this.listBox1.Name = "listBox1"; + this.listBox1.Size = new System.Drawing.Size(376, 334); + this.listBox1.TabIndex = 1; + this.listBox1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.listBox1_MouseClick); + this.listBox1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.listBox1_MouseDown); + // + // Form2 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(498, 450); + this.Controls.Add(this.listBox1); + this.Controls.Add(this.label1); + this.Name = "Form2"; + this.Text = "Eredménylista"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label label1; + private System.Windows.Forms.ListBox listBox1; + } +} \ No newline at end of file diff --git a/Futoverseny/Form2.cs b/Futoverseny/Form2.cs new file mode 100644 index 0000000..7487840 --- /dev/null +++ b/Futoverseny/Form2.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.IO; +using System.Text; +using System.Windows.Forms; + +namespace Futoverseny +{ + public partial class Form2 : Form + { + public Form2() + { + InitializeComponent(); + } + + public void Setlista(List lista) + { + if (lista!=null) + { + foreach (Resztvevo item in lista) + { + listBox1.Items.Add($"{item.nev} - {item.idoperc}:{item.idomasodperc}"); + } + } + } + + private void listBox1_MouseClick(object sender, MouseEventArgs e) + { + + } + + private void listBox1_MouseDown(object sender, MouseEventArgs e) + { + if (e.Button == MouseButtons.Right) + { + StreamWriter sw = new StreamWriter("eredmenyek.txt"); + foreach (var item in listBox1.Items) + { + sw.WriteLine(item); + } + sw.Close(); + MessageBox.Show("Mentés megtörtént"); + } + } + } +} diff --git a/Futoverseny/Form2.resx b/Futoverseny/Form2.resx new file mode 100644 index 0000000..f298a7b --- /dev/null +++ b/Futoverseny/Form2.resx @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Futoverseny/Resztvevo.cs b/Futoverseny/Resztvevo.cs index 503423a..d798e75 100644 --- a/Futoverseny/Resztvevo.cs +++ b/Futoverseny/Resztvevo.cs @@ -4,7 +4,7 @@ using System.Text; namespace Futoverseny { - class Resztvevo + public class Resztvevo { public string rajtszam; public string nev; @@ -12,6 +12,7 @@ namespace Futoverseny public string orszag; public double idoperc; public double idomasodperc; + public double masodperc; public Resztvevo(string sor) { @@ -22,6 +23,7 @@ namespace Futoverseny orszag = t[3]; idoperc = double.Parse(t[4].Split(":")[0]); idomasodperc = double.Parse(t[4].Split(":")[1].Replace('.', ',')); + masodperc = idoperc * 60 + idomasodperc; } } }