using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;

using System.Text;
using System.Windows.Forms;

namespace Teplomer
{
    public partial class konst : Form
    {
        public bool ukonceni;   //kvůli informaci, jestli bylo okno ukončeno Ok/Storno
        public konst()
        {
            
            InitializeComponent();
            if (Form1.pocetCidel < 2)
                lCidlo2.Visible = tA2.Visible = tB2.Visible = tC2.Visible = false;
            if (Form1.pocetCidel < 3)
                lCidlo3.Visible = tA3.Visible = tB3.Visible = tC3.Visible = false;
            if (Form1.pocetCidel < 4)
                lCidlo4.Visible = tA4.Visible = tB4.Visible = tC4.Visible = false;
            ukonceni = true;
        }
        private void Ok_Click(object sender, EventArgs e)
        {
            try
            {
                Convert.ToDouble(tA1.Text); Convert.ToDouble(tB1.Text); Convert.ToDouble(tC1.Text);
                if (Form1.pocetCidel > 1)
                { Convert.ToDouble(tA2.Text); Convert.ToDouble(tB2.Text); Convert.ToDouble(tC2.Text); }
                if (Form1.pocetCidel > 2)
                { Convert.ToDouble(tA3.Text); Convert.ToDouble(tB3.Text); Convert.ToDouble(tC3.Text); }
                if (Form1.pocetCidel > 3)
                { Convert.ToDouble(tA4.Text); Convert.ToDouble(tB4.Text); Convert.ToDouble(tC4.Text); }
            }
            catch 
            {
                MessageBox.Show("Vstupní konstanty mají nesprávný formát");
                return;
            }
            ukonceni = false;
            this.Close();
        }
        private void Storno_Click(object sender, EventArgs e)
        {
            ukonceni = true;
            this.Close();
        }
    }
}
