59 lines
1.8 KiB
C#
59 lines
1.8 KiB
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.ComponentModel;
|
|||
|
using System.Data;
|
|||
|
using System.Drawing;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using System.Threading.Tasks;
|
|||
|
using System.Windows.Forms;
|
|||
|
using Valasztas2;
|
|||
|
|
|||
|
namespace ValasztasGUI
|
|||
|
{
|
|||
|
public partial class Form1 : Form
|
|||
|
{
|
|||
|
public Form1()
|
|||
|
{
|
|||
|
InitializeComponent();
|
|||
|
}
|
|||
|
|
|||
|
private void megnyitásToolStripMenuItem_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
if (openFileDialog1.ShowDialog()==DialogResult.OK)
|
|||
|
{
|
|||
|
List<Kepviselo> jeloltek = Kepviselo.LoadFromTxt(openFileDialog1.FileName);
|
|||
|
listBox1.Items.AddRange(jeloltek.ToArray());
|
|||
|
// vagy listBox1.DataSource = jeloltek;
|
|||
|
listBox1.DisplayMember = "TeljesNev";
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private void kilépésToolStripMenuItem_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
//this.Close();
|
|||
|
Application.Exit();
|
|||
|
}
|
|||
|
|
|||
|
private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
{
|
|||
|
Dictionary<string, string> partok = new Dictionary<string, string>();
|
|||
|
partok.Add("ZEP", "Zöldségevők pártja");
|
|||
|
partok.Add("HEP", "Húsevők pártja");
|
|||
|
partok.Add("GYEP", "Gyümölcsevők pártja");
|
|||
|
partok.Add("TISZ", "Tejivók szövetsége");
|
|||
|
partok.Add("független", "független");
|
|||
|
if(listBox1.SelectedIndex>=0)
|
|||
|
{
|
|||
|
Kepviselo kk = (listBox1.SelectedItem as Kepviselo);
|
|||
|
nevmezo.Text = kk.TeljesNev;
|
|||
|
keruletmezo.Text = kk.Kerulet.ToString();
|
|||
|
partmezo.Text = partok[kk.Part];
|
|||
|
szavazatmezo.Text = kk.Szavazat.ToString();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|