using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.IO; namespace WindowsFormsApplication1 { public partial class VyhodnoceniGraficky : Form { public VyhodnoceniGraficky() { InitializeComponent(); } Vyhodnoceni vyhodnoceni = null; private void btnNactiSit_Click( object sender, EventArgs e ) { if ( dlgOtevrit.ShowDialog() == DialogResult.OK ) { Vyhodnoceni noveVyhodnoceni = new Vyhodnoceni( dlgOtevrit.FileName ); vyhodnoceni = noveVyhodnoceni; btnVypocti.Enabled = true; } } private void btnVypocti_Click( object sender, EventArgs e ) { if ( dlgOtevrit.ShowDialog() == DialogResult.OK ) { lbVystup.Items.Clear(); Console.Clear(); string[] radky = File.ReadAllLines( dlgOtevrit.FileName ); foreach ( string radek in radky ) { List radekVstupu = new List(); foreach ( char znak in radek ) { radekVstupu.Add( znak == '0' ? false : true ); } List vyhodnoceniVysledek = vyhodnoceni.VyhodnotGraficky( radekVstupu, pnlGrafika ); StringBuilder stavec = new StringBuilder(); foreach ( int cislo in vyhodnoceniVysledek ) { stavec.Append( cislo.ToString() ); } Console.WriteLine( stavec.ToString() ); lbVystup.Items.Add( stavec.ToString() ); } lbVystup.Items.Add( "Síť prošla " + lbVystup.Items.Count.ToString() + " vstupů" ); } } } }