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;

namespace StekloMaster
{
    public partial class Form14 : Form
    {
        public Form14()
        {
            InitializeComponent();
        }

        public string material = "";

        private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (Char.IsControl(e.KeyChar)) return;
            if (e.KeyChar < '0' || e.KeyChar > '9')
            {
                if (e.KeyChar != ',')
                    e.Handled = true;
            }
        }

        private void radioButton2_CheckedChanged(object sender, EventArgs e)
        {
            if(radioButton2.Checked)
            {
                textBox1.Enabled = textBox2.Enabled = true;
            }
            else
            {
                textBox1.Enabled = textBox2.Enabled = false;
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Form8 g = this.Owner as Form8;
            if(radioButton1.Checked)
            {
                g.listBox1.Items.AddRange(new object[] { material+" - на всю поверхность" });
            }
            else
            {
                g.listBox1.Items.AddRange(new object[] { material+" - выс: "+textBox1.Text + " шир: "+ textBox2.Text + " мм." });
            }
            g.listBox1.SelectedIndex = 0;
            g.sumka();
            this.Close();
        }
    }
}
