Jove 1.0 – Source of the code

Snow Load

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace tempSS
{
    public partial class SnowEC : Form
    {
        public string Specifications;
        double calculatedSk = 0;
        double calculatedce = 1;


        public SnowEC()
        {
            InitializeComponent();
            init();
        }
        private void init()
        {
            label11.Text = "Please fill the marked parts";
            comboBox2.SelectedItem = 0;
            comboBox1.SelectedItem = 0;
            comboBox4.SelectedItem = 0;
            comboBox3.SelectedItem = 0;
            comboBox2.SelectedValue = "-Select-";
            comboBox1.SelectedIndex = 0;
            comboBox4.Text = "-Select-";
            comboBox3.Text = "-Select-";
        }
        private SnowECResult frm2;
        //start//Initial Appearance//
        private void SnowEC_Load(object sender, EventArgs e)
        {
            frm2 = new SnowECResult();

            pictureBox2.Visible = false;
            pictureBox3.Visible = false;
            pictureBox4.Visible = false;
            pictureBox5.Visible = false;
            pictureBox6.Visible = false;
            pictureBox7.Visible = false;
            pictureBox8.Visible = false;
            pictureBox9.Visible = false;
            pictureBox10.Visible = false;
            textBox2.Visible = false;
            label5.Visible = false;
            button3.Visible = false;

            panel1.Visible = false; textBox3.Visible = false;
            panel2.Visible = false; 
            panel3.Visible = false; pictureBox11.Visible = false;
            panel4.Visible = false; pictureBox12.Visible = false;
            panel5.Visible = false; pictureBox13.Visible = false; pictureBox19.Visible = false; pictureBox20.Visible = false; pictureBox21.Visible = false;
            button1.Size = new Size(0,0); button2.Enabled = false;
            
        }
        //end//Initial Appearance//
        //start//Only numbers are allowed// 
        private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar) &&
                (e.KeyChar != '.'))
            {
                e.Handled = true;
            }
            if ((e.KeyChar == '.') && ((sender as TextBox).Text.IndexOf('.') > -1))
            {
                e.Handled = true;
            }
            if ((sender as TextBox).Text.Count(Char.IsDigit) >= 5)
                e.Handled = true;

        }
        //end//Only numbers are allowed//
        //start//Topography of the Site//
        private void comboBox3_SelectedIndexChanged(object sender, EventArgs e)
        {
            double ce = 1;
            pictureBox18.Visible = false;
            if (comboBox3.SelectedItem.ToString() == "Normal")
            {
                ce = float.Parse("1.0", CultureInfo.InvariantCulture.NumberFormat);

            }
            else if (comboBox3.SelectedItem.ToString() == "Windswept")
            {
                ce = float.Parse("0.8", CultureInfo.InvariantCulture.NumberFormat);
            }
            else if (comboBox3.SelectedItem.ToString() == "Sheltered")
            {
                ce = float.Parse("1.2", CultureInfo.InvariantCulture.NumberFormat);
            }
            if (!(comboBox1.SelectedItem.ToString() == "Select the Region") && !(string.IsNullOrEmpty(comboBox2.Text)) && !(string.IsNullOrEmpty(comboBox3.Text)) && !(string.IsNullOrEmpty(comboBox4.Text)) && !(string.IsNullOrEmpty(textBox1.Text)))
            {
                button1.Enabled = true;
                button2.Enabled = true;
                button1.PerformClick();
            }
            else if (!(string.IsNullOrEmpty(textBox2.Text)) && !(string.IsNullOrEmpty(comboBox3.Text)))
            {
                button1.Enabled = true;
                button2.Enabled = true;
                button1.PerformClick();
            }
            else
            {
                button1.Enabled = false;
                button2.Enabled = false;
            }

            calculatedce = ce;
        }
        //end//Topography of the Site//
        //start//Required spaces//
        private void required_spaces(object sender, EventArgs e)
        {
            if (checkBox1.Checked == false)
            {
                if (!(comboBox1.SelectedItem.ToString() == "Select the Region") && !(string.IsNullOrEmpty(comboBox2.Text)) && !(string.IsNullOrEmpty(comboBox3.Text)) && !(string.IsNullOrEmpty(comboBox4.Text)) && !(string.IsNullOrEmpty(textBox1.Text)))
                {
                    button1.Enabled = true;
                    button2.Enabled = true;
                    button1.PerformClick();
                }
                else
                {
                    button1.Enabled = false;
                    button2.Enabled = false;
                }
                if (!(string.IsNullOrEmpty(comboBox2.Text)))
                {
                    pictureBox17.Visible = false;
                }
                else
                {
                    pictureBox17.Visible = true;
                }
                if (!(string.IsNullOrEmpty(comboBox4.Text)))
                {
                    pictureBox15.Visible = false;
                }
                else
                {
                    pictureBox15.Visible = true;
                }
                if (!(string.IsNullOrEmpty(textBox1.Text)))
                {
                    pictureBox16.Visible = false;
                }
                else
                {
                    pictureBox16.Visible = true;
                }
            }
        }
        //end//Required spaces//
        //start// region maps//
        private void comboBox1_images(object sender, EventArgs e)
        {
            if (!(comboBox1.SelectedItem.ToString() == "Select the Region") && !(string.IsNullOrEmpty(comboBox2.Text)) && !(string.IsNullOrEmpty(comboBox3.Text)) && !(string.IsNullOrEmpty(comboBox4.Text)) && !(string.IsNullOrEmpty(textBox1.Text)))
            {
                button1.Enabled = true;
                button2.Enabled = true;
                button1.PerformClick();
            }

            else
            {
                button1.Enabled = false;
                button2.Enabled = false;
            }
            if (comboBox1.SelectedItem.ToString() == "Alpine Region")
            {
                pictureBox1.Visible = false;
                pictureBox2.Visible = true;
                pictureBox3.Visible = false;
                pictureBox4.Visible = false;
                pictureBox5.Visible = false;
                pictureBox6.Visible = false;
                pictureBox7.Visible = false;
                pictureBox8.Visible = false;
                pictureBox9.Visible = false;
                pictureBox10.Visible = false;
                pictureBox14.Visible = false;
            }
            else if (comboBox1.SelectedItem.ToString() == "Central East")
            {
                pictureBox1.Visible = false;
                pictureBox3.Visible = true;
                pictureBox2.Visible = false;
                pictureBox4.Visible = false;
                pictureBox5.Visible = false;
                pictureBox6.Visible = false;
                pictureBox7.Visible = false;
                pictureBox8.Visible = false;
                pictureBox9.Visible = false;
                pictureBox10.Visible = false;
                pictureBox14.Visible = false;
            }
            else if (comboBox1.SelectedItem.ToString() == "Greece")
            {
                pictureBox1.Visible = false;
                pictureBox4.Visible = true;
                pictureBox3.Visible = false;
                pictureBox2.Visible = false;
                pictureBox5.Visible = false;
                pictureBox6.Visible = false;
                pictureBox7.Visible = false;
                pictureBox8.Visible = false;
                pictureBox9.Visible = false;
                pictureBox10.Visible = false;
                pictureBox14.Visible = false;
            }
            else if (comboBox1.SelectedItem.ToString() == "Iberian Peninsula")
            {
                pictureBox1.Visible = false;
                pictureBox5.Visible = true;
                pictureBox3.Visible = false;
                pictureBox4.Visible = false;
                pictureBox2.Visible = false;
                pictureBox6.Visible = false;
                pictureBox7.Visible = false;
                pictureBox8.Visible = false;
                pictureBox9.Visible = false;
                pictureBox10.Visible = false;
                pictureBox14.Visible = false;
            }
            else if (comboBox1.SelectedItem.ToString() == "Mediterranean Region")
            {
                pictureBox1.Visible = false;
                pictureBox6.Visible = true;
                pictureBox3.Visible = false;
                pictureBox4.Visible = false;
                pictureBox5.Visible = false;
                pictureBox2.Visible = false;
                pictureBox7.Visible = false;
                pictureBox8.Visible = false;
                pictureBox9.Visible = false;
                pictureBox10.Visible = false;
                pictureBox14.Visible = false;
            }
            else if (comboBox1.SelectedItem.ToString() == "Central West")
            {
                pictureBox1.Visible = false;
                pictureBox7.Visible = true;
                pictureBox3.Visible = false;
                pictureBox4.Visible = false;
                pictureBox5.Visible = false;
                pictureBox6.Visible = false;
                pictureBox2.Visible = false;
                pictureBox8.Visible = false;
                pictureBox9.Visible = false;
                pictureBox10.Visible = false;
                pictureBox14.Visible = false;
            }
            else if (comboBox1.SelectedItem.ToString() == "Sweden, Finland")
            {
                pictureBox1.Visible = false;
                pictureBox8.Visible = true;
                pictureBox3.Visible = false;
                pictureBox4.Visible = false;
                pictureBox5.Visible = false;
                pictureBox6.Visible = false;
                pictureBox7.Visible = false;
                pictureBox2.Visible = false;
                pictureBox9.Visible = false;
                pictureBox10.Visible = false;
                pictureBox14.Visible = false;
            }
            else if (comboBox1.SelectedItem.ToString() == "UK, Republic of Ireland")
            {
                pictureBox1.Visible = false;
                pictureBox9.Visible = true;
                pictureBox3.Visible = false;
                pictureBox4.Visible = false;
                pictureBox5.Visible = false;
                pictureBox6.Visible = false;
                pictureBox7.Visible = false;
                pictureBox8.Visible = false;
                pictureBox2.Visible = false;
                pictureBox10.Visible = false;
                pictureBox14.Visible = false;
            }
            else if (comboBox1.SelectedItem.ToString() == "Norway")
            {
                pictureBox1.Visible = false;
                pictureBox10.Visible = true;
                pictureBox3.Visible = false;
                pictureBox4.Visible = false;
                pictureBox5.Visible = false;
                pictureBox6.Visible = false;
                pictureBox7.Visible = false;
                pictureBox8.Visible = false;
                pictureBox9.Visible = false;
                pictureBox2.Visible = false;
                pictureBox14.Visible = false;
            }
            else
            {
                pictureBox1.Visible = true;
                pictureBox2.Visible = false;
                pictureBox3.Visible = false;
                pictureBox4.Visible = false;
                pictureBox5.Visible = false;
                pictureBox6.Visible = false;
                pictureBox7.Visible = false;
                pictureBox8.Visible = false;
                pictureBox9.Visible = false;
                pictureBox10.Visible = false;
                pictureBox14.Visible = true;
            }
        }
        //end// region maps//
        //start//Sk CALCULATIONS//
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (!(string.IsNullOrEmpty(textBox1.Text)))
            {
                if (!(string.IsNullOrEmpty(comboBox2.Text)))
                {
                    pictureBox17.Visible = false;
                }
                else
                {
                    pictureBox17.Visible = true;
                }
                double Sk = 0;
                var Z = float.Parse(comboBox2.Text, CultureInfo.InvariantCulture.NumberFormat);
                var A = float.Parse(textBox1.Text, CultureInfo.InvariantCulture.NumberFormat);
                if (comboBox1.SelectedItem.ToString() == "Alpine Region")
                {
                    Sk = (0.642 * Z + 0.009) * (1 + (A / 728) * (A / 728));
                }
                else if (comboBox1.SelectedItem.ToString() == "Central East")
                {
                    Sk = (0.264 * Z - 0.002) * (1 + (A / 256) * (A / 256));
                }
                else if (comboBox1.SelectedItem.ToString() == "Greece")
                {
                    Sk = (0.420 * Z - 0.03) * (1 + (A / 917) * (A / 917));
                }
                else if (comboBox1.SelectedItem.ToString() == "Iberian Peninsula")
                {
                    Sk = (0.19 * Z - 0.095) * (1 + (A / 524) * (A / 524));
                }
                else if (comboBox1.SelectedItem.ToString() == "Mediterranean Region")
                {
                    Sk = (0.498 * Z - 0.209) * (1 + (A / 452) * (A / 452));
                }
                else if (comboBox1.SelectedItem.ToString() == "Central West")
                {
                    Sk = ((0.164 * Z) - 0.082 + (A / 966));
                }
                else if (comboBox1.SelectedItem.ToString() == "Sweden, Finland")
                {
                    Sk = ((0.790 * Z) + 0.375 + (A / 336));
                }
                else if (comboBox1.SelectedItem.ToString() == "UK, Republic of Ireland")
                {
                    Sk = ((0.140 * Z) - 0.1 + (A / 501));
                }
                else if (comboBox1.SelectedItem.ToString() == "Norway")
                {
                    if (Z == 1)
                    {
                        Sk = 1.75;
                    }
                    else if (Z == 2)
                    {
                        Sk = 3.25;
                    }
                    else if (Z == 3)
                    {
                        Sk = 4.75;
                    }
                    else if (Z == 4)
                    {
                        Sk = 6.25;
                    }
                    else if (Z == 4.5)
                    {
                        Sk = 9.5;
                    }
                }
                else if (comboBox1.SelectedItem.ToString() == "Select the Region")
                {
                    Sk = 0;
                }
                if (comboBox4.SelectedItem.ToString() == "Persistent / Transient")
                {
                        Sk = Math.Round(Sk, 3);
                        var strSk = "Sk = " + Sk.ToString();
                        strSk += " kN/m2";
                        this.label11.Text = strSk;
                        calculatedSk = Sk;
                        pictureBox15.Visible = false;
                }
                else if (comboBox4.SelectedItem.ToString() == "Accidental")
                {
                        Sk = Math.Round(2 * Sk, 3);
                        var strSk = "Sad = " + Sk.ToString();
                        strSk += " kN/m2";
                        this.label11.Text = strSk;
                        calculatedSk = Sk;
                        pictureBox15.Visible = false;
                }                
            }

        }
        private void checkBox_Checked(object sender, EventArgs e)
        {
            double Sk = 0;
            if (checkBox1.Checked == true)
            {
                textBox2.Visible = true;
                label5.Visible = true;
                button1.Enabled = false;
                comboBox1.Enabled = false;
                textBox1.Enabled = false;
                comboBox2.Enabled = false;
                button1.Enabled = false;
                comboBox4.Enabled = false;
                label11.Visible = false;
                pictureBox14.Visible = false; pictureBox15.Visible = false; pictureBox16.Visible = false; pictureBox17.Visible = false;

                if (!(string.IsNullOrEmpty(textBox2.Text)) && !(string.IsNullOrEmpty(comboBox3.Text)))
                {
                    var Skcon = float.Parse(textBox2.Text, CultureInfo.InvariantCulture.NumberFormat);
                    Sk = Skcon;
                    button2.Enabled = true;
                }
                else
                {
                    MessageBox.Show(" Please assign  'Sk [kN/m2]' that is provided by the contractor. ");
                    button2.Enabled = false;
                }
            }
            else if (checkBox1.Checked == false)
            {
                textBox2.Visible = false;
                label5.Visible = false;
                button1.Enabled = true;
                comboBox1.Enabled = true;
                textBox1.Enabled = true;
                comboBox2.Enabled = true;
                button1.Enabled = true;
                comboBox4.Enabled = true;
                label11.Visible = true;
            }
            calculatedSk = Sk;
            Sk = Math.Round(Sk, 3);
            var strSk = "Sk = " + Sk.ToString();
            strSk += " kN/m2";
            this.label11.Text = strSk;
        }
        //end//Sk CALCULATIONS//
        private void Calculate_Clicked(object sender, EventArgs e)
        {
            var Sk = calculatedSk;
            if (checkBox1.Checked == false)
            {
                
                var A = float.Parse(textBox1.Text, CultureInfo.InvariantCulture.NumberFormat);
                if (A > 1500)
                {
                    MessageBox.Show("Results will be presented. However, they are not applicable for sites at altitudes above 1500m. Please see EN1991-1-3, 1.1(2)", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            else
            {
                var Skcon = float.Parse(textBox2.Text, CultureInfo.InvariantCulture.NumberFormat);
                Sk = Skcon;
            }
            SnowECResult frm2 = new SnowECResult();
            frm2.Show();
            var ce = calculatedce;

            //start// MONOPITCHED ROOF CALCULATIONS//
            if (Monopitch.Checked == true)
            {
                if (!(string.IsNullOrEmpty(textBox3.Text)))
                {
                    var roofAngle1 = float.Parse(textBox3.Text, CultureInfo.InvariantCulture.NumberFormat);
                    double result = 0;
                    if (checkBox2.Checked == true)
                    {
                        textBox3.Enabled = true;
                        if (roofAngle1 >= 0 && roofAngle1 <= 30)
                        {
                            result = ce * Sk * 0.8;
                        }
                        else if (roofAngle1 > 30 && roofAngle1 < 60)
                        {
                            result = ce * Sk * 0.8 * (60 - roofAngle1) / 30;
                        }
                        else if (roofAngle1 >= 60 && roofAngle1 < 90)
                        {
                            result = 0;
                        }
                        else
                        {
                            frm2.Hide();
                            MessageBox.Show("Invalid Roof Angle!", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                    }
                    else if (checkBox2.Checked == false)
                    {
                        if (roofAngle1 < 90)
                        {
                            result = ce * Sk * 0.8;
                        }
                        else
                        {
                            frm2.Hide();
                            MessageBox.Show("Invalid Roof Angle!", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                    }
                    result = Math.Round(result, 3);
                    frm2.label1.Text = "S = " + result.ToString() + " kN/m2";
                    frm2.pictureBox1.Visible = true; frm2.label1.Visible = true;
                    if (checkBox1.Checked == false)
                    {
                        frm2.richTextBox1.AppendText("All calculations have been performed according to EN1991-1-3. For " + comboBox4.Text + " design situation and " + comboBox3.Text + " topography, results are listed below." + Environment.NewLine + Environment.NewLine + "Snow on the ground has calculated as " + calculatedSk + " kN/m2 for selected region by considering " + textBox1.Text + "m. altitude and " + comboBox2.Text + ". zone number." + Environment.NewLine + Environment.NewLine + "Snow Load on the monopitch roof is " + result + " kN/m2 when the roof angle is " + roofAngle1 + " degree. Sliding prevention is also taken into account. ");
                    }
                    else
                    {
                        frm2.richTextBox1.AppendText("All calculations have been performed according to EN1991-1-3. For " + comboBox4.Text + " design situation and " + comboBox3.Text + " topography, results are listed below." + Environment.NewLine + Environment.NewLine + "Snow on the ground is " + Sk + " kN/m2 that is provided by the contractor. " + Environment.NewLine + Environment.NewLine + "Snow Load on the monopitch roof is " + result + " kN/m2 when the roof angle is " + roofAngle1 + " degree. Sliding prevention is also taken into account. ");
                    }
                }
                else
                {
                    frm2.Close();
                    MessageBox.Show("Please fill required spaces", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            //end// MONOPITCHED ROOF CALCULATIONS//
            //start// PITCHED ROOF CALCULATIONS//
            else if (Pitched.Checked == true)
            {
                if (!(string.IsNullOrEmpty(textBox4.Text)) && !(string.IsNullOrEmpty(textBox5.Text)))
                {
                    var roofAngle1 = float.Parse(textBox4.Text, CultureInfo.InvariantCulture.NumberFormat);
                    var roofAngle2 = float.Parse(textBox5.Text, CultureInfo.InvariantCulture.NumberFormat);
                    double result = 0;
                    double result2 = 0;
                    if (checkBox3.Checked == true)
                    {
                        textBox4.Enabled = true;
                        textBox5.Enabled = true;
                        if (roofAngle1 >= 0 && roofAngle1 <= 30)
                        {
                            result = ce * Sk * 0.8;
                        }
                        else if (roofAngle1 > 30 && roofAngle1 < 60)
                        {
                            result = ce * Sk * 0.8 * (60 - roofAngle1) / 30;
                        }
                        else if (roofAngle1 >= 60 && roofAngle1 < 90)
                        {
                            result = 0;
                        }
                        else
                        {
                            frm2.Hide();
                            MessageBox.Show("Invalid Roof Angle 1!", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                        if (roofAngle2 >= 0 && roofAngle2 <= 30)
                        {
                            result2 = ce * Sk * 0.8;
                        }
                        else if (roofAngle2 > 30 && roofAngle2 < 60)
                        {
                            result2 = ce * Sk * 0.8 * (60 - roofAngle2) / 30;
                        }
                        else if (roofAngle2 >= 60 && roofAngle2 < 90)
                        {
                            result2 = 0;
                        }
                        else
                        {
                            frm2.Hide();
                            MessageBox.Show("Invalid Roof Angle 2!", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                    }
                    else if (checkBox3.Checked == false)
                    {
                        if (roofAngle1 < 90 && roofAngle2 < 90)
                        {
                            result = ce * Sk * 0.8;
                            result2 = ce * Sk * 0.8;
                        }
                        else
                        {
                            frm2.Hide();
                            MessageBox.Show("Invalid Roof Angle!", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                    }
                    result = Math.Round(result, 3);
                    result2 = Math.Round(result2, 3);
                    frm2.label4.Text = "S1=" + result.ToString() + Environment.NewLine + Environment.NewLine + Environment.NewLine + "S2=" + (result / 2).ToString() + Environment.NewLine + Environment.NewLine + Environment.NewLine + "S3=" + result.ToString();
                    frm2.label5.Text = result2.ToString() + " kN/m2" + Environment.NewLine + Environment.NewLine + Environment.NewLine + result2.ToString() + " kN/m2" + Environment.NewLine + Environment.NewLine + Environment.NewLine + (result2 / 2).ToString() + " kN/m2";
                    frm2.pictureBox2.Visible = true; frm2.label4.Visible = true; frm2.label5.Visible = true;
                    if (checkBox1.Checked == false)
                    {
                        frm2.richTextBox1.AppendText("All calculations have been performed according to EN1991-1-3. For " + comboBox4.Text + " design situation and " + comboBox3.Text + " topography, results are listed below." + Environment.NewLine + Environment.NewLine + "Snow on the ground has calculated as " + calculatedSk + " kN/m2 for selected region by considering " + textBox1.Text + "m. altitude and " + comboBox2.Text + ". zone number." + Environment.NewLine + Environment.NewLine + "Snow Load on the pitched roof is " + result + " and " + result2 + " kN/m2 when the roof angles are " + roofAngle1 + " and " + roofAngle2 + " degrees. Sliding prevention is also taken into account. There are three cases and they formed by implementation of exact values of snow loads and 50% decreased values of snow loads.");
                    }
                    else
                    {
                        frm2.richTextBox1.AppendText("All calculations have been performed according to EN1991-1-3. For " + comboBox4.Text + " design situation and " + comboBox3.Text + " topography, results are listed below." + Environment.NewLine + Environment.NewLine + "Snow on the ground is " + Sk + " kN/m2 that is provided by the contractor. "  + Environment.NewLine + Environment.NewLine + "Snow Load on the pitched roof is " + result + " and " + result2 + " kN/m2 when the roof angles are " + roofAngle1 + " and " + roofAngle2 + " degrees. Sliding prevention is also taken into account. There are three cases and they formed by implementation of exact values of snow loads and 50% decreased values of snow loads.");
                    
                }
                }
                else
                {
                    frm2.Close();
                    MessageBox.Show("Please fill required spaces", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            //end// PITCHED ROOF CALCULATIONS//
            //start// MULTI-SPAN ROOF CALCULATIONS//
            else if (Multi.Checked == true)
            {
                if (!(string.IsNullOrEmpty(textBox6.Text)) && !(string.IsNullOrEmpty(textBox7.Text)))
                {
                    var roofAngle1 = float.Parse(textBox6.Text, CultureInfo.InvariantCulture.NumberFormat);
                    var roofAngle2 = float.Parse(textBox7.Text, CultureInfo.InvariantCulture.NumberFormat);
                    var roofAngleMean = (roofAngle1 + roofAngle2) / 2;
                    double result = 0; double result2 = 0; double result3 = 0;
                    if (roofAngle1 < 60 && roofAngle2 < 60 && checkBox4.Checked == false)
                    {
                        if (roofAngle1 >= 0 && roofAngle1 <= 30)
                        {
                            result = ce * Sk * 0.8;
                        }
                        else if (roofAngle1 > 30 && roofAngle1 < 60)
                        {
                            result = ce * Sk * 0.8 * (60 - roofAngle1) / 30;
                        }
                        else if (roofAngle1 >= 60)
                        {
                            result = 0;
                        }
                        else
                        {
                        }
                        if (roofAngle2 >= 0 && roofAngle2 <= 30)
                        {
                            result2 = ce * Sk * 0.8;
                        }
                        else if (roofAngle2 > 30 && roofAngle2 < 60)
                        {
                            result2 = ce * Sk * 0.8 * (60 - roofAngle2) / 30;
                        }
                        else if (roofAngle2 >= 60)
                        {
                            result2 = 0;
                        }
                        else
                        {
                        }
                        if (roofAngleMean >= 0 && roofAngleMean <= 30)
                        {
                            result3 = ce * Sk * (0.8 + (0.8 * roofAngleMean / 30));
                        }
                        else if (roofAngleMean > 30 && roofAngleMean < 60)
                        {
                            result3 = ce * Sk * 1.6;
                        }
                        result = Math.Round(result, 3); result2 = Math.Round(result2, 3); result3 = Math.Round(result3, 3);
                        frm2.label6.Text = "S1=" + result.ToString() + "      " + result2.ToString() + "         " + result.ToString() + "     " + result2.ToString() + " kN/m2";
                        frm2.label7.Text = result3.ToString() + " kN/m2";
                        frm2.label8.Text = "S2=" + result.ToString() + " kN/m2" + "                                   " + result2.ToString() + " kN/m2";
                        frm2.pictureBox3.Visible = true; frm2.label6.Visible = true; frm2.label7.Visible = true; frm2.label8.Visible = true;
                        if (checkBox1.Checked == false)
                        {
                            frm2.richTextBox1.AppendText("All calculations have been performed according to EN1991-1-3. For " + comboBox4.Text + " design situation and " + comboBox3.Text + " topography, results are listed below." + Environment.NewLine + Environment.NewLine + "Snow on the ground has calculated as " + calculatedSk + " kN/m2 for selected region by considering " + textBox1.Text + "m. altitude and " + comboBox2.Text + ". zone number." + Environment.NewLine + Environment.NewLine + "Snow Load on the multi-span roof is " + result + ", " + result2 + " and " + result3 + " kN/m2 when the roof angles are " + roofAngle1 + " and " + roofAngle2 + " degrees. There is no exceptional snow drifts at the region. There are two cases; in the first case, snow is spread over the roof and in the second case accumulation is taken into account.");
                        }
                        else
                        {
                            frm2.richTextBox1.AppendText("All calculations have been performed according to EN1991-1-3. For " + comboBox4.Text + " design situation and " + comboBox3.Text + " topography, results are listed below." + Environment.NewLine + Environment.NewLine + "Snow on the ground is " + Sk + " kN/m2 that is provided by the contractor. "  + Environment.NewLine + Environment.NewLine + "Snow Load on the multi-span roof is " + result + ", " + result2 + " and " + result3 + " kN/m2 when the roof angles are " + roofAngle1 + " and " + roofAngle2 + " degrees. There is no exceptional snow drifts at the region. There are two cases; in the first case, snow is spread over the roof and in the second case accumulation is taken into account.");
                        }

                    }
                    else
                    {
                        if (!(string.IsNullOrEmpty(textBox8.Text)) && !(string.IsNullOrEmpty(textBox9.Text)) && !(string.IsNullOrEmpty(textBox10.Text)) && !(string.IsNullOrEmpty(textBox11.Text)))
                        {
                            if (roofAngle1 < 90 && roofAngle2 < 90)
                            {
                                var h = float.Parse(textBox8.Text, CultureInfo.InvariantCulture.NumberFormat);
                                var b1 = float.Parse(textBox9.Text, CultureInfo.InvariantCulture.NumberFormat);
                                var b2 = float.Parse(textBox10.Text, CultureInfo.InvariantCulture.NumberFormat);
                                var b3 = float.Parse(textBox11.Text, CultureInfo.InvariantCulture.NumberFormat);

                                double x1 = 2 * h / Sk;
                                double x2 = 2 * b3 / (b1 + b2);
                                int x3 = 5;
                                double min = Math.Min(Math.Min(x1, x2), x3);
                                result3 = ce * Sk * min;
                                result3 = Math.Round(result3, 3);
                                frm2.label9.Text = "S = " + result3.ToString() + " kN/m2";
                                frm2.pictureBox4.Visible = true; frm2.label9.Visible = true;
                                if (checkBox1.Checked == false)
                                {
                                    frm2.richTextBox1.AppendText("All calculations have been performed according to EN1991-1-3. For " + comboBox4.Text + " design situation and " + comboBox3.Text + " topography, results are listed below." + Environment.NewLine + Environment.NewLine + "Snow on the ground has calculated as " + calculatedSk + " kN/m2 for selected region by considering " + textBox1.Text + "m. altitude and " + comboBox2.Text + ". zone number." + Environment.NewLine + Environment.NewLine + "Snow Load on the multi-span roof is " + result3 + " kN/m2 when the roof angles are " + roofAngle1 + " and " + roofAngle2 + " degrees. There is exceptional snow drifts at the region. The case is formed by considering accumulation between roofs.");
                                }
                                else
                                {
                                    frm2.richTextBox1.AppendText("All calculations have been performed according to EN1991-1-3. For " + comboBox4.Text + " design situation and " + comboBox3.Text + " topography, results are listed below." + Environment.NewLine + Environment.NewLine + "Snow on the ground is " + Sk + " kN/m2 that is provided by the contractor. " + Environment.NewLine + Environment.NewLine + "Snow Load on the multi-span roof is " + result3 + " kN/m2 when the roof angles are " + roofAngle1 + " and " + roofAngle2 + " degrees. There is exceptional snow drifts at the region. The case is formed by considering accumulation between roofs.");
                                }
                            }
                            else
                            {
                                frm2.Hide();
                                MessageBox.Show("Invalid Roof Angle!", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            }
                        }
                        else
                        {
                            frm2.Close();
                            MessageBox.Show("Please fill required spaces", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                    }
                }
                else
                {
                    frm2.Close();
                    MessageBox.Show("Please fill required spaces", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            //end// MULTI-SPAN ROOF CALCULATIONS//
            //start// CYLINDRICAL ROOF CALCULATIONS//
            else if (Cylindrical.Checked == true)
            {
                if (!(string.IsNullOrEmpty(textBox12.Text)) && !(string.IsNullOrEmpty(textBox13.Text)) && !(string.IsNullOrEmpty(textBox14.Text)))
                {
                    double result = 0;
                    double result2 = ce * Sk * 0.8;
                    var beta = float.Parse(textBox12.Text, CultureInfo.InvariantCulture.NumberFormat);
                    var h = float.Parse(textBox13.Text, CultureInfo.InvariantCulture.NumberFormat);
                    var b = float.Parse(textBox14.Text, CultureInfo.InvariantCulture.NumberFormat);
                    double y = (0.2 + (10 * h / b));
                    double x = Math.Min(y, 2);
                    if (beta < 90)
                    {
                        if (beta <= 60)
                        {
                            result = ce * Sk * x;
                        }
                        else
                        {
                            result = 0;
                        }
                        result = Math.Round(result, 3); result2 = Math.Round(result2, 3);
                        frm2.label10.Text = result2.ToString() + " kN/m2" + Environment.NewLine + Environment.NewLine + Environment.NewLine + result.ToString() + " kN/m2";
                        frm2.label11.Text = (result / 2).ToString() + " kN/m2";
                        frm2.pictureBox5.Visible = true; frm2.label10.Visible = true; frm2.label11.Visible = true;
                        if (checkBox1.Checked == false)
                        {
                            frm2.richTextBox1.AppendText("All calculations have been performed according to EN1991-1-3. For " + comboBox4.Text + " design situation and " + comboBox3.Text + " topography, results are listed below." + Environment.NewLine + Environment.NewLine + "Snow on the ground has calculated as " + calculatedSk + " kN/m2 for selected region by considering " + textBox1.Text + "m. altitude and " + comboBox2.Text + ". zone number." + Environment.NewLine + Environment.NewLine + "Snow Load on the cylindrical roof is " + result + ", " + result2 + " and " + result / 2 + " kN/m2 when the roof variables are; beta=" + beta + ", h=" + h + " and b=" + b + " degree/meters. The snow load quantities that should be used for cylindrical roofs, are given in the figures as case 1 and 2.");
                        }
                        else
                        {
                            frm2.richTextBox1.AppendText("All calculations have been performed according to EN1991-1-3. For " + comboBox4.Text + " design situation and " + comboBox3.Text + " topography, results are listed below." + Environment.NewLine + Environment.NewLine + "Snow on the ground is " + Sk + " kN/m2 that is provided by the contractor. " + Environment.NewLine + Environment.NewLine + "Snow Load on the cylindrical roof is " + result + ", " + result2 + " and " + result / 2 + " kN/m2 when the roof variables are; beta=" + beta + ", h=" + h + " and b=" + b + " degree/meters. The snow load quantities that should be used for cylindrical roofs, are given in the figures as case 1 and 2.");
                        }
                    }
                    else
                    {
                        frm2.Hide();
                        MessageBox.Show("Invalid Roof Angle!", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
                else
                {
                    frm2.Close();
                    MessageBox.Show("Please fill required spaces", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            //end// CYLINDRICAL ROOF CALCULATIONS//
            //start// ROOF ABUTTING CALCULATIONS//
            else if (Abutting.Checked == true)
            {
                if (!(string.IsNullOrEmpty(textBox15.Text)) && !(string.IsNullOrEmpty(textBox16.Text)) && !(string.IsNullOrEmpty(textBox17.Text)) && !(string.IsNullOrEmpty(textBox18.Text)) && !(string.IsNullOrEmpty(textBox19.Text)))
                {
                    double result = 0; double result3 = 0;
                    double result2 = ce * Sk * 0.8;
                    var roofAngle1 = float.Parse(textBox15.Text, CultureInfo.InvariantCulture.NumberFormat);
                    var roofAngle2 = float.Parse(textBox19.Text, CultureInfo.InvariantCulture.NumberFormat);
                    var h = float.Parse(textBox16.Text, CultureInfo.InvariantCulture.NumberFormat);
                    double ls = Math.Max(Math.Min(2 * h, 15), 5);
                    var b1 = float.Parse(textBox17.Text, CultureInfo.InvariantCulture.NumberFormat);
                    var b2 = float.Parse(textBox18.Text, CultureInfo.InvariantCulture.NumberFormat);
                    double x = Math.Max(Math.Min(Math.Min((b1 + b2) / 2 * h, 2 * h / Sk), 4), 0.8);
                    result3 = ce * Sk * x;
                    if (roofAngle1 <= 15)
                    {
                        if (roofAngle2 < 90)
                        {
                            result = ce * Sk * x;
                        }
                        else
                        {
                            frm2.Hide();
                            MessageBox.Show("Invalid Roof Angle!", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                    }
                    else if (roofAngle1 > 15 && roofAngle1 < 90)
                    {
                        if (roofAngle2 >= 0 && roofAngle2 <= 30)
                        {
                            result = ce * Sk * (x + 0.8);
                        }
                        else if (roofAngle2 > 30 && roofAngle2 < 60)
                        {
                            result = ce * Sk * (x + 0.8 * (60 - roofAngle2) / 30);

                        }
                        else if (roofAngle2 >= 60 && roofAngle2 < 90)
                        {
                            result = ce * Sk * x;
                        }
                        else
                        {
                            frm2.Hide();
                            MessageBox.Show("Invalid Roof Angle!", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                    }
                    else
                    {
                        frm2.Hide();
                        MessageBox.Show("Invalid Roof Angle!", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                    result = Math.Round(result, 3); result2 = Math.Round(result2, 3); ls = Math.Round(ls, 3); result3 = Math.Round(result3, 3);
                    frm2.label13.Text = result.ToString() + " kN/m2";
                    frm2.label14.Text = "= " + ls.ToString() + " m";
                    frm2.label15.Text = (result - result3).ToString() + " kN/m2" + Environment.NewLine + Environment.NewLine + Environment.NewLine + result3.ToString() + " kN/m2";
                    frm2.label13.Visible = true; frm2.label14.Visible = true; frm2.label15.Visible = true;
                    if (checkBox1.Checked == false)
                    {
                        frm2.richTextBox1.AppendText("All calculations have been performed according to EN1991-1-3. For " + comboBox4.Text + " design situation and " + comboBox3.Text + " topography, results are listed below." + Environment.NewLine + Environment.NewLine + "Snow on the ground has calculated as " + calculatedSk + " kN/m2 for selected region by considering " + textBox1.Text + "m. altitude and " + comboBox2.Text + ". zone number." + Environment.NewLine + Environment.NewLine + "Snow Load on the abutting roof is " + result2 + " and " + result + " kN/m2 when the roof variables are; RoofAngle1=" + roofAngle1 + ", RoofAngle2=" + roofAngle2 + ", h=" + h + ", b1=" + b1 + " and b2=" + b2 + " degree/meters." + (result - result3) + " kN/m2 is the snow load due to sliding of snow from the upper roof and" + result3 + " kN/m2 is the snow load due to wind. The snow load quantities that should be used for abutting roofs, are given in the figures as case 1 and 2.");
                    }
                    else
                    {
                        frm2.richTextBox1.AppendText("All calculations have been performed according to EN1991-1-3. For " + comboBox4.Text + " design situation and " + comboBox3.Text + " topography, results are listed below." + Environment.NewLine + Environment.NewLine + "Snow on the ground is " + Sk + " kN/m2 that is provided by the contractor. " + Environment.NewLine + Environment.NewLine + "Snow Load on the abutting roof is " + result2 + " and " + result + " kN/m2 when the roof variables are; RoofAngle1=" + roofAngle1 + ", RoofAngle2=" + roofAngle2 + ", h=" + h + ", b1=" + b1 + " and b2=" + b2 + " degree/meters." + (result - result3) + " kN/m2 is the snow load due to sliding of snow from the upper roof and" + result3 + " kN/m2 is the snow load due to wind. The snow load quantities that should be used for abutting roofs, are given in the figures as case 1 and 2.");
                    }
                    if (b2 > ls)
                    {
                        frm2.pictureBox6.Visible = true; frm2.label12.Visible = true;
                        frm2.label12.Text = result2.ToString() + " kN/m2" + Environment.NewLine + Environment.NewLine + Environment.NewLine + Environment.NewLine + Environment.NewLine + Environment.NewLine + Environment.NewLine + result2.ToString() + " kN/m2";
                    }
                    else
                    {
                        frm2.pictureBox7.Visible = true; frm2.label16.Visible = true;
                        frm2.label16.Text = result2.ToString() + " kN/m2";
                    }
                }
                else
                {
                    frm2.Close();
                    MessageBox.Show("Please fill required spaces", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            else
            {
                frm2.Hide();
                MessageBox.Show("Please select the roof type and fill required spaces.");
            }
            //end// ROOF ABUTTING CALCULATIONS//
        }
        private void radioButtonX_CheckChanged(object sender, EventArgs e)
        {
            button3.Visible = true;
            if (Monopitch.Checked == true)
            {
                Pitched.Enabled = false;
                Multi.Enabled = false;
                Cylindrical.Enabled = false;
                Abutting.Enabled = false;
                panel1.Visible = true; textBox3.Visible = true; pictureBox21.Visible = true;
            }
            else if (Pitched.Checked == true)
            {
                Monopitch.Enabled = false;
                Multi.Enabled = false;
                Cylindrical.Enabled = false;
                Abutting.Enabled = false;
                panel2.Visible = true; pictureBox20.Visible = true;
            }
            else if (Multi.Checked == true)
            {
                Monopitch.Enabled = false;
                Pitched.Enabled = false;
                Cylindrical.Enabled = false;
                Abutting.Enabled = false;
                panel3.Visible = true; pictureBox19.Visible = true;
                label18.Visible = false; label19.Visible = false; label20.Visible = false; label21.Visible = false; pictureBox11.Visible = false;
                textBox8.Visible = false; textBox9.Visible = false; textBox10.Visible = false; textBox11.Visible = false;
            }
            else if (Cylindrical.Checked == true)
            {
                Monopitch.Enabled = false;
                Pitched.Enabled = false;
                Multi.Enabled = false;
                Abutting.Enabled = false;
                panel4.Visible = true; pictureBox12.Visible = true;
            }
            else if (Abutting.Checked == true)
            {
                Monopitch.Enabled = false;
                Pitched.Enabled = false;
                Cylindrical.Enabled = false;
                Multi.Enabled = false;
                panel5.Visible = true; pictureBox13.Visible = true;
            }
            else
            {
                Monopitch.Enabled = true;
                Pitched.Enabled = true;
                Cylindrical.Enabled = true;
                Multi.Enabled = true;
                Abutting.Enabled = true;
            }
        }
        private void backButton_Clicked(object sender, EventArgs e)
        {
            button3.Visible = false;

            Monopitch.Checked = false; Pitched.Checked = false; Multi.Checked = false; Cylindrical.Checked = false; Abutting.Checked = false;
            panel1.Visible = false; panel2.Visible = false; panel3.Visible = false; panel4.Visible = false; panel5.Visible = false; textBox3.Visible = false;
            pictureBox11.Visible = false; pictureBox12.Visible = false; pictureBox13.Visible = false; pictureBox19.Visible = false; pictureBox20.Visible = false; pictureBox21.Visible = false;

            button3.PerformClick();
        }
        private void richTextBox3_TextChanged(object sender, EventArgs e)
        {

        }
        private void multiSpanAngle_TextChanged(object sender, EventArgs e)
        {
            if (!(string.IsNullOrEmpty(textBox6.Text)) && !(string.IsNullOrEmpty(textBox7.Text)))
            {
                double x = 0; double y = 0;
                x = float.Parse(textBox6.Text, CultureInfo.InvariantCulture.NumberFormat);
                y = float.Parse(textBox7.Text, CultureInfo.InvariantCulture.NumberFormat);
                if (x >= 60 || y >= 60 || checkBox4.Checked == true)
                {
                    label18.Visible = true; label19.Visible = true; label20.Visible = true; label21.Visible = true; pictureBox11.Visible = true;
                    textBox8.Visible = true; textBox9.Visible = true; textBox10.Visible = true; textBox11.Visible = true;
                }
                else
                {
                    label18.Visible = false; label19.Visible = false; label20.Visible = false; label21.Visible = false; pictureBox11.Visible = false;
                    textBox8.Visible = false; textBox9.Visible = false; textBox10.Visible = false; textBox11.Visible = false;
                }
            }
        }

        private void textBox2_TextChanged(object sender, EventArgs e)
        {
            if (!(string.IsNullOrEmpty(textBox2.Text)) && !(string.IsNullOrEmpty(comboBox3.Text)))
            {
                button2.Enabled = true;
            }
            else
            {
                button2.Enabled = false;
            }
        }


    }
    }
    



Wind Load

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;


namespace tempSS
{
    public partial class WindEC : Form
    {
        int i, j, boundary;
        double z0;
        double zmin;
        double kr;
        double zmax = 200;
        double co = 1;
        double kI = 1;
        double cscd = 1;
        double density = 0.00125;
        double A, A1, A2, A3, B, B1, B2, C, C1, C2;
        double cpiA; double cfA; double cpiB; double cfB; double cpiC; double cfC; double cpiD; double cfD; double cpiE; double cfE; double cpiF; double cfF; double cpiF2; double cfF2; double cpiG; double cfG; double cpiG2; double cfG2; double cpiH; double cfH; double cpiH2; double cfH2; double cpiI; double cfI; double cpiI2; double cfI2; double cpiJ; double cfJ; double cpiJ2; double cfJ2; double cpiK; double cfK; double cpiL; double cfL; double cpiM; double cfM; double cpiN; double cfN;
        double cpiF180; double cfF180; double cpiG180; double cfG180; double cpiH180; double cfH180;
        double cpiFup90; double cfFup90; double cpiFlow90; double cfFlow90; double cpiG90; double cfG90; double cpiH90; double cfH90;

        private void pictureBox24_Click(object sender, EventArgs e)
        {
            MessageBox.Show("0 ; Sea, coastal area exposed to the open sea. " + Environment.NewLine + Environment.NewLine + "I ; Lakes or area with negligible vegetation and without obstacles. " + Environment.NewLine + Environment.NewLine + "II; Arae with low vegetation such as grass and isolated obstacles(trees, buildings) with separations of at least 20 obstacle heights. " + Environment.NewLine + Environment.NewLine + "III; Area withregular cover of vegetation or buildings or with isolated obstacles with separations of maximum 20 obstacle heights (such as villages, suburban terrain, permanent forest)" + Environment.NewLine + Environment.NewLine + "IV; Area in which at least 15 % of the surface is covered with buildings and their average height exceeds 15 m. ");
        }

        private void pictureBox23_Click(object sender, EventArgs e)
        {
            MessageBox.Show("The 10 minute mean wind velocity with an annual risk of being exceeded of 0.02, irrespective of wind direction, at a height of 10 m above flat open country terrain and accounting for altitude effects (if required).");
        }

        double cpiI90; double cfI90; double cpiF90; double cfF90;
        double resultA, resultB, resultC, resultD, resultE, resultF, resultG, resultH, resultI, resultJ, resultI2, resultF2, resultG2, resultH2, resultJ2, resultF180, resultG180, resultH180, resultF90, resultFup90, resultFlow90, resultG90, resultH90, resultI90, resultK, resultL, resultM, resultN;


            

        public WindEC()
        {
            InitializeComponent();


        }
        private WindECResult frm2;
        private void WindEC_Load(object sender, EventArgs e)
        {
            frm2 = new WindECResult();
            panel1.Visible = false;
            button3.Visible = false;
            button1.Enabled = false;
          
            panel3.Visible = false; panel4.Visible = false; panel5.Visible = false; panel6.Visible = false; panel7.Visible = false; panel8.Visible = false; panel9.Visible = false; panel10.Visible = false;
            label13.Visible = false; textBox10.Visible = false;

            pictureBox7.Visible = false; pictureBox8.Visible = false; pictureBox9.Visible = false; pictureBox10.Visible = false; pictureBox11.Visible = false; pictureBox12.Visible = false; pictureBox13.Visible = false; pictureBox14.Visible = false; pictureBox15.Visible = false;
            pictureBox17.Visible = false; pictureBox18.Visible = false; pictureBox19.Visible = false; pictureBox20.Visible = false; pictureBox21.Visible = false; pictureBox22.Visible = false;
        }
        //start//Only numbers are allowed// 
        private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar) &&
                (e.KeyChar != '.'))
            {
                e.Handled = true;
            }
            if ((e.KeyChar == '.') && ((sender as TextBox).Text.IndexOf('.') > -1))
            {
                e.Handled = true;
            }
            if ((sender as TextBox).Text.Count(Char.IsDigit) >= 5)
                e.Handled = true;
        }
        //end//Only numbers are allowed// 
        //start//Required spaces
        private void requiredspaces(object sender, EventArgs e)
        {
            if (!(string.IsNullOrEmpty(comboBox1.Text)) && !(string.IsNullOrEmpty(comboBox2.Text)) && !(string.IsNullOrEmpty(textBox1.Text)) && !(string.IsNullOrEmpty(textBox2.Text)) && (checkBox1.Checked==true))
            {
                button1.Enabled = true;

            }
            else if (!(string.IsNullOrEmpty(comboBox1.Text)) && !(string.IsNullOrEmpty(comboBox2.Text)) && !(string.IsNullOrEmpty(textBox1.Text)) && !(string.IsNullOrEmpty(textBox2.Text)) && (checkBox1.Checked == false) && !(string.IsNullOrEmpty(textBox3.Text)) && !(string.IsNullOrEmpty(textBox4.Text)) && !(string.IsNullOrEmpty(textBox5.Text)))
            {
                button1.Enabled = true;

            }
            else
            {
                button1.Enabled = false;
            }
            if (!(string.IsNullOrEmpty(textBox2.Text)))
            {
                pictureBox16.Visible = false;
            }
            else
            {
                pictureBox16.Visible = true;
            }
            if (!(string.IsNullOrEmpty(comboBox1.Text)))
            {
                pictureBox3.Visible = false;
            }
            else
            {
                pictureBox3.Visible = true;
            }
            if (!(string.IsNullOrEmpty(textBox1.Text)))
            {
                pictureBox2.Visible = false;
            }
            else
            {
                pictureBox2.Visible = true;
            }
            if (!(string.IsNullOrEmpty(comboBox2.Text)))
            {
                pictureBox1.Visible = false;
            }
            else
            {
                pictureBox1.Visible = true;
            }
            if (!(string.IsNullOrEmpty(textBox3.Text)))
            {
                pictureBox4.Visible = false;
            }
            else
            {
                pictureBox4.Visible = true;
            }
            if (!(string.IsNullOrEmpty(textBox4.Text)))
            {
                pictureBox5.Visible = false;
            }
            else
            {
                pictureBox5.Visible = true;
            }
            if (!(string.IsNullOrEmpty(textBox5.Text)))
            {
                pictureBox6.Visible = false;
            }
            else
            {
                pictureBox6.Visible = true;
            }
            //end//Required spaces
        }
        private void TerrainCategory(object sender, EventArgs e)
        {
            WindECResult frm2 = new WindECResult();
            frm2.Show();
            var z = float.Parse(textBox1.Text, CultureInfo.InvariantCulture.NumberFormat);
            var vb = float.Parse(textBox2.Text, CultureInfo.InvariantCulture.NumberFormat);
            double cr = 1;
            double Iv = 1;
            if (checkBox1.Checked == false)
            {
                cscd = float.Parse(textBox3.Text, CultureInfo.InvariantCulture.NumberFormat);
                co = float.Parse(textBox4.Text, CultureInfo.InvariantCulture.NumberFormat);
                density = float.Parse(textBox5.Text, CultureInfo.InvariantCulture.NumberFormat); density = density / 1000;
            }
            else
            {
                cscd = 1.0; co = 1.0; density = 0.00125;
            }
            if (comboBox1.SelectedItem.ToString() == "0")
            {
                z0 = 0.003; zmin = 1;
            }
            else if (comboBox1.SelectedItem.ToString() == "I")
            {
                z0 = 0.01; zmin = 1;
            }
            else if (comboBox1.SelectedItem.ToString() == "II")
            {
                z0 = 0.05; zmin = 2;
            }
            else if (comboBox1.SelectedItem.ToString() == "III")
            {
                z0 = 0.3; zmin = 5;
            }
            else if (comboBox1.SelectedItem.ToString() == "IV")
            {
                z0 = 1; zmin = 10;
            }

            kr = 0.19 * Math.Pow((z0 / 0.05), 0.07);

            if (zmin <= z && z <= zmax)
            {
                cr = kr * Math.Log(z / z0);
                Iv = kI / (co * Math.Log(z / z0));
            }
            else if (z < zmin)
            {
                cr = kr * Math.Log(zmin / z0);
                Iv = kI / (co * Math.Log(zmin / z0));
            }
            else
            {
                cr = kr * Math.Log(z / z0);
                Iv = kI / (co * Math.Log(z / z0));
                frm2.Hide();
                MessageBox.Show("EN wind action specification is applicable to buildings and civil engineering works with heights up to 200 m.");
            }

            var vm = cr * co * vb;
            vm = Math.Round(vm, 3);

            var qp = (1 + 7 * Iv) * density / 2 * Math.Pow(vm, 2);
            qp = Math.Round(qp, 3);

            //just for test//
            var basic = "vm = " + vm.ToString() + " m/s   qp = " + qp.ToString();
            basic += " kN/m2";
            this.label4.Text = basic;
            //just for test//

            //start//Vertical walls of rectangular plan buildings//
            if (walls.Checked == true)
            {
                if (!(string.IsNullOrEmpty(textBox6.Text)) && !(string.IsNullOrEmpty(textBox7.Text)) && !(string.IsNullOrEmpty(textBox8.Text)))
                {
                    frm2.pictureBox5.Visible = true; frm2.label6.Visible = true; frm2.label7.Visible = true; frm2.label10.Visible = true; frm2.label8.Visible = true;
                    var h = float.Parse(textBox6.Text, CultureInfo.InvariantCulture.NumberFormat);
                    var b = float.Parse(textBox7.Text, CultureInfo.InvariantCulture.NumberFormat);
                    double ee = Math.Min(b, 2 * h); ee = Math.Round(ee, 3);
                    var d = float.Parse(textBox8.Text, CultureInfo.InvariantCulture.NumberFormat);
                    double cr2 = 1; double Iv2 = 1;
                    cfA = -1.2; cfB = -0.8; cfC = -0.5;
                    double[,] Tablero = new double[3, 5] { { -1.2, -0.8, -0.5, 0.8, -0.7 }, { -1.2, -0.8, -0.5, 0.8, -0.5 }, { -1.2, -0.8, -0.5, 0.7, -0.3 } };
                    if (z >= h)
                    {
                        if (h / d > 5)
                        {
                            frm2.Hide();
                            if (d / b <= 0.2)
                            {
                                resultA = cscd * qp * 2.0;
                            }
                            else if (d / b > 0.2 && d / b <= 0.6)
                            {
                                resultA = cscd * qp * (2 + 0.875 * (d / b - 0.2));
                            }
                            else if (d / b > 0.6 && d / b <= 0.7)
                            {
                                resultA = cscd * qp * (2.35 + 0.5 * (d / b - 0.6));
                            }
                            else if (d / b > 0.7 && d / b <= 5)
                            {
                                resultA = cscd * qp * (2.4 - 0.3256 * (d / b - 0.7));
                            }
                            else if (d / b > 5 && d / b <= 10)
                            {
                                resultA = cscd * qp * (1 - 0.02 * (d / b - 5));
                            }
                            else if (d / b > 10)
                            {
                                resultA = cscd * qp * 0.9;
                            }
                            resultA = Math.Round(resultA, 3);
                            MessageBox.Show("For buildings with h/d > 5, the total wind loading is  '" + resultA.ToString() + "kN/m2.'   Please follow EN 1991-1-4:2004, Page 67 for reduction and end-effect factors. ");
                        }
                        else if (1 <= h / d && h / d <= 5)
                        {
                            cfE = -0.5 + (Tablero[0, 4] - Tablero[1, 4]) / 4 * (h / d - 1);
                            cfD = 0.8;
                        }
                        else if (0.25 < h / d && h / d < 1)
                        {
                            cfD = 0.7 + (Tablero[1, 3] - Tablero[2, 3]) / 0.75 * (h / d - 0.25);
                            cfE = -0.3 + (Tablero[1, 4] - Tablero[2, 4]) / 0.75 * (h / d - 0.25);
                        }
                        else if (0.25 >= h / d)
                        {
                            cfD = 0.7; cfE = -0.3;
                        }
                        //cpi calc
                        if (comboBox2.SelectedItem.ToString() == "It's not possible to estimate")
                        {
                            if (cfA >= 0)
                            {
                                cpiA = 0.2;
                            }
                            else
                            {
                                cpiA = -0.3;
                            }
                            if (cfB >= 0)
                            {
                                cpiB = 0.2;
                            }
                            else
                            {
                                cpiB = -0.3;
                            }
                            if (cfC >= 0)
                            {
                                cpiC = 0.2;
                            }
                            else
                            {
                                cpiC = -0.3;
                            }
                            if (cfD >= 0)
                            {
                                cpiD = 0.2;
                            }
                            else
                            {
                                cpiD = -0.3;
                            }
                            if (cfE >= 0)
                            {
                                cpiE = 0.2;
                            }
                            else
                            {
                                cpiE = -0.3;
                            }
                        }
                        else if (comboBox2.SelectedItem.ToString() == "Openings at the dominant face is twice the area of the openings in the remaining faces")
                        {
                            cpiA = 0.75 * cfA; cpiB = 0.75 * cfB; cpiC = 0.75 * cfC; cpiD = 0.75 * cfD; cpiE = 0.75 * cfE;
                        }
                        else if (comboBox2.SelectedItem.ToString() == "Openings at the dominant face is at least 3 times the area of the openings in the remaining faces")
                        {
                            cpiA = 0.9 * cfA; cpiB = 0.9 * cfB; cpiC = 0.9 * cfC; cpiD = 0.9 * cfD; cpiE = 0.9 * cfE;
                        }
                        else if (comboBox2.SelectedItem.ToString() == "Open silos and chimneys")
                        {
                            cpiA = -0.6; cpiB = -0.6; cpiC = -0.6; cpiD = -0.6; cpiE = -0.6;
                        }
                        else if (comboBox2.SelectedItem.ToString() == "Vented tanks with small openings")
                        {
                            cpiA = -0.4; cpiB = -0.4; cpiC = -0.4; cpiD = -0.4; cpiE = -0.4;
                        }

                        //cpi calc
                        resultA = cscd * (cfA + cpiA) * qp; resultB = cscd * (cfB + cpiB) * qp; resultC = cscd * (cfC + cpiC) * qp; resultD = cscd * (cfD + cpiD) * qp; resultE = cscd * (cfE + cpiE) * qp;
                        resultA = Math.Round(resultA, 3); resultB = Math.Round(resultB, 3); resultC = Math.Round(resultC, 3); resultD = Math.Round(resultD, 3); resultE = Math.Round(resultE, 3);
                        frm2.richTextBox1.AppendText("All calculations have performed according to EN1991-1-4. Wind actions on vertical walls of rectangular plan buildings have been calculated for height above ground;" + textBox1.Text + " m. terrain category; " + comboBox1.Text + " and basic wind velocity;" + textBox2.Text + " m/s. In addition, openings in building is specified as " + comboBox2.Text + Environment.NewLine + Environment.NewLine + "Wind actions on vertical walls of rectangular plan buildings have been calculated as a pressure. Pressure varies between different zones. Pressures on crosswind areas should be applied like the pressure profile figure(for D and E), however, the velocity pressure should be assumed to be uniform over each horizontal strip considered.(for A, B and C)" + Environment.NewLine + Environment.NewLine + "Note1: Positive sign indicates that it is a pressure, negative sign is used for suction." + Environment.NewLine + "Note2: For another case, 'b' and 'd' values should be changed. That means wind direction will be changed 90 degree.");


                        if (zmin <= b && b <= zmax)
                        {
                            cr2 = kr * Math.Log(b / z0);
                        }
                        else if (b < zmin)
                        {
                            cr2 = kr * Math.Log(zmin / z0);
                        }

                        var vm2 = cr2 * co * vb;

                        if (zmin <= b && b <= zmax)
                        {
                            Iv2 = kI / (co * Math.Log(b / z0));
                        }
                        else if (b < zmin)
                        {
                            Iv2 = kI / (co * Math.Log(zmin / z0));
                        }
                        var resultD2 = cscd * (cfD + cpiD) * ((1 + 7 * Iv2) * density / 2 * Math.Pow(vm2, 2)); resultD2 = Math.Round(resultD2, 3);

                        if (b >= h)
                        {
                            frm2.label1.Text = resultD.ToString() + " kN/m2";
                            frm2.pictureBox1.Visible = true; frm2.label1.Visible = true;
                        }
                        else if (h > b && h <= 2 * b)
                        {
                            frm2.label1.Text = resultD.ToString() + " kN/m2";
                            frm2.pictureBox2.Visible = true; frm2.label1.Visible = true; frm2.label4.Visible = true;
                            frm2.label4.Text = resultD2.ToString() + " kN/m2";
                        }
                        else if (h > 2 * b)
                        {
                            frm2.label1.Text = resultD.ToString() + " kN/m2";
                            frm2.pictureBox3.Visible = true; frm2.label1.Visible = true; frm2.label5.Visible = true;
                            frm2.label5.Text = resultD2.ToString() + " kN/m2";
                        }

                        if (ee < d)
                        {
                            frm2.label8.Text = "QA= " + resultA.ToString() + " kN/m2" + Environment.NewLine + Environment.NewLine + "QB= " + resultB.ToString() + " kN/m2" + Environment.NewLine + Environment.NewLine + "QC= " + resultC.ToString() + " kN/m2" + Environment.NewLine + Environment.NewLine + "QD= " + resultD.ToString() + " kN/m2" + Environment.NewLine + Environment.NewLine + "QE= " + resultE.ToString() + " kN/m2";
                            frm2.label9.Text = "e= " + ee.ToString() + " m.";
                            frm2.pictureBox4.Visible = true; frm2.label9.Visible = true;
                        }
                        else if (ee >= d && ee < 5 * d)
                        {
                            frm2.label8.Text = "QA= " + resultA.ToString() + " kN/m2" + Environment.NewLine + Environment.NewLine + "QB= " + resultB.ToString() + " kN/m2" + Environment.NewLine + Environment.NewLine + "QD= " + resultD.ToString() + " kN/m2" + Environment.NewLine + Environment.NewLine + "QE= " + resultE.ToString() + " kN/m2";
                            frm2.label9.Text = "e= " + ee.ToString() + " m.";
                            frm2.pictureBox6.Visible = true; frm2.label9.Visible = true;
                        }
                        else if (ee >= 5 * d)
                        {
                            frm2.label8.Text = "QA= " + resultA.ToString() + " kN/m2" + Environment.NewLine + Environment.NewLine + "QD= " + resultD.ToString() + " kN/m2" + Environment.NewLine + Environment.NewLine + "QE= " + resultE.ToString() + " kN/m2";
                            frm2.pictureBox7.Visible = true;
                        }
                    }
                    else
                    {
                        frm2.Close();
                        MessageBox.Show("The parameter 'h' cannot be higher than the 'height above ground' variable that is defined in the basic values part.", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
                else
                {
                    frm2.Close();
                    MessageBox.Show("Please fill required spaces", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            //end//Vertical walls of rectangular plan buildings//
            //start//flat roofs//
            else if (flat.Checked == true)
            {
                if (!(string.IsNullOrEmpty(textBox9.Text)) && !(string.IsNullOrEmpty(textBox10.Text)) && !(string.IsNullOrEmpty(textBox11.Text)))
                {
                    frm2.pictureBox8.Visible = true; frm2.label11.Visible = true; frm2.label12.Visible = true; frm2.label13.Visible = true; frm2.label14.Visible = true; frm2.label8.Visible = true;
                    var h = float.Parse(textBox9.Text, CultureInfo.InvariantCulture.NumberFormat);
                    var b = float.Parse(textBox11.Text, CultureInfo.InvariantCulture.NumberFormat);
                    double ee = Math.Min(b, 2 * h); ee = Math.Round(ee, 3);
                    cfI = 0.2; cfI2 = -0.2;
                    if (comboBox3.SelectedItem.ToString() == "With Parapets")
                    {
                        var hp = float.Parse(textBox10.Text, CultureInfo.InvariantCulture.NumberFormat);
                        double[,] Tablero = new double[4, 5] { { -1.8, -1.2, -0.7, 0.2, -0.2 }, { -1.6, -1.1, -0.7, 0.2, -0.2 }, { -1.4, -0.9, -0.7, 0.2, -0.2 }, { -1.2, -0.8, -0.7, 0.2, -0.2 } };

                        if ((h+hp)<=z)
                        {
                        if (hp / h < 0.025)
                        {
                            cfF = Tablero[0, 0]; cfG = Tablero[0, 1]; cfH = Tablero[0, 2];
                        }
                        else if (hp / h >= 0.025 && hp / h <= 0.05)
                        {
                            cfF = -1.6 - (Tablero[1, 0] - Tablero[2, 0]) / 0.025 * (hp / h - 0.025);
                            cfG = -1.1 - (Tablero[1, 1] - Tablero[2, 1]) / 0.025 * (hp / h - 0.025);
                            cfH = -0.7 - (Tablero[1, 2] - Tablero[2, 2]) / 0.025 * (hp / h - 0.025);
                        }
                        else if (hp / h > 0.05 && hp / h <= 0.1)
                        {
                            cfF = -1.4 - (Tablero[2, 0] - Tablero[3, 0]) / 0.05 * (hp / h - 0.05);
                            cfG = -0.9 - (Tablero[2, 1] - Tablero[3, 1]) / 0.05 * (hp / h - 0.05);
                            cfH = -0.7 - (Tablero[2, 2] - Tablero[3, 2]) / 0.05 * (hp / h - 0.05);
                        }
                        else if (hp / h > 0.1)
                        {
                            cfF = Tablero[3, 0]; cfG = Tablero[3, 1]; cfH = Tablero[3, 2];
                        }
                        }
                        else
                        {
                            frm2.Hide();
                            MessageBox.Show("h + hp cannot be higher than the height of the stucture", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }

                    }
                    else if (comboBox3.SelectedItem.ToString() == "Curved Eaves")
                    {
                        if (h<=z)
                        {
                        var r = float.Parse(textBox10.Text, CultureInfo.InvariantCulture.NumberFormat);
                        double[,] Tablero = new double[4, 5] { { -1.8, -1.2, -0.7, 0.2, -0.2 }, { -1.0, -1.2, -0.4, 0.2, -0.2 }, { -0.7, -0.8, -0.3, 0.2, -0.2 }, { -0.5, -0.5, -0.3, 0.2, -0.2 } };
                        if (r / h < 0.05)
                        {
                            cfF = Tablero[0, 0]; cfG = Tablero[0, 1]; cfH = Tablero[0, 2];
                        }
                        else if (r / h >= 0.05 && r / h <= 0.1)
                        {
                            cfF = -1.0 - (Tablero[1, 0] - Tablero[2, 0]) / 0.05 * (r / h - 0.05);
                            cfG = -1.2 - (Tablero[1, 1] - Tablero[2, 1]) / 0.05 * (r / h - 0.05);
                            cfH = -0.4 - (Tablero[1, 2] - Tablero[2, 2]) / 0.05 * (r / h - 0.05);
                        }
                        else if (r / h > 0.1 && r / h <= 0.2)
                        {
                            cfF = -0.7 - (Tablero[2, 0] - Tablero[3, 0]) / 0.1 * (r / h - 0.1);
                            cfG = -0.8 - (Tablero[2, 1] - Tablero[3, 1]) / 0.1 * (r / h - 0.1);
                            cfH = -0.3 - (Tablero[2, 2] - Tablero[3, 2]) / 0.1 * (r / h - 0.1);
                        }
                        else if (r / h > 0.2)
                        {
                            cfF = Tablero[3, 0]; cfG = Tablero[3, 1]; cfH = Tablero[3, 2];
                        }
                        }
                        else
                        {
                            frm2.Hide();
                            MessageBox.Show("h cannot be higher than the height of the stucture", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }                           
                    }
                    else if (comboBox3.SelectedItem.ToString() == "Mansard Eaves")
                    {
                        if (h<=z)
                        {
                        var alfa = float.Parse(textBox10.Text, CultureInfo.InvariantCulture.NumberFormat);
                        double[,] Tablero = new double[4, 5] { { -1.8, -1.2, -0.7, 0.2, -0.2 }, { -1.0, -1.0, -0.3, 0.2, -0.2 }, { -1.2, -1.3, -0.4, 0.2, -0.2 }, { -1.3, -1.3, -0.5, 0.2, -0.2 } };
                        if (alfa < 30)
                        {
                            cfF = Tablero[1, 0]; cfG = Tablero[1, 1]; cfH = Tablero[1, 2];
                        }
                        else if (alfa >= 30 && alfa <= 45)
                        {
                            cfF = -1.2 + (Tablero[1, 0] - Tablero[2, 0]) / 15 * (45 - alfa);
                            cfG = -1.3 + (Tablero[1, 1] - Tablero[2, 1]) / 15 * (45 - alfa);
                            cfH = -0.4 + (Tablero[1, 2] - Tablero[2, 2]) / 15 * (45 - alfa);
                        }
                        else if (alfa > 45 && alfa <= 60)
                        {
                            cfF = -1.3 + (Tablero[2, 0] - Tablero[3, 0]) / 15 * (60 - alfa);
                            cfG = -1.3 + (Tablero[2, 1] - Tablero[3, 1]) / 15 * (60 - alfa);
                            cfH = -0.5 + (Tablero[2, 2] - Tablero[3, 2]) / 15 * (60 - alfa);
                        }
                        else if (alfa > 60 && alfa < 90)
                        {
                            cfF = Tablero[0, 0]; cfG = Tablero[0, 1]; cfH = Tablero[0, 2];
                        }
                        else
                        {
                            frm2.Hide();
                            MessageBox.Show("Invalid Roof Angle!", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                        }
                        else
                        {
                            frm2.Hide();
                            MessageBox.Show("h cannot be higher than the height of the stucture", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                    }
                    //cpi calc
                    if (comboBox2.SelectedItem.ToString() == "It's not possible to estimate")
                    {
                        if (cfF >= 0)
                        {
                            cpiF = 0.2;
                        }
                        else
                        {
                            cpiF = -0.3;
                        }
                        if (cfG >= 0)
                        {
                            cpiG = 0.2;
                        }
                        else
                        {
                            cpiG = -0.3;
                        }
                        if (cfH >= 0)
                        {
                            cpiH = 0.2;
                        }
                        else
                        {
                            cpiH = -0.3;
                        }
                        if (cfI >= 0)
                        {
                            cpiI = 0.2;
                        }
                        else
                        {
                            cpiI = -0.3;
                        }
                        if (cfI2 >= 0)
                        {
                            cpiI2 = 0.2;
                        }
                        else
                        {
                            cpiI2 = -0.3;
                        }
                    }
                    else if (comboBox2.SelectedItem.ToString() == "Openings at the dominant face is twice the area of the openings in the remaining faces")
                    {
                        cpiF = 0.75 * cfF; cpiG = 0.75 * cfG; cpiH = 0.75 * cfH; cpiI = 0.75 * cfI; cpiI2 = 0.75 * cfI2;
                    }
                    else if (comboBox2.SelectedItem.ToString() == "Openings at the dominant face is at least 3 times the area of the openings in the remaining faces")
                    {
                        cpiF = 0.9 * cfF; cpiG = 0.9 * cfG; cpiH = 0.9 * cfH; cpiI = 0.9 * cfI; cpiI2 = 0.9 * cfI2;
                    }
                    else if (comboBox2.SelectedItem.ToString() == "Open silos and chimneys")
                    {
                        cpiF = -0.6; cpiG = -0.6; cpiH = -0.6; cpiI = -0.6; cpiI2 = -0.6;
                    }
                    else if (comboBox2.SelectedItem.ToString() == "Vented tanks with small openings")
                    {
                        cpiF = -0.4; cpiG = -0.4; cpiH = -0.4; cpiI = -0.4; cpiI2 = -0.4;
                    }
                    //cpi calc
                    resultF = cscd * (cfF + cpiF) * qp; resultG = cscd * (cfG + cpiG) * qp; resultH = cscd * (cfH + cpiH) * qp; resultI = cscd * (cfI + cpiI) * qp; resultI2 = cscd * (cfI2 + cpiI2) * qp;
                    resultF = Math.Round(resultF, 3); resultG = Math.Round(resultG, 3); resultH = Math.Round(resultH, 3); resultI = Math.Round(resultI, 3); resultI2 = Math.Round(resultI2, 3);

                    frm2.label11.Text = "e= " + ee.ToString() + " m.";
                    frm2.label8.Text = "QF= " + resultF.ToString() + " kN/m2" + Environment.NewLine + Environment.NewLine + "QG= " + resultG.ToString() + " kN/m2" + Environment.NewLine + Environment.NewLine + "QH= " + resultH.ToString() + " kN/m2" + Environment.NewLine + Environment.NewLine + "QI= " + resultI.ToString() + " kN/m2";
                    frm2.label12.Text = "QF= " + resultF.ToString() + " kN/m2" + Environment.NewLine + Environment.NewLine + "QG= " + resultG.ToString() + " kN/m2" + Environment.NewLine + Environment.NewLine + "QH= " + resultH.ToString() + " kN/m2" + Environment.NewLine + Environment.NewLine + "QI= " + resultI2.ToString() + " kN/m2";
                    frm2.richTextBox1.AppendText("All calculations have performed according to EN1991-1-4. Wind actions on flat roof have been calculated for height above ground;" + textBox1.Text + " m. terrain category; " + comboBox1.Text + " and basic wind velocity;" + textBox2.Text + " m/s. In addition, openings in building is specified as " + comboBox2.Text + Environment.NewLine + Environment.NewLine + "Wind actions on flat roof have been calculated as a pressure. Pressure varies between different zones. Pressures on crosswind areas should be applied like the pressure profile figure.(for F, G, H and I)" + Environment.NewLine + Environment.NewLine + "Note1: Positive sign indicates that it is a pressure, negative sign is used for suction. Wind pressures are different as seen at case 1 and 2 for section I. Both values should be considered." + Environment.NewLine + "Note2: For another case, 'b' and 'd' values should be changed. That means wind direction will be changed 90 degree.");
                }
                else
                {
                    frm2.Close();
                    MessageBox.Show("Please fill required spaces", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            //end//flat roofs//
            //start//monopitch roofs//
            else if (monopitch.Checked == true)
            {
                if (!(string.IsNullOrEmpty(textBox12.Text)) && !(string.IsNullOrEmpty(textBox14.Text)))
                {
                    frm2.label10.Visible = true; frm2.pictureBox9.Visible = true; frm2.label15.Visible = true; frm2.label4.Visible = true; frm2.pictureBox10.Visible = true; frm2.label16.Visible = true; frm2.label6.Visible = true; frm2.label7.Visible = true; frm2.pictureBox11.Visible = true;
                    var alfa = float.Parse(textBox12.Text, CultureInfo.InvariantCulture.NumberFormat);
                    var h = float.Parse(textBox1.Text, CultureInfo.InvariantCulture.NumberFormat);
                    var b = float.Parse(textBox14.Text, CultureInfo.InvariantCulture.NumberFormat);
                    double ee = Math.Min(b, 2 * h); ee = Math.Round(ee, 3);
                    double[,] Tablero0 = new double[6, 6] { { -1.7, 0, -1.2, 0, -0.6, 0 }, { -0.9, 0.2, -0.8, 0.2, -0.3, 0.2 }, { -0.5, 0.7, -0.5, 0.7, -0.2, 0.4 }, { 0, 0.7, 0, 0.7, 0, 0.6 }, { 0.7, 0.7, 0.7, 0.7, 0.7, 0.7 }, { 0.8, 0.8, 0.8, 0.8, 0.8, 0.8 } };
                    double[,] Tablero180 = new double[6, 3] { { -2.3, -1.3, -0.8 }, { -2.5, -1.3, -0.9 }, { -1.1, -0.8, -0.8 }, { -0.6, -0.5, -0.7 }, { -0.5, -0.5, -0.5 }, { -0.5, -0.5, -0.5 } };
                    double[,] Tablero90 = new double[6, 5] { { -2.1, -2.1, -1.8, -0.6, 0.5 }, { -2.4, -1.6, -1.9, -0.8, -0.7 }, { -2.1, -1.3, -1.5, -1.0, -0.8 }, { -1.5, -1.3, -1.4, -1.0, -0.9 }, { -1.2, -1.2, -1.2, -1.0, -0.7 }, { -1.2, -1.2, -1.2, -1.0, -0.5 } };

                    if (alfa >= 5 && alfa <= 15)
                    {
                        i = 0; j = 10; boundary = 5;
                    }
                    else if (alfa > 15 && alfa <= 30)
                    {
                        i = 1; j = 15; boundary = 15;
                    }
                    else if (alfa > 30 && alfa <= 45)
                    {
                        i = 2; j = 15; boundary = 30;
                    }
                    else if (alfa > 45 && alfa <= 60)
                    {
                        i = 3; j = 15; boundary = 45;
                    }
                    else if (alfa > 60 && alfa <= 75)
                    {
                        i = 4; j = 15; boundary = 60;
                    }
                    else
                    {
                        frm2.Hide();
                        MessageBox.Show(" The roof angle 'α' cannot be less than 5° and more than 75° ");
                    }
                    cfF = Tablero0[i, 0] - (Tablero0[i, 0] - Tablero0[i + 1, 0]) / j * (alfa - boundary);
                    cfF2 = Tablero0[i, 1] - (Tablero0[i, 1] - Tablero0[i + 1, 1]) / j * (alfa - boundary);
                    cfG = Tablero0[i, 2] - (Tablero0[i, 2] - Tablero0[i + 1, 2]) / j * (alfa - boundary);
                    cfG2 = Tablero0[i, 3] - (Tablero0[i, 3] - Tablero0[i + 1, 3]) / j * (alfa - boundary);
                    cfH = Tablero0[i, 4] - (Tablero0[i, 4] - Tablero0[i + 1, 4]) / j * (alfa - boundary);
                    cfH2 = Tablero0[i, 5] - (Tablero0[i, 5] - Tablero0[i + 1, 5]) / j * (alfa - boundary);

                    cfF180 = Tablero180[i, 0] - (Tablero180[i, 0] - Tablero180[i + 1, 0]) / j * (alfa - boundary);
                    cfG180 = Tablero180[i, 1] - (Tablero180[i, 1] - Tablero180[i + 1, 1]) / j * (alfa - boundary);
                    cfH180 = Tablero180[i, 2] - (Tablero180[i, 2] - Tablero180[i + 1, 2]) / j * (alfa - boundary);

                    cfFup90 = Tablero90[i, 0] - (Tablero90[i, 0] - Tablero90[i + 1, 0]) / j * (alfa - boundary);
                    cfFlow90 = Tablero90[i, 1] - (Tablero90[i, 1] - Tablero90[i + 1, 1]) / j * (alfa - boundary);
                    cfG90 = Tablero90[i, 2] - (Tablero90[i, 2] - Tablero90[i + 1, 2]) / j * (alfa - boundary);
                    cfH90 = Tablero90[i, 3] - (Tablero90[i, 3] - Tablero90[i + 1, 3]) / j * (alfa - boundary);
                    cfI90 = Tablero90[i, 4] - (Tablero90[i, 4] - Tablero90[i + 1, 4]) / j * (alfa - boundary);
                    //cpi calc
                    if (comboBox2.SelectedItem.ToString() == "It's not possible to estimate")
                    {
                        if (cfF >= 0)
                        {
                            cpiF = 0.2;
                        }
                        else
                        {
                            cpiF = -0.3;
                        }
                        if (cfG >= 0)
                        {
                            cpiG = 0.2;
                        }
                        else
                        {
                            cpiG = -0.3;
                        }
                        if (cfH >= 0)
                        {
                            cpiH = 0.2;
                        }
                        else
                        {
                            cpiH = -0.3;
                        }
                        if (cfF2 >= 0)
                        {
                            cpiF2 = 0.2;
                        }
                        else
                        {
                            cpiF2 = -0.3;
                        }
                        if (cfG2 >= 0)
                        {
                            cpiG2 = 0.2;
                        }
                        else
                        {
                            cpiG2 = -0.3;
                        }
                        if (cfH2 >= 0)
                        {
                            cpiH2 = 0.2;
                        }
                        else
                        {
                            cpiH2 = -0.3;
                        }

                        if (cfF180 >= 0)
                        {
                            cpiF180 = 0.2;
                        }
                        else
                        {
                            cpiF180 = -0.3;
                        }
                        if (cfG180 >= 0)
                        {
                            cpiG180 = 0.2;
                        }
                        else
                        {
                            cpiG180 = -0.3;
                        }
                        if (cfH180 >= 0)
                        {
                            cpiH180 = 0.2;
                        }
                        else
                        {
                            cpiH180 = -0.3;
                        }

                        if (cfFup90 >= 0)
                        {
                            cpiFup90 = 0.2;
                        }
                        else
                        {
                            cpiFup90 = -0.3;
                        }
                        if (cfFlow90 >= 0)
                        {
                            cpiFlow90 = 0.2;
                        }
                        else
                        {
                            cpiFlow90 = -0.3;
                        }
                        if (cfG90 >= 0)
                        {
                            cpiG90 = 0.2;
                        }
                        else
                        {
                            cpiG90 = -0.3;
                        }
                        if (cfH90 >= 0)
                        {
                            cpiH90 = 0.2;
                        }
                        else
                        {
                            cpiH90 = -0.3;
                        }
                        if (cfI90 >= 0)
                        {
                            cpiI90 = 0.2;
                        }
                        else
                        {
                            cpiI90 = -0.3;
                        }
                    }
                    else if (comboBox2.SelectedItem.ToString() == "Openings at the dominant face is twice the area of the openings in the remaining faces")
                    {
                        cpiF = 0.75 * cfF; cpiG = 0.75 * cfG; cpiH = 0.75 * cfH; cpiF2 = 0.75 * cfF2; cpiG2 = 0.75 * cfG2; cpiH2 = 0.75 * cfH2;
                        cpiF180 = 0.75 * cfF180; cpiG180 = 0.75 * cfG180; cpiH180 = 0.75 * cfH180;
                        cpiFup90 = 0.75 * cfFup90; cpiFlow90 = 0.75 * cfFlow90; cpiG90 = 0.75 * cfG90; cpiH90 = 0.75 * cfH90; cpiI90 = 0.75 * cfI90;

                    }
                    else if (comboBox2.SelectedItem.ToString() == "Openings at the dominant face is at least 3 times the area of the openings in the remaining faces")
                    {
                        cpiF = 0.9 * cfF; cpiG = 0.9 * cfG; cpiH = 0.9 * cfH; cpiF2 = 0.9 * cfF2; cpiG2 = 0.9 * cfG2; cpiH2 = 0.9 * cfH2;
                        cpiF180 = 0.9 * cfF180; cpiG180 = 0.9 * cfG180; cpiH180 = 0.9 * cfH180;
                        cpiFup90 = 0.9 * cfFup90; cpiFlow90 = 0.9 * cfFlow90; cpiG90 = 0.9 * cfG90; cpiH90 = 0.9 * cfH90; cpiI90 = 0.9 * cfI90;
                    }
                    else if (comboBox2.SelectedItem.ToString() == "Open silos and chimneys")
                    {
                        cpiF = -0.6; cpiG = -0.6; cpiH = -0.6; cpiF2 = -0.6; cpiG2 = -0.6; cpiH2 = -0.6;
                        cpiF180 = -0.6; cpiG180 = -0.6; cpiH180 = -0.6;
                        cpiFup90 = -0.6; cpiFlow90 = -0.6; cpiG90 = -0.6; cpiH90 = -0.6; cpiI90 = -0.6;
                    }
                    else if (comboBox2.SelectedItem.ToString() == "Vented tanks with small openings")
                    {
                        cpiF = -0.4; cpiG = -0.4; cpiH = -0.4; cpiF2 = -0.4; cpiG2 = -0.4; cpiH2 = -0.4;
                        cpiF180 = -0.4; cpiG180 = -0.4; cpiH180 = -0.4;
                        cpiFup90 = -0.4; cpiFlow90 = -0.4; cpiG90 = -0.4; cpiH90 = -0.4; cpiI90 = -0.4;
                    }
                    //cpi calc

                    resultF = cscd * (cfF + cpiF) * qp; resultF2 = cscd * (cfF2 + cpiF2) * qp; resultG = cscd * (cfG + cpiG) * qp; resultG2 = cscd * (cfG2 + cpiG2) * qp; resultH = cscd * (cfH + cpiH) * qp; resultH2 = cscd * (cfH2 + cpiH2) * qp;
                    resultF = Math.Round(resultF, 3); resultF2 = Math.Round(resultF2, 3); resultG = Math.Round(resultG, 3); resultG2 = Math.Round(resultG2, 3); resultH = Math.Round(resultH, 3); resultH2 = Math.Round(resultH2, 3);
                    resultF180 = cscd * (cfF180 + cpiF180) * qp; resultG180 = cscd * (cfG180 + cpiG180) * qp; resultH180 = cscd * (cfH180 + cpiH180) * qp;
                    resultF180 = Math.Round(resultF180, 3); resultG180 = Math.Round(resultG180, 3); resultH180 = Math.Round(resultH180, 3);
                    resultFup90 = cscd * (cfFup90 + cpiFup90) * qp; resultFlow90 = cscd * (cfFlow90 + cpiFlow90) * qp; resultG90 = cscd * (cfG90 + cpiG90) * qp; resultH90 = cscd * (cfH90 + cpiH90) * qp; resultI90 = cscd * (cfI90 + cpiI90) * qp;
                    resultFup90 = Math.Round(resultFup90, 3); resultFlow90 = Math.Round(resultFlow90, 3); resultG90 = Math.Round(resultG90, 3); resultH90 = Math.Round(resultH90, 3); resultI90 = Math.Round(resultI90, 3);

                    frm2.label10.Text = "      Wind Direction Ɵ = 0°                               Wind Direction Ɵ = 180°";
                    frm2.label15.Text = "Case 1) (Ɵ = 0°)" + Environment.NewLine + Environment.NewLine + "QF= " + resultF.ToString() + " kN/m2" + Environment.NewLine + "QG= " + resultG.ToString() + " kN/m2" + Environment.NewLine + "QH= " + resultH.ToString() + " kN/m2" + Environment.NewLine + Environment.NewLine + "Case 2) (Ɵ = 0°)" + Environment.NewLine + Environment.NewLine + "QF= " + resultF2.ToString() + " kN/m2" + Environment.NewLine + "QG= " + resultG2.ToString() + " kN/m2" + Environment.NewLine + "QH= " + resultH2.ToString() + " kN/m2";
                    frm2.label4.Text = "Case 3) (Ɵ = 180°)" + Environment.NewLine + Environment.NewLine + "QF= " + resultF180.ToString() + " kN/m2" + Environment.NewLine + "QG= " + resultG180.ToString() + " kN/m2" + Environment.NewLine + "QH= " + resultH180.ToString() + " kN/m2" + Environment.NewLine + Environment.NewLine + "Case 4) (Ɵ = 90°)" + Environment.NewLine + Environment.NewLine + "QFup= " + resultFup90.ToString() + " kN/m2" + Environment.NewLine + "QFlow= " + resultFlow90.ToString() + " kN/m2" + Environment.NewLine + "QG= " + resultG90.ToString() + " kN/m2" + Environment.NewLine + "QH= " + resultH90.ToString() + " kN/m2" + Environment.NewLine + "QI= " + resultI90.ToString() + " kN/m2";
                    frm2.label6.Text = "Plan View of the Roof for (Ɵ = 0°) and (Ɵ = 180°)"; frm2.label16.Text = "e= " + ee.ToString() + " m.";
                    frm2.label7.Text = "Plan View of the Roof for (Ɵ = 90°)";
                    frm2.richTextBox1.AppendText("All calculations have performed according to EN1991-1-4. Wind actions on monopitch roof have been calculated for height above ground;" + textBox1.Text + " m. terrain category; " + comboBox1.Text + " and basic wind velocity;" + textBox2.Text + " m/s. In addition, openings in building is specified as " + comboBox2.Text + Environment.NewLine + Environment.NewLine + "Wind actions on monopitch roof have been calculated as a pressure. Pressure varies between different zones. Pressures on roof areas should be applied like the roof plan views at figures.(Two different figures for Ɵ = 0°, Ɵ = 180° and Ɵ = 90°)" + Environment.NewLine + Environment.NewLine + "Note1: Positive sign indicates that it is a pressure, negative sign is used for suction." + Environment.NewLine + "Note2: Ɵ = 0° when the wind comes from low eave to high eave, Ɵ = 180° when the wind comes from high eave to low eave.");
                }
                else
                {
                    frm2.Close();
                    MessageBox.Show("Please fill required spaces", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            //end//monopitch roofs//
            //start//duopitch roofs//
            else if (duopitch.Checked == true)
            {
                if (!(string.IsNullOrEmpty(textBox15.Text)) && !(string.IsNullOrEmpty(textBox16.Text)))
                {
                    frm2.label10.Visible = true; frm2.label15.Visible = true; frm2.label4.Visible = true; frm2.label16.Visible = true; frm2.label6.Visible = true; frm2.label7.Visible = true; frm2.label5.Visible = true; frm2.pictureBox12.Visible = true; frm2.pictureBox13.Visible = true; frm2.pictureBox14.Visible = true;
                    var alfa = float.Parse(textBox15.Text, CultureInfo.InvariantCulture.NumberFormat);
                    var h = float.Parse(textBox1.Text, CultureInfo.InvariantCulture.NumberFormat);
                    var b = float.Parse(textBox16.Text, CultureInfo.InvariantCulture.NumberFormat);
                    double ee = Math.Min(b, 2 * h); ee = Math.Round(ee, 3);
                    double[,] Tablero0 = new double[10, 10] { { -0.6, -0.6, -0.6, -0.6, -0.8, -0.8, -0.7, -0.7, -1.0, -1.0 }, { -1.1, -1.1, -0.8, -0.8, -0.8, -0.8, -0.6, -0.6, -0.8, -0.8 }, { -2.5, -2.5, -1.3, -1.3, -0.9, -0.9, -0.5, -0.5, -0.7, -0.7 }, { -2.3, -2.3, -1.2, -1.2, -0.8, -0.8, 0.2, -0.6, 0.2, -0.6 }, { -1.7, 0, -1.2, 0, -0.6, 0, -0.6, -0.6, 0.2, -0.6 }, { -0.9, 0.2, -0.8, 0.2, -0.3, 0.2, -0.4, 0, -1, 0 }, { -0.5, 0.7, -0.5, 0.7, -0.2, 0.4, -0.4, 0, -0.5, 0 }, { 0, 0.7, 0, 0.7, 0, 0.6, -0.2, 0, -0.3, 0 }, { 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, -0.2, -0.2, -0.3, -0.3 }, { 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, -0.2, -0.2, -0.3, -0.3 } };
                    double[,] Tablero90 = new double[10, 4] { { -1.4, -1.2, -1.0, -0.9 }, { -1.5, -1.2, -1.0, -0.9 }, { -1.9, -1.2, -0.8, -0.8 }, { -1.8, -1.2, -0.7, -0.6 }, { -1.6, -1.3, -0.7, -0.6 }, { -1.3, -1.3, -0.6, -0.5 }, { -1.1, -1.4, -0.8, -0.5 }, { -1.1, -1.4, -0.9, -0.5 }, { -1.1, -1.2, -0.8, -0.5 }, { -1.1, -1.2, -0.8, -0.5 } };

                    if (checkBox2.Checked == false)
                    {
                        alfa=alfa*-1;
                    }
                    else
                    {
                       alfa=alfa*1;
                    }

                    if (alfa >= -45 && alfa <= -30)
                    {
                        i = 0; j = 15; boundary = -45;
                    }
                    else if (alfa > -30 && alfa <= -15)
                    {
                        i = 1; j = 15; boundary = -30;
                    }
                    else if (alfa > -15 && alfa <= -5)
                    {
                        i = 2; j = 10; boundary = -15;
                    }
                    else if (alfa > -5 && alfa <= 5) ///today is my bd!
                    {
                        frm2.Hide();
                        MessageBox.Show("Roofs that have a slope of -5° < α < 5°, are categorized as flat roofs. Please follow 'flat roofs' tab in the menu");
                        button3.PerformClick();
                    }
                    else if (alfa > 5 && alfa <= 15)
                    {
                        i = 4; j = 10; boundary = 5;
                    }
                    else if (alfa > 15 && alfa <= 30)
                    {
                        i = 5; j = 15; boundary = 15;
                    }
                    else if (alfa > 30 && alfa <= 45)
                    {
                        i = 6; j = 15; boundary = 30;
                    }
                    else if (alfa > 45 && alfa <= 60)
                    {
                        i = 7; j = 15; boundary = 45;
                    }
                    else if (alfa > 60 && alfa <= 75)
                    {
                        i = 8; j = 15; boundary = 60;
                    }
                    else
                    {
                        frm2.Hide();
                        MessageBox.Show(" The roof angle 'α' cannot be less than -45° and more than 75° ");
                    }
                    cfF = Tablero0[i, 0] - (Tablero0[i, 0] - Tablero0[i + 1, 0]) / j * (alfa - boundary);
                    cfF2 = Tablero0[i, 1] - (Tablero0[i, 1] - Tablero0[i + 1, 1]) / j * (alfa - boundary);
                    cfG = Tablero0[i, 2] - (Tablero0[i, 2] - Tablero0[i + 1, 2]) / j * (alfa - boundary);
                    cfG2 = Tablero0[i, 3] - (Tablero0[i, 3] - Tablero0[i + 1, 3]) / j * (alfa - boundary);
                    cfH = Tablero0[i, 4] - (Tablero0[i, 4] - Tablero0[i + 1, 4]) / j * (alfa - boundary);
                    cfH2 = Tablero0[i, 5] - (Tablero0[i, 5] - Tablero0[i + 1, 5]) / j * (alfa - boundary);
                    cfI = Tablero0[i, 6] - (Tablero0[i, 6] - Tablero0[i + 1, 6]) / j * (alfa - boundary);
                    cfI2 = Tablero0[i, 7] - (Tablero0[i, 7] - Tablero0[i + 1, 7]) / j * (alfa - boundary);
                    cfJ = Tablero0[i, 8] - (Tablero0[i, 8] - Tablero0[i + 1, 8]) / j * (alfa - boundary);
                    cfJ2 = Tablero0[i, 9] - (Tablero0[i, 9] - Tablero0[i + 1, 9]) / j * (alfa - boundary);

                    cfF90 = Tablero90[i, 0] - (Tablero90[i, 0] - Tablero90[i + 1, 0]) / j * (alfa - boundary);
                    cfG90 = Tablero90[i, 1] - (Tablero90[i, 1] - Tablero90[i + 1, 1]) / j * (alfa - boundary);
                    cfH90 = Tablero90[i, 2] - (Tablero90[i, 2] - Tablero90[i + 1, 2]) / j * (alfa - boundary);
                    cfI90 = Tablero90[i, 3] - (Tablero90[i, 3] - Tablero90[i + 1, 3]) / j * (alfa - boundary);
                    //cpi calc
                    if (comboBox2.SelectedItem.ToString() == "It's not possible to estimate")
                    {
                        if (cfF >= 0)
                        {
                            cpiF = 0.2;
                        }
                        else
                        {
                            cpiF = -0.3;
                        }
                        if (cfG >= 0)
                        {
                            cpiG = 0.2;
                        }
                        else
                        {
                            cpiG = -0.3;
                        }
                        if (cfH >= 0)
                        {
                            cpiH = 0.2;
                        }
                        else
                        {
                            cpiH = -0.3;
                        }
                        if (cfF2 >= 0)
                        {
                            cpiF2 = 0.2;
                        }
                        else
                        {
                            cpiF2 = -0.3;
                        }
                        if (cfG2 >= 0)
                        {
                            cpiG2 = 0.2;
                        }
                        else
                        {
                            cpiG2 = -0.3;
                        }
                        if (cfH2 >= 0)
                        {
                            cpiH2 = 0.2;
                        }
                        else
                        {
                            cpiH2 = -0.3;
                        }
                        if (cfI >= 0)
                        {
                            cpiI = 0.2;
                        }
                        else
                        {
                            cpiI = -0.3;
                        }
                        if (cfJ >= 0)
                        {
                            cpiJ = 0.2;
                        }
                        else
                        {
                            cpiJ = -0.3;
                        }
                        if (cfI2 >= 0)
                        {
                            cpiI2 = 0.2;
                        }
                        else
                        {
                            cpiI2 = -0.3;
                        }
                        if (cfJ2 >= 0)
                        {
                            cpiJ2 = 0.2;
                        }
                        else
                        {
                            cpiJ2 = -0.3;
                        }

                        if (cfF90 >= 0)
                        {
                            cpiF90 = 0.2;
                        }
                        else
                        {
                            cpiF90 = -0.3;
                        }
                        if (cfG90 >= 0)
                        {
                            cpiG90 = 0.2;
                        }
                        else
                        {
                            cpiG90 = -0.3;
                        }
                        if (cfH90 >= 0)
                        {
                            cpiH90 = 0.2;
                        }
                        else
                        {
                            cpiH90 = -0.3;
                        }
                        if (cfI90 >= 0)
                        {
                            cpiI90 = 0.2;
                        }
                        else
                        {
                            cpiI90 = -0.3;
                        }
                    }
                    else if (comboBox2.SelectedItem.ToString() == "Openings at the dominant face is twice the area of the openings in the remaining faces")
                    {
                        cpiF = 0.75 * cfF; cpiG = 0.75 * cfG; cpiH = 0.75 * cfH; cpiI = 0.75 * cfI; cpiJ = 0.75 * cfJ; cpiF2 = 0.75 * cfF2; cpiG2 = 0.75 * cfG2; cpiH2 = 0.75 * cfH2; cpiI2 = 0.75 * cfI2; cpiJ2 = 0.75 * cfJ2;
                        cpiF90 = 0.75 * cfF90; cpiG90 = 0.75 * cfG90; cpiH90 = 0.75 * cfH90; cpiI90 = 0.75 * cfI90;

                    }
                    else if (comboBox2.SelectedItem.ToString() == "Openings at the dominant face is at least 3 times the area of the openings in the remaining faces")
                    {
                        cpiF = 0.9 * cfF; cpiG = 0.9 * cfG; cpiH = 0.9 * cfH; cpiI = 0.9 * cfI; cpiJ = 0.9 * cfJ; cpiF2 = 0.9 * cfF2; cpiG2 = 0.9 * cfG2; cpiH2 = 0.9 * cfH2; cpiI2 = 0.9 * cfI2; cpiJ2 = 0.9 * cfJ2;
                        cpiF90 = 0.9 * cfF90; cpiG90 = 0.9 * cfG90; cpiH90 = 0.9 * cfH90; cpiI90 = 0.9 * cfI90;
                    }
                    else if (comboBox2.SelectedItem.ToString() == "Open silos and chimneys")
                    {
                        cpiF = -0.6; cpiG = -0.6; cpiH = -0.6; cpiI = -0.6; cpiJ = -0.6; cpiF2 = -0.6; cpiG2 = -0.6; cpiH2 = -0.6; cpiI2 = -0.6; cpiJ2 = -0.6;
                        cpiF90 = -0.6; cpiG90 = -0.6; cpiH90 = -0.6; cpiI90 = -0.6;
                    }
                    else if (comboBox2.SelectedItem.ToString() == "Vented tanks with small openings")
                    {
                        cpiF = -0.4; cpiG = -0.4; cpiH = -0.4; cpiI = -0.4; cpiJ = -0.4; cpiF2 = -0.4; cpiG2 = -0.4; cpiH2 = -0.4; cpiI2 = -0.4; cpiJ2 = -0.4;
                        cpiF90 = -0.4; cpiG90 = -0.4; cpiH90 = -0.4; cpiI90 = -0.4;
                    }
                    //cpi calc

                    resultF = cscd * (cfF + cpiF) * qp; resultF2 = cscd * (cfF2 + cpiF2) * qp; resultG = cscd * (cfG + cpiG) * qp; resultG2 = cscd * (cfG2 + cpiG2) * qp; resultH = cscd * (cfH + cpiH) * qp; resultH2 = cscd * (cfH2 + cpiH2) * qp; resultI = cscd * (cfI + cpiI) * qp; resultI2 = cscd * (cfI2 + cpiI2) * qp; resultJ = cscd * (cfJ + cpiJ) * qp; resultJ2 = cscd * (cfJ2 + cpiJ2) * qp;
                    resultF = Math.Round(resultF, 3); resultF2 = Math.Round(resultF2, 3); resultG = Math.Round(resultG, 3); resultG2 = Math.Round(resultG2, 3); resultH = Math.Round(resultH, 3); resultH2 = Math.Round(resultH2, 3); resultI = Math.Round(resultI, 3); resultI2 = Math.Round(resultI2, 3); resultJ = Math.Round(resultJ, 3); resultJ2 = Math.Round(resultJ2, 3);

                    resultF90 = cscd * (cfF90 + cpiF90) * qp; resultG90 = cscd * (cfG90 + cpiG90) * qp; resultH90 = cscd * (cfH90 + cpiH90) * qp; resultI90 = cscd * (cfI90 + cpiI90) * qp;
                    resultF90 = Math.Round(resultF90, 3); resultG90 = Math.Round(resultG90, 3); resultH90 = Math.Round(resultH90, 3); resultI90 = Math.Round(resultI90, 3);

                    frm2.label10.Text = "Cross-wind Profile";
                    frm2.label15.Text = "Case 1) (Ɵ = 0°)" + Environment.NewLine + Environment.NewLine + "QF = " + resultF.ToString() + " kN / m2" + Environment.NewLine + "QG = " + resultG.ToString() + " kN / m2" + Environment.NewLine + "QH = " + resultH.ToString() + " kN / m2" + Environment.NewLine + "QI = " + resultI.ToString() + " kN / m2" + Environment.NewLine + "QJ = " + resultJ.ToString() + " kN / m2";
                    frm2.label4.Text = "Case 2) (Ɵ = 90°)" + Environment.NewLine + Environment.NewLine + "QF = " + resultF90.ToString() + " kN / m2" + Environment.NewLine + "QG = " + resultG90.ToString() + " kN / m2" + Environment.NewLine + "QH = " + resultH90.ToString() + " kN / m2" + Environment.NewLine + "QI = " + resultI90.ToString() + " kN / m2";
                    if (alfa > 5 && alfa < 45)
                    {
                        frm2.label5.Text = Environment.NewLine + "Case 3) (Ɵ = 0°)" + Environment.NewLine + Environment.NewLine + "QF = " + resultF2.ToString() + " kN / m2" + Environment.NewLine + "QG = " + resultG2.ToString() + " kN / m2" + Environment.NewLine + "QH = " + resultH2.ToString() + " kN / m2" + Environment.NewLine + "QI = " + resultI2.ToString() + " kN / m2" + Environment.NewLine + "QJ = " + resultJ2.ToString() + " kN / m2";
                    }
                    else
                    {
                        frm2.label5.Text = "";
                    }
                    frm2.label6.Text = "Plan View of the Roof for (Ɵ = 0°)"; frm2.label16.Text = "e= " + ee.ToString() + " m.";
                    frm2.label7.Text = "Plan View of the Roof for (Ɵ = 90°)";
                    frm2.richTextBox1.AppendText("All calculations have performed according to EN1991-1-4. Wind actions on duopitch roof have been calculated for height above ground;" + textBox1.Text + " m. terrain category; " + comboBox1.Text + " and basic wind velocity;" + textBox2.Text + " m/s. In addition, openings in building is specified as " + comboBox2.Text + Environment.NewLine + Environment.NewLine + "Wind actions on duopitch roof have been calculated as a pressure. Pressure varies between different zones. Pressures on roof areas should be applied like the roof plan views at figures.(Two different figures for Ɵ = 0° and Ɵ = 90°)" + Environment.NewLine + Environment.NewLine + "Note1: Positive sign indicates that it is a pressure, negative sign is used for suction." + Environment.NewLine + "Note2: The results are viable when the roof angle 'α' is more than -45° and less than 75° ");
                }
                else
                {
                    frm2.Close();
                    MessageBox.Show("Please fill required spaces", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            //end//duopitch roofs//
            //start//hipped roofs//
            else if (hipped.Checked == true)
            {
                if (!(string.IsNullOrEmpty(textBox17.Text)) && !(string.IsNullOrEmpty(textBox18.Text)) && !(string.IsNullOrEmpty(textBox19.Text)))
                {
                    frm2.label10.Visible = true; frm2.label15.Visible = true; frm2.label4.Visible = true; frm2.label6.Visible = true; frm2.label7.Visible = true; frm2.label16.Visible = true; frm2.pictureBox15.Visible = true; frm2.pictureBox16.Visible = true; frm2.pictureBox17.Visible = true;
                    var alfa = float.Parse(textBox17.Text, CultureInfo.InvariantCulture.NumberFormat);
                    var alfa90 = float.Parse(textBox18.Text, CultureInfo.InvariantCulture.NumberFormat);
                    var b = float.Parse(textBox19.Text, CultureInfo.InvariantCulture.NumberFormat);
                    var h = float.Parse(textBox1.Text, CultureInfo.InvariantCulture.NumberFormat);
                    double ee = Math.Min(b, 2 * h); ee = Math.Round(ee, 3);

                    double[,] Tablero = new double[6, 12] { { -1.7, 0, -1.2, 0, -0.6, 0, -0.3, -0.6, -0.6, -1.2, -0.6, -0.4 }, { -0.9, 0.2, -0.8, 0.2, -0.3, 0.2, -0.5, -1, -1.2, -1.4, -0.6, -0.3 }, { -0.5, 0.5, -0.5, 0.7, -0.2, 0.4, -0.4, -0.7, -0.5, -1.4, -0.8, -0.2 }, { 0, 0.7, 0, 0.7, 0, 0.6, -0.3, -0.6, -0.3, -1.3, -0.8, -0.2 }, { 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, -0.3, -0.6, -0.3, -1.2, -0.4, -0.2 }, { 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, -0.3, -0.6, -0.3, -1.2, -0.4, -0.2 } };

                    for (int count = 0; count < 2; count++)
                    {
                        if (count == 1)
                        {
                            alfa = alfa90;
                        }

                        if (alfa >= 5 && alfa <= 15)
                        {
                            i = 0; j = 10; boundary = 5;
                        }
                        else if (alfa > 15 && alfa <= 30)
                        {
                            i = 1; j = 15; boundary = 15;
                        }
                        else if (alfa > 30 && alfa <= 45)
                        {
                            i = 2; j = 15; boundary = 30;
                        }
                        else if (alfa > 45 && alfa <= 60)
                        {
                            i = 3; j = 15; boundary = 45;
                        }
                        else if (alfa > 60 && alfa <= 75)
                        {
                            i = 4; j = 15; boundary = 60;
                        }
                        else
                        {
                            frm2.Hide();
                            MessageBox.Show(" The roof angles 'α and α90' cannot be less than 5° and more than 75° ");
                        }
                        cfF = Tablero[i, 0] - (Tablero[i, 0] - Tablero[i + 1, 0]) / j * (alfa - boundary);
                        cfF2 = Tablero[i, 1] - (Tablero[i, 1] - Tablero[i + 1, 1]) / j * (alfa - boundary);
                        cfG = Tablero[i, 2] - (Tablero[i, 2] - Tablero[i + 1, 2]) / j * (alfa - boundary);
                        cfG2 = Tablero[i, 3] - (Tablero[i, 3] - Tablero[i + 1, 3]) / j * (alfa - boundary);
                        cfH = Tablero[i, 4] - (Tablero[i, 4] - Tablero[i + 1, 4]) / j * (alfa - boundary);
                        cfH2 = Tablero[i, 5] - (Tablero[i, 5] - Tablero[i + 1, 5]) / j * (alfa - boundary);
                        cfI = Tablero[i, 6] - (Tablero[i, 6] - Tablero[i + 1, 6]) / j * (alfa - boundary);
                        cfJ = Tablero[i, 7] - (Tablero[i, 7] - Tablero[i + 1, 7]) / j * (alfa - boundary);
                        cfK = Tablero[i, 8] - (Tablero[i, 8] - Tablero[i + 1, 8]) / j * (alfa - boundary);
                        cfL = Tablero[i, 9] - (Tablero[i, 9] - Tablero[i + 1, 9]) / j * (alfa - boundary);
                        cfM = Tablero[i, 10] - (Tablero[i, 10] - Tablero[i + 1, 10]) / j * (alfa - boundary);
                        cfN = Tablero[i, 11] - (Tablero[i, 11] - Tablero[i + 1, 11]) / j * (alfa - boundary);
                        //cpi calc
                        if (comboBox2.SelectedItem.ToString() == "It's not possible to estimate")
                        {
                            if (cfF >= 0)
                            {
                                cpiF = 0.2;
                            }
                            else
                            {
                                cpiF = -0.3;
                            }
                            if (cfG >= 0)
                            {
                                cpiG = 0.2;
                            }
                            else
                            {
                                cpiG = -0.3;
                            }
                            if (cfH >= 0)
                            {
                                cpiH = 0.2;
                            }
                            else
                            {
                                cpiH = -0.3;
                            }
                            if (cfF2 >= 0)
                            {
                                cpiF2 = 0.2;
                            }
                            else
                            {
                                cpiF2 = -0.3;
                            }
                            if (cfG2 >= 0)
                            {
                                cpiG2 = 0.2;
                            }
                            else
                            {
                                cpiG2 = -0.3;
                            }
                            if (cfH2 >= 0)
                            {
                                cpiH2 = 0.2;
                            }
                            else
                            {
                                cpiH2 = -0.3;
                            }
                            if (cfI >= 0)
                            {
                                cpiI = 0.2;
                            }
                            else
                            {
                                cpiI = -0.3;
                            }
                            if (cfJ >= 0)
                            {
                                cpiJ = 0.2;
                            }
                            else
                            {
                                cpiJ = -0.3;
                            }
                            if (cfK >= 0)
                            {
                                cpiK = 0.2;
                            }
                            else
                            {
                                cpiK = -0.3;
                            }
                            if (cfL >= 0)
                            {
                                cpiL = 0.2;
                            }
                            else
                            {
                                cpiL = -0.3;
                            }
                            if (cfM >= 0)
                            {
                                cpiM = 0.2;
                            }
                            else
                            {
                                cpiM = -0.3;
                            }
                            if (cfN >= 0)
                            {
                                cpiN = 0.2;
                            }
                            else
                            {
                                cpiN = -0.3;
                            }
                        }
                        else if (comboBox2.SelectedItem.ToString() == "Openings at the dominant face is twice the area of the openings in the remaining faces")
                        {
                            cpiF = 0.75 * cfF; cpiG = 0.75 * cfG; cpiH = 0.75 * cfH; cpiI = 0.75 * cfI; cpiJ = 0.75 * cfJ; cpiF2 = 0.75 * cfF2; cpiG2 = 0.75 * cfG2; cpiH2 = 0.75 * cfH2; cpiK = 0.75 * cfK; cpiL = 0.75 * cfL; cpiM = 0.75 * cfM; cpiN = 0.75 * cfN;
                        }
                        else if (comboBox2.SelectedItem.ToString() == "Openings at the dominant face is at least 3 times the area of the openings in the remaining faces")
                        {
                            cpiF = 0.9 * cfF; cpiG = 0.9 * cfG; cpiH = 0.9 * cfH; cpiI = 0.9 * cfI; cpiJ = 0.9 * cfJ; cpiF2 = 0.9 * cfF2; cpiG2 = 0.9 * cfG2; cpiH2 = 0.9 * cfH2; cpiK = 0.9 * cfK; cpiL = 0.9 * cfL; cpiM = 0.9 * cfM; cpiN = 0.9 * cfN;
                        }
                        else if (comboBox2.SelectedItem.ToString() == "Open silos and chimneys")
                        {
                            cpiF = -0.6; cpiG = -0.6; cpiH = -0.6; cpiI = -0.6; cpiJ = -0.6; cpiF2 = -0.6; cpiG2 = -0.6; cpiH2 = -0.6; cpiK = -0.6; cpiL = -0.6; cpiM = -0.6; cpiN = -0.6;
                        }
                        else if (comboBox2.SelectedItem.ToString() == "Vented tanks with small openings")
                        {
                            cpiF = -0.4; cpiG = -0.4; cpiH = -0.4; cpiI = -0.4; cpiJ = -0.4; cpiF2 = -0.4; cpiG2 = -0.4; cpiH2 = -0.4; cpiK = -0.4; cpiL = -0.4; cpiM = -0.4; cpiN = -0.4;
                        }
                        //cpi calc

                        resultF = cscd * (cfF + cpiF) * qp; resultF2 = cscd * (cfF2 + cpiF2) * qp; resultG = cscd * (cfG + cpiG) * qp; resultG2 = cscd * (cfG2 + cpiG2) * qp; resultH = cscd * (cfH + cpiH) * qp; resultH2 = cscd * (cfH2 + cpiH2) * qp; resultI = cscd * (cfI + cpiI) * qp; resultJ = cscd * (cfJ + cpiJ) * qp; resultK = cscd * (cfK + cpiK) * qp; resultL = cscd * (cfL + cpiL) * qp; resultM = cscd * (cfM + cpiM) * qp; resultN = cscd * (cfN + cpiN) * qp;
                        resultF = Math.Round(resultF, 3); resultF2 = Math.Round(resultF2, 3); resultG = Math.Round(resultG, 3); resultG2 = Math.Round(resultG2, 3); resultH = Math.Round(resultH, 3); resultH2 = Math.Round(resultH2, 3); resultI = Math.Round(resultI, 3); resultJ = Math.Round(resultJ, 3); resultK = Math.Round(resultK, 3); resultL = Math.Round(resultL, 3); resultM = Math.Round(resultM, 3); resultN = Math.Round(resultN, 3);

                        if (count == 0)
                        {
                            frm2.label15.Text = "Case 1) (α0)        Case 2) (α0)" + Environment.NewLine + Environment.NewLine + "QF = " + resultF.ToString() + "                    " + resultF2.ToString() + Environment.NewLine + "QG = " + resultG.ToString() + "                    " + resultG2.ToString() + Environment.NewLine + "QH = " + resultH.ToString() + "                    " + resultH2.ToString() + Environment.NewLine + "QI = " + resultI.ToString() + "                    " + resultI.ToString() + Environment.NewLine + "QJ = " + resultJ.ToString() + "                    " + resultJ.ToString() + Environment.NewLine + "QK = " + resultK.ToString() + "                    " + resultK.ToString() + Environment.NewLine + "QL = " + resultL.ToString() + "                    " + resultL.ToString() + Environment.NewLine + "QM = " + resultM.ToString() + "                    " + resultM.ToString() + Environment.NewLine + "QN = " + resultN.ToString() + "                    " + resultN.ToString();
                        }
                        else
                        {
                            frm2.label4.Text = "      Case 3) (α90)           Case 4) (α90)" + Environment.NewLine + Environment.NewLine + "        " + resultF.ToString() + "                       " + resultF2.ToString() + "   kN / m2" + Environment.NewLine + "        " + resultG.ToString() + "                       " + resultG2.ToString() + "    kN / m2" + Environment.NewLine + "        " + resultH.ToString() + "                       " + resultH2.ToString() + "    kN / m2" + Environment.NewLine + "        " + resultI.ToString() + "                       " + resultI.ToString() + "    kN / m2" + Environment.NewLine + "        " + resultJ.ToString() + "                       " + resultJ.ToString() + "    kN / m2" + Environment.NewLine + "        " + resultK.ToString() + "                       " + resultK.ToString() + "    kN / m2" + Environment.NewLine + "        " + resultL.ToString() + "                       " + resultL.ToString() + "     kN / m2" + Environment.NewLine + "        " + resultM.ToString() + "                       " + resultM.ToString() + "    kN / m2" + Environment.NewLine + "        " + resultN.ToString() + "                       " + resultN.ToString() + "    kN / m2";

                        }
                        frm2.label10.Text = "Cross-wind Profile";
                        frm2.label6.Text = "Plan View of the Roof for (α0)"; frm2.label16.Text = "e= " + ee.ToString() + " m.";
                        frm2.label7.Text = "Plan View of the Roof for (α90)";
                        frm2.richTextBox1.AppendText("All calculations have performed according to EN1991-1-4. Wind actions on hipped roof have been calculated for height above ground;" + textBox1.Text + " m. terrain category; " + comboBox1.Text + " and basic wind velocity;" + textBox2.Text + " m/s. In addition, openings in building is specified as " + comboBox2.Text + Environment.NewLine + Environment.NewLine + "Wind actions on hipped roof have been calculated as a pressure. Pressure varies between different zones. Pressures on roof areas should be applied like the roof plan views at figures.(Two different figures for Ɵ = 0° and Ɵ = 90°)" + Environment.NewLine + Environment.NewLine + "Note1: Positive sign indicates that it is a pressure, negative sign is used for suction." + Environment.NewLine + "Note2: The results are viable when the roof angle 'α' is more than 5° and less than 75° ");

                    }

                }
                else
                {
                    frm2.Close();
                    MessageBox.Show("Please fill required spaces", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            //end//hipped roofs//
            //start/multispan roofs//
            else if (multispan.Checked == true)
            {
                if (!(string.IsNullOrEmpty(comboBox5.Text)))
                {
                    frm2.label10.Visible = true;
                    //cpi calc
                    if (comboBox2.SelectedItem.ToString() == "It's not possible to estimate")
                    {
                        cpiA = -0.3;
                    }
                    else if (comboBox2.SelectedItem.ToString() == "Openings at the dominant face is twice the area of the openings in the remaining faces")
                    {
                        cpiA = -0.3;
                    }
                    else if (comboBox2.SelectedItem.ToString() == "Openings at the dominant face is at least 3 times the area of the openings in the remaining faces")
                    {
                        cpiA = -0.36;
                    }
                    else if (comboBox2.SelectedItem.ToString() == "Open silos and chimneys")
                    {
                        cpiA = -0.6;
                    }
                    else if (comboBox2.SelectedItem.ToString() == "Vented tanks with small openings")
                    {
                        cpiA = -0.4;
                    }
                    A = cscd * (-0.4 + cpiA) * qp;
                    A = Math.Round(A, 3);
                    //cpi calc
                    if (comboBox5.SelectedItem.ToString() == "Monopitch")
                    {
                        frm2.pictureBox20.Visible = true; frm2.label5.Visible = true;
                        frm2.label5.Text = A.ToString() + "       " + A.ToString() + "        " + A.ToString() + "  kN/m2";
                        frm2.richTextBox1.AppendText("All calculations have performed according to EN1991-1-4. Wind actions on multi-span roof(monopitch) have been calculated for height above ground;" + textBox1.Text + " m. terrain category; " + comboBox1.Text + " and basic wind velocity;" + textBox2.Text + " m/s. In addition, openings in building is specified as " + comboBox2.Text + Environment.NewLine + Environment.NewLine + "Wind actions on multi-span(monopitch) roof have been calculated as a pressure. Pressure varies between different zones. Pressures on roof areas should be applied like the roof plan views at figures." + Environment.NewLine + Environment.NewLine + "Note1: Positive sign indicates that it is a pressure, negative sign is used for suction." + Environment.NewLine + "Note2: Wind Pressure 'Q' must be specified from monopitch roof section first(QF, QG, QH, QI), then case a) and case b) should be applied as shown in the figures.");
                    }
                    else if (comboBox5.SelectedItem.ToString() == "Duopitch")
                    {
                        frm2.pictureBox21.Visible = true;
                        frm2.richTextBox1.AppendText("All calculations have performed according to EN1991-1-4. Wind actions on multi-span roof(duopitch) have been calculated for height above ground;" + textBox1.Text + " m. terrain category; " + comboBox1.Text + " and basic wind velocity;" + textBox2.Text + " m/s. In addition, openings in building is specified as " + comboBox2.Text + Environment.NewLine + Environment.NewLine + "Wind actions on multi-span(duopitch) roof have been calculated as a pressure. Pressure varies between different zones. Pressures on roof areas should be applied like the roof plan views at figures." + Environment.NewLine + Environment.NewLine + "Note1: Positive sign indicates that it is a pressure, negative sign is used for suction." + Environment.NewLine + "Note2: Wind Pressure 'Q' must be specified from duopitch roof section first(QF, QG, QH, QI, QJ), then case c) and case d) should be applied as shown in the figures.");
                    }
                }
                else
                {
                    frm2.Close();
                    MessageBox.Show("Please fill required spaces", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            //end//multispan roofs//
            //start//vaulted roofs//
            else if (vaulted.Checked == true)
            {
                if (!(string.IsNullOrEmpty(comboBox4.Text)) && !(string.IsNullOrEmpty(textBox20.Text)) && !(string.IsNullOrEmpty(textBox21.Text)) && !(string.IsNullOrEmpty(textBox22.Text)))
                {
                    frm2.label15.Visible = true; frm2.label4.Visible = true; frm2.label10.Visible = true;
                    var f = float.Parse(textBox20.Text, CultureInfo.InvariantCulture.NumberFormat);
                    var h = float.Parse(textBox21.Text, CultureInfo.InvariantCulture.NumberFormat);
                    var d = float.Parse(textBox22.Text, CultureInfo.InvariantCulture.NumberFormat);
                  if (h+f<=z)
                  {

                    if (comboBox4.SelectedItem.ToString() == "Rectangular")
                    {
                        frm2.pictureBox18.Visible = true;
                        if (f / d >= 0 && f / d <= 0.1)
                        {
                            A1 = 8 / 5 * f / d;
                            A2 = -0.7 - (5 * f / d);
                            B = -0.7 - f / d;
                            C = -0.7 + (3 * f / d);
                        }
                        else if (f / d > 0.1 && f / d < 0.2)
                        {
                            A1 = 8 / 5 * f / d;
                            A2 = -1.2;
                            B = -0.7 - f / d;
                            C = -0.4;
                        }
                        else if (f / d >= 0.2 && f / d <= 0.3)
                        {
                            A1 = 8 / 5 * f / d;
                            A2 = 8 / 3 * (f / d - 0.2);
                            A3 = -1.2 + 9 * (f / d - 0.2);
                            B = -0.7 - f / d;
                            C = -0.4;
                        }
                        else if (f / d > 0.3 && f / d <= 0.5)
                        {
                            A1 = 8 / 5 * f / d;
                            A2 = 8 / 3 * (f / d - 0.2);
                            B = -0.7 - f / d;
                            C = -0.4;
                        }
                        else if (f / d > 0.5)
                        {
                            A1 = 0.8;
                            A2 = 0.8;
                            B = -1.2;
                            C = -0.4;
                        }
                        else
                        {
                            frm2.Hide();
                            MessageBox.Show(" The veriables, 'f' or 'd', cannot be less than 0 ");
                        }
                        for (int count = 0; count < 2; count++)
                        {
                            if (h >= 0 && h <= 0.05)
                            {
                                A = A1;
                            }
                            else if (h / d > 0.05 && h / d < 0.5)
                            {
                                if (count == 0)
                                {
                                    A = (A2 - A1) / 0.5 * h / d;
                                }
                                else
                                {
                                    A = (A3 - A1) / 0.5 * h / d;
                                }
                            }
                            else if (h / d >= 0.5)
                            {
                                if (count == 0)
                                {
                                    A = A2;
                                }
                                else
                                {
                                    A = A3;
                                }
                            }
                            else
                            {
                                frm2.Hide();
                                MessageBox.Show(" The veriables, 'h' or 'd', cannot be less than 0 ");
                            }
                            //cpi calc
                            if (comboBox2.SelectedItem.ToString() == "It's not possible to estimate")
                            {
                                if (A >= 0)
                                {
                                    cpiA = 0.2;
                                }
                                else
                                {
                                    cpiA = -0.3;
                                }
                                if (B >= 0)
                                {
                                    cpiB = 0.2;
                                }
                                else
                                {
                                    cpiB = -0.3;
                                }
                                if (C >= 0)
                                {
                                    cpiC = 0.2;
                                }
                                else
                                {
                                    cpiC = -0.3;
                                }
                            }
                            else if (comboBox2.SelectedItem.ToString() == "Openings at the dominant face is twice the area of the openings in the remaining faces")
                            {
                                cpiA = 0.75 * A; cpiB = 0.75 * B; cpiC = 0.75 * C;
                            }
                            else if (comboBox2.SelectedItem.ToString() == "Openings at the dominant face is at least 3 times the area of the openings in the remaining faces")
                            {
                                cpiA = 0.9 * A; cpiB = 0.9 * B; cpiC = 0.9 * C;
                            }
                            else if (comboBox2.SelectedItem.ToString() == "Open silos and chimneys")
                            {
                                cpiA = -0.6; cpiB = -0.6; cpiC = -0.6;
                            }
                            else if (comboBox2.SelectedItem.ToString() == "Vented tanks with small openings")
                            {
                                cpiA = -0.4; cpiB = -0.4; cpiC = -0.4;
                            }
                            //cpi calc
                            A = Math.Round(A, 3); B = Math.Round(B, 3); C = Math.Round(C, 3);
                            if (count == 0)
                            {
                                frm2.label15.Text = "Case 1)" + Environment.NewLine + Environment.NewLine + "QA= " + (cscd * (A + cpiA) * qp).ToString() + " kN/m2" + Environment.NewLine + "QB= " + (cscd * (B + cpiB) * qp).ToString() + " kN/m2" + Environment.NewLine + "QC= " + (cscd * (C + cpiC) * qp).ToString() + " kN/m2";
                                frm2.label4.Text = "";
                            }
                            else if (count == 1 && (f / d >= 0.2 && f / d <= 0.3))
                            {
                                frm2.label4.Text = "Case 2)" + Environment.NewLine + Environment.NewLine + "QA= " + (cscd * (A + cpiA) * qp).ToString() + " kN/m2" + Environment.NewLine + "QB= " + (cscd * (B + cpiB) * qp).ToString() + " kN/m2" + Environment.NewLine + "QC= " + (cscd * (C + cpiC) * qp).ToString() + " kN/m2";
                            }
                        }
                    }
                    else if (comboBox4.SelectedItem.ToString() == "Circular")
                    {
                        frm2.pictureBox19.Visible = true;
                        C1 = 0;
                        C2 = -0.5;
                        if (f / d >= 0 && f / d <= 0.1)
                        {
                            A1 = 0.2 + 3 / 2 * (f / d - 0.1);
                            A2 = -1.4 + 44 / 9 * (f / d - 0.05);
                            A3 = -1.4 - 6 * (f / d - 0.05);
                            B1 = 8 / 3 * (f / d - 0.05);
                            B2 = -0.5 - 6 * (f / d - 0.05);
                        }
                        else if (f / d > 0.1 && f / d <= 0.25)
                        {
                            A1 = 0.2 + 3 / 2 * (f / d - 0.1);
                            A2 = -1.4 + 44 / 9 * (f / d - 0.05);
                            A3 = -1.7 + 30 / 23 * (f / d - 0.1);
                            B1 = 8 / 3 * (f / d - 0.05);
                            B2 = -0.8 - 8 / 3 * (f / d - 0.1);
                        }
                        else if (f / d > 0.25 && f / d <= 0.33)
                        {
                            A1 = 0.2 + 3 / 2 * (f / d - 0.1);
                            A2 = -1.4 + 44 / 9 * (f / d - 0.05);
                            A3 = -1.7 + 30 / 23 * (f / d - 0.1);
                            B1 = 8 / 3 * (f / d - 0.05);
                            B2 = -1.2 - 0.4 * (f / d - 0.25);
                        }
                        else if (f / d > 0.33 && f / d <= 0.5)
                        {
                            A1 = 0.2 + 3 / 2 * (f / d - 0.1);
                            A2 = -1.4 + 44 / 9 * (f / d - 0.05);
                            A3 = -1.4 + 220 / 17 * (f / d - 0.33);
                            B1 = 8 / 3 * (f / d - 0.05);
                            B2 = -1.2 - 0.4 * (f / d - 0.25);
                        }
                        else if (f / d > 0.5)
                        {
                            A1 = 0.8;
                            A2 = 0.8;
                            A3 = 0.8;
                            B1 = -1.2;
                            B2 = -1.3;
                        }
                        else
                        {
                            frm2.Hide();
                            MessageBox.Show(" The veriables, 'f' or 'd', cannot be less than 0 ");
                        }

                        if (h >= 0 && h <= 0.05)
                        {
                            A = A1;
                            B = B1;
                            C = C1;
                        }
                        else if (h > 0.05 && h <= 0.25)
                        {
                            A = (A2 - A1) / 0.25 * h / d;
                            B = (B2 - B1) / 0.5 * h / d;
                            C = (C2 - C1) / 0.5 * h / d;
                        }
                        else if (h > 0.25 && h < 0.5)
                        {
                            A = (A3 - A2) / 0.75 * h / d;
                            B = (B2 - B1) / 0.5 * h / d;
                            C = (C2 - C1) / 0.5 * h / d;
                        }
                        else if (h >= 0.5 && h < 1)
                        {
                            A = (A3 - A2) / 0.75 * h / d;
                            B = B2;
                            C = C2;
                        }
                        else if (h >= 1)
                        {
                            A = A3;
                            B = B2;
                            C = C2;
                        }
                        else
                        {
                            frm2.Hide();
                            MessageBox.Show(" The veriables, 'h' or 'd', cannot be less than 0 ");
                        }
                        //cpi calc
                        if (comboBox2.SelectedItem.ToString() == "It's not possible to estimate")
                        {
                            if (A >= 0)
                            {
                                cpiA = 0.2;
                            }
                            else
                            {
                                cpiA = -0.3;
                            }
                            if (B >= 0)
                            {
                                cpiB = 0.2;
                            }
                            else
                            {
                                cpiB = -0.3;
                            }
                            if (C >= 0)
                            {
                                cpiC = 0.2;
                            }
                            else
                            {
                                cpiC = -0.3;
                            }
                        }
                        else if (comboBox2.SelectedItem.ToString() == "Openings at the dominant face is twice the area of the openings in the remaining faces")
                        {
                            cpiA = 0.75 * A; cpiB = 0.75 * B; cpiC = 0.75 * C;
                        }
                        else if (comboBox2.SelectedItem.ToString() == "Openings at the dominant face is at least 3 times the area of the openings in the remaining faces")
                        {
                            cpiA = 0.9 * A; cpiB = 0.9 * B; cpiC = 0.9 * C;
                        }
                        else if (comboBox2.SelectedItem.ToString() == "Open silos and chimneys")
                        {
                            cpiA = -0.6; cpiB = -0.6; cpiC = -0.6;
                        }
                        else if (comboBox2.SelectedItem.ToString() == "Vented tanks with small openings")
                        {
                            cpiA = -0.4; cpiB = -0.4; cpiC = -0.4;
                        }
                        //cpi calc
                        A = Math.Round(A, 3); B = Math.Round(B, 3); C = Math.Round(C, 3);
                        frm2.label15.Text = "Case 1)" + Environment.NewLine + Environment.NewLine + "QA= " + (cscd * (A + cpiA) * qp).ToString() + " kN/m2" + Environment.NewLine + "QB= " + (cscd * (B + cpiB) * qp).ToString() + " kN/m2" + Environment.NewLine + "QC= " + (cscd * (C + cpiC) * qp).ToString() + " kN/m2";
                        frm2.label4.Text = "";
                    }
                    frm2.label10.Text = "Cross-wind Profile";
                    frm2.richTextBox1.AppendText("All calculations have performed according to EN1991-1-4. Wind actions on vaulted roof or dome have been calculated for height above ground;" + textBox1.Text + " m. terrain category; " + comboBox1.Text + " and basic wind velocity;" + textBox2.Text + " m/s. In addition, openings in building is specified as " + comboBox2.Text + Environment.NewLine + Environment.NewLine + "Wind actions on vaulted roof or dome have been calculated as a pressure. Pressure varies between different zones. Pressures on roof areas should be applied like the roof plan views at figures.(There can be multiple cases depend on f/d ratio.)" + Environment.NewLine + Environment.NewLine + "Note1: Positive sign indicates that it is a pressure, negative sign is used for suction." + Environment.NewLine + "Note2: The diagram is not applicable for flat roofs. ");
                  }
                  else
                  { 
                  frm2.Close();
                   MessageBox.Show("f + h cannot be higher than the height of the structure!", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                  }
                }
                else
                {
                    frm2.Close();
                    MessageBox.Show("Please fill required spaces", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            //end//vaulted roofs//
            //start//canopy roofs//
            else if (canopy.Checked == true)
            {
                if (!(string.IsNullOrEmpty(comboBox6.Text)) && !(string.IsNullOrEmpty(textBox23.Text)) && !(string.IsNullOrEmpty(textBox24.Text)))
                {
                    frm2.label10.Visible = true;
                    var alfa = float.Parse(textBox23.Text, CultureInfo.InvariantCulture.NumberFormat);
                    var blockage = float.Parse(textBox24.Text, CultureInfo.InvariantCulture.NumberFormat);
                    double[,] Tableromono = new double[7, 3] { { 0.2, -0.5, -1.3 }, { 0.4, -0.7, -1.4 }, { 0.5, -0.9, -1.4 }, { 0.7, -1.1, -1.4 }, { 0.8, -1.3, -1.4 }, { 1.0, -1.6, -1.4 }, { 1.2, -1.8, -1.4 } };
                    double[,] Tableroduo = new double[10, 3] { { 0.7, -0.7, -1.3 }, { 0.5, -0.6, -1.4 }, { 0.4, -0.6, -1.4 }, { 0.3, -0.5, -1.3 }, { 0.3, -0.6, -1.3 }, { 0.4, -0.7, -1.3 }, { 0.4, -0.8, -1.3 }, { 0.6, -0.9, -1.3 }, { 0.7, -1.0, -1.3 }, { 0.9, -1.0, -1.3 } };

                    if (blockage <= 100 && blockage >= 0)
                    {
                        blockage = float.Parse(textBox24.Text, CultureInfo.InvariantCulture.NumberFormat);
                    }
                    else
                    {
                        frm2.Hide();
                        MessageBox.Show("Please Type a percent of blockage (between 100 and 0). It is the ratio of the area of feasible, actual obstructions under the canopy divided by the cross sectional area under the canopy, both areas being normal to the wind direction. ");
                    }

                    if (comboBox6.SelectedItem.ToString() == "Monopitch")
                    {
                        frm2.label17.Visible = true; frm2.label18.Visible = true; frm2.pictureBox22.Visible = true;
                        if (alfa >= 0 && alfa <= 5)
                        {
                            i = 0; boundary = 0;
                        }
                        else if (alfa > 5 && alfa <= 10)
                        {
                            i = 1; boundary = 5;
                        }
                        else if (alfa > 10 && alfa <= 15)
                        {
                            i = 2; boundary = 10;
                        }
                        else if (alfa > 15 && alfa <= 20)
                        {
                            i = 3; boundary = 15;
                        }
                        else if (alfa > 20 && alfa <= 25)
                        {
                            i = 4; boundary = 20;
                        }
                        else if (alfa > 25 && alfa <= 30)
                        {
                            i = 5; boundary = 25;
                        }
                        else
                        {
                            frm2.Hide();
                            MessageBox.Show(" The roof angle 'α' cannot be less than 0° and more than 30° ");
                        }
                        A1 = Tableromono[i, 0] + (Tableromono[i + 1, 0] - Tableromono[i, 0]) / 5 * (alfa - boundary);
                        A2 = (Tableromono[i, 1] + (Tableromono[i, 2] - Tableromono[i, 1]) / 100 * blockage) - ((Tableromono[i, 1] + (Tableromono[i, 2] - Tableromono[i, 1]) / 100 * blockage) - (Tableromono[i + 1, 1] + (Tableromono[i + 1, 2] - Tableromono[i + 1, 1]) / 100 * blockage)) / 5 * (alfa - boundary);
                        A1 = cscd * A1 * qp; A2 = cscd * A2 * qp; A1 = Math.Round(A1, 3); A2 = Math.Round(A2, 3);
                        frm2.label17.Text = A1.ToString() + " kN/m2                                                          " + A1.ToString() + " kN/m2";
                        frm2.label18.Text = A2.ToString() + " kN/m2                                                          " + A2.ToString() + " kN/m2";
                    }
                    else if (comboBox6.SelectedItem.ToString() == "Duopitch")
                    {
                        frm2.pictureBox23.Visible = true; frm2.label19.Visible = true; frm2.label20.Visible = true;

                        if (checkBox3.Checked == false)
                        {
                            alfa = alfa * -1;
                        }
                        else
                        {
                            alfa = alfa * 1;
                        }

                        if (alfa >= -20 && alfa <= -15)
                        {
                            i = 0; boundary = -20;
                        }
                        else if (alfa > -15 && alfa <= -10)
                        {
                            i = 1; boundary = -15;
                        }
                        else if (alfa > -10 && alfa <= -5)
                        {
                            i = 2; boundary = -10;
                        }
                        else if (alfa > -5 && alfa <= 5)
                        {
                            i = 3; boundary = -5;
                        }
                        else if (alfa > 5 && alfa <= 10)
                        {
                            i = 4; boundary = 5;
                        }
                        else if (alfa > 10 && alfa <= 15)
                        {
                            i = 5; boundary = 10;
                        }
                        else if (alfa > 15 && alfa <= 20)
                        {
                            i = 6; boundary = 15;
                        }
                        else if (alfa > 20 && alfa <= 25)
                        {
                            i = 7; boundary = 20;
                        }
                        else if (alfa > 25 && alfa <= 30)
                        {
                            i = 8; boundary = 25;
                        }
                        else
                        {
                            frm2.Hide();
                            MessageBox.Show(" The roof angle 'α' cannot be less than -20° and more than 30° ");
                        }
                        A1 = Tableroduo[i, 0] + (Tableroduo[i + 1, 0] - Tableroduo[i, 0]) / 5 * (alfa - boundary);
                        A2 = (Tableroduo[i, 1] + (Tableroduo[i, 2] - Tableroduo[i, 1]) / 100 * blockage) - ((Tableroduo[i, 1] + (Tableroduo[i, 2] - Tableroduo[i, 1]) / 100 * blockage) - (Tableroduo[i + 1, 1] + (Tableroduo[i + 1, 2] - Tableroduo[i + 1, 1]) / 100 * blockage)) / 5 * (alfa - boundary);
                        A1 = cscd * A1 * qp; A2 = cscd * A2 * qp; A1 = Math.Round(A1, 3); A2 = Math.Round(A2, 3);
                        frm2.label19.Text = A1.ToString() + "kN/m2                    " + A1.ToString() + "kN/m2                               " + A1.ToString() + " kN/m2";
                        frm2.label20.Text = A2.ToString() + "kN/m2                    " + A2.ToString() + "kN/m2                               " + A2.ToString() + " kN/m2";
                    }
                    frm2.richTextBox1.AppendText("All calculations have performed according to EN1991-1-4. Wind actions on canopy roofs have been calculated for height above ground;" + textBox1.Text + " m. terrain category; " + comboBox1.Text + " and basic wind velocity;" + textBox2.Text + " m/s. In addition, openings in building is specified as " + comboBox2.Text + Environment.NewLine + Environment.NewLine + "Wind actions on canopy roofs have been calculated as a pressure. Pressure varies between different zones. Pressures on roof areas should be applied like the roof plan views at figures.(There can be multiple cases for positive and negative pressures.)" + Environment.NewLine + Environment.NewLine + "Note1: Positive sign indicates that it is a pressure, negative sign is used for suction." + Environment.NewLine + "Note2: Blockage ,Ļ• ,  is the ratio of the area of feasible, actual obstructions under the canopy divided by the cross sectional area under the canopy. ");
                }
                else
                {
                    frm2.Close();
                    MessageBox.Show("Please fill required spaces", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            //end//canopy roofs//
            else
            {
                frm2.Hide();
                MessageBox.Show("Please select the roof type or walls and fill required spaces.");
            }
            //start//bridges//

            //end//bridges//
        }
        private void checkBox1_CheckChanged(object sender, EventArgs e)
        {
            if (checkBox1.Checked == false)
            {
                panel1.Visible = true;
            }
            else
            {
                panel1.Visible = false;
            }
        }
        private void comboBox3_ItemSelected(object sender, EventArgs e)
        {
            label13.Visible = true;textBox10.Visible = true;
            if (comboBox3.SelectedItem.ToString() == "With Parapets")
            {
                label13.Text = "hp:                 m";
                pictureBox18.Visible = true; pictureBox19.Visible = false;
            }
            else if (comboBox3.SelectedItem.ToString() == "Curved Eaves")
            {
                label13.Text = "  r:                  m";
                pictureBox19.Visible = true; pictureBox18.Visible = false;
            }
            else if (comboBox3.SelectedItem.ToString() == "Mansard Eaves")
            {
                label13.Text = " α:                  °";
                pictureBox19.Visible = true; pictureBox18.Visible = false;
            }
        }
        private void radioButtonX_CheckChanged(object sender, EventArgs e)
        {
            button3.Visible = true;
            if (monopitch.Checked == true)
            {
                pictureBox9.Visible = true; pictureBox10.Visible = true;

                panel3.Visible = true;
                walls.Enabled = false;
                duopitch.Enabled = false;
                hipped.Enabled = false;
                multispan.Enabled = false;
                vaulted.Enabled = false;
                flat.Enabled = false;
                canopy.Enabled = false;

            }
            else if (duopitch.Checked == true)
            {
                pictureBox11.Visible = true; pictureBox12.Visible = true;

                panel4.Visible = true;
                walls.Enabled = false;
                monopitch.Enabled = false;
                hipped.Enabled = false;
                multispan.Enabled = false;
                vaulted.Enabled = false;
                flat.Enabled = false;
                canopy.Enabled = false;
            }
            else if (hipped.Checked == true)
            {
                pictureBox14.Visible = true; pictureBox15.Visible = true;

                panel5.Visible = true;
                walls.Enabled = false;
                duopitch.Enabled = false;
                monopitch.Enabled = false;
                multispan.Enabled = false;
                vaulted.Enabled = false;
                flat.Enabled = false;
                canopy.Enabled = false;
            }
            else if (multispan.Checked == true)
            {
                panel6.Visible = true;
                walls.Enabled = false;
                duopitch.Enabled = false;
                hipped.Enabled = false;
                monopitch.Enabled = false;
                vaulted.Enabled = false;
                flat.Enabled = false;
                canopy.Enabled = false;
            }
            else if (vaulted.Checked == true)
            {
                pictureBox17.Visible = true;

                panel7.Visible = true;
                walls.Enabled = false;
                duopitch.Enabled = false;
                hipped.Enabled = false;
                multispan.Enabled = false;
                monopitch.Enabled = false;
                flat.Enabled = false;
                canopy.Enabled = false;
            }
            else if (flat.Checked == true)
            {
                panel8.Visible = true;
                walls.Enabled = false;
                duopitch.Enabled = false;
                hipped.Enabled = false;
                multispan.Enabled = false;
                vaulted.Enabled = false;
                monopitch.Enabled = false;
                canopy.Enabled = false;
            }
            else if (canopy.Checked == true)
            {
                panel9.Visible = true; checkBox3.Visible = false;
                walls.Enabled = false;
                duopitch.Enabled = false;
                hipped.Enabled = false;
                multispan.Enabled = false;
                vaulted.Enabled = false;
                flat.Enabled = false;
                monopitch.Enabled = false;
            }
            else if (walls.Checked == true)
            {
                pictureBox7.Visible = true; pictureBox8.Visible = true;

                panel10.Visible = true;
                monopitch.Enabled = false;
                duopitch.Enabled = false;
                hipped.Enabled = false;
                multispan.Enabled = false;
                vaulted.Enabled = false;
                flat.Enabled = false;
                canopy.Enabled = false;
            }
            else
            {
                walls.Enabled = true;
                monopitch.Enabled = true;
                duopitch.Enabled = true;
                hipped.Enabled = true;
                multispan.Enabled = true;
                vaulted.Enabled = true;
                flat.Enabled = true;
                canopy.Enabled = true;
            }
        }
        //start//back button//
        private void backButton_Clicked(object sender, EventArgs e)
        {
            button3.Visible = false;

            walls.Checked = false; monopitch.Checked = false; duopitch.Checked = false; hipped.Checked = false; multispan.Checked = false; vaulted.Checked = false; flat.Checked = false; canopy.Checked = false;

            panel3.Visible = false; panel4.Visible = false; panel5.Visible = false; panel6.Visible = false; panel7.Visible = false; panel8.Visible = false; panel9.Visible = false; panel10.Visible = false;
            button3.PerformClick();

            pictureBox7.Visible = false; pictureBox8.Visible = false; pictureBox9.Visible = false; pictureBox10.Visible = false; pictureBox11.Visible = false; pictureBox12.Visible = false; pictureBox13.Visible = false; pictureBox14.Visible = false; pictureBox15.Visible = false;
            pictureBox17.Visible = false; pictureBox18.Visible = false; pictureBox19.Visible = false; pictureBox20.Visible = false; pictureBox21.Visible = false; pictureBox22.Visible = false;
        }
        //end//back button
        private void checkBox2_CheckChanged(object sender, EventArgs e)
        {
            if (checkBox2.Checked == false)
            {
                pictureBox11.Visible = false; pictureBox13.Visible = true;
            }
            else
            {
                pictureBox11.Visible = true; pictureBox13.Visible = false;
            }
        }
        private void comboBox6_ItemSelected(object sender, EventArgs e)
        {
            
            if (comboBox6.SelectedItem.ToString() == "Monopitch")
            {
                checkBox3.Visible = false;
                pictureBox20.Visible = true;
                pictureBox21.Visible = false; pictureBox22.Visible = false;
            }
            else if (comboBox6.SelectedItem.ToString() == "Duopitch")
            {
                checkBox3.Visible = true;
                pictureBox20.Visible = false;

                if (checkBox3.Checked == true)
                {
                    pictureBox21.Visible = true;
                    pictureBox22.Visible = false;
                }
                else
                {
                    pictureBox22.Visible = true;
                    pictureBox21.Visible = false;
                }
            }
        }
    }
}

One thought on “Jove 1.0 – Source of the code

Add yours

Leave a comment

Create a website or blog at WordPress.com

Up ↑