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

namespace WindowsFormsApplication1
{
    public partial class frmState : Form
    {
        private frmState()
        {
            InitializeComponent();
        }
        Form callerForm;
        public frmState(Form f1)
        {
            InitializeComponent();
            this.callerForm = f1; 
            


        }

        public void showMe()
        {
            Show();
            if (callerForm != null)
            {
                callerForm.Hide();
            }
            
        }





        private void button1_Click(object sender, EventArgs e)
        {
            PublicVarClass.xCoef = 1;
            PublicVarClass.yCoef = 1;
            //PublicVarClass.aCoef = 1;
            openSendForm();
            //Close();
        }





        void openSendForm()
        {
            if (PublicVarClass.isAuto == true)
            {
                frmAuto formAuto = new frmAuto(this);
                formAuto.showMe();

            }
            else
            {
                frmManual formManual = new frmManual(this);
                formManual.showMe();
            }

        }

        private void button2_Click(object sender, EventArgs e)
        {

            PublicVarClass.xCoef = 1;
            PublicVarClass.yCoef = -1;
            
            openSendForm();
            //Close();
        }

        private void button3_Click(object sender, EventArgs e)
        {
            PublicVarClass.xCoef = -1;
            PublicVarClass.yCoef = 1;
            
            openSendForm();
            //Close();
        }

        private void button4_Click(object sender, EventArgs e)
        {
            PublicVarClass.xCoef = -1;
            PublicVarClass.yCoef = -1;
            
            openSendForm();
            //Close();
        }

        private void button5_Click(object sender, EventArgs e)
        {
            Close();
        }

        private void frmState_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (callerForm != null)
            {
                callerForm.Show();
            }
        }






    }
}
