Merkozesek/Merkozesek/Form1.cs
2022-12-09 21:30:32 +01:00

64 lines
1.8 KiB
C#

using System;
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;
using System.Windows.Forms;
namespace Merkozesek
{
public partial class Form1 : Form
{
private List<Merkozes> merkozesek;
public Form1()
{
InitializeComponent();
merkozesek = new List<Merkozes>();
}
private void megnyitásToolStripMenuItem_Click(object sender, EventArgs e)
{
if (openFileDialog1.ShowDialog()==DialogResult.OK)
{
string fajl = openFileDialog1.FileName;
string[] sorok = File.ReadAllLines(fajl);
foreach (string sor in sorok)
{
merkozesek.Add(new Merkozes(sor));
}
listBox1.Items.AddRange(merkozesek.ToArray());
}
}
private void kilépésToolStripMenuItem_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{
Merkozes m = (Merkozes)listBox1.SelectedItem;
tboxCsapatok.Text = m.ToString();
tboxFordulo.Text = m.Fordulo.ToString();
tboxVege.Text = m.HazaiRugott + " - " + m.VendegRugott;
tboxFelido.Text = m.HazaiRugottFelido + " - " + m.VendegRugottFelido;
}
private void button1_Click(object sender, EventArgs e)
{
if ( listBox1.SelectedIndex>=0)
{
} else
{
MessageBox.Show("Nincs kiválasztva mérkőzés!", "Hiba", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}