//********************************************************************************************************************
        //                                           AutoConnect
        //********************************************************************************************************************

        public string AutoOpen(AutoConnect_Window myLoadScreen)
        {
            int iterration = 5;

            if (ComPort_select.Text == "")   //Wenn kein Port gewählt ist
            {
                return("Rth-Rack: No COM-Port selected!" + Environment.NewLine);
            }

            //COMPort anpassen
            Serial_Interface.PortName = ComPort_select.Text;

            //Verbindung herstellen
            try
            {
                Serial_Interface.Open();
            }
            catch (UnauthorizedAccessException)
            {
                return("Rth-Rack: COM Port is allready in use!" + Environment.NewLine);
            }
            catch (System.IO.IOException)
            {
                return("Rth-Rack: COM Port is not available!" + Environment.NewLine);
            }

            myLoadScreen.ChangeTask("Checking device ...", iterration);

            //Abfragen ob richtiges Gerät
            DeviceType = Write_N_Read("GID");

            //Checken ob vom richtigen Typ
            if (!DeviceType.Contains("RthTEC TTA-Equipment"))
            {
                Serial_Interface.Close();
                return("Rth-Rack: COM Port represents no Rth-Rack!" + Environment.NewLine);
            }

            myLoadScreen.ChangeTask("Reset ...", iterration);
            //Reset
            Write_N_Read("RST");

            //Delay
            Thread.Sleep(2000);

            //Default Einstellungen setzen
            SetEnable(false);

            //SetDefaultSetup();

            myLoadScreen.ChangeTask("Change GUI ...", iterration);

            //Oberfläche anpassen
            IsConnected = true;

            //Reset_Button.Enabled = true;
            TestPulse.Enabled     = true;
            Enable_Button.Enabled = true;

            UI_KindOfComponent.Enabled = true;
            UI_Heat_Time.Enabled       = true;
            UI_Heat_Current.Enabled    = true;
            UI_Heat_Voltage.Enabled    = true;
            UI_Meas_Time.Enabled       = true;
            UI_Meas_Current.Enabled    = true;
            UI_Meas_Voltage.Enabled    = true;
            UI_Cycles.Enabled          = true;
            UI_Offset_Voltage.Enabled  = true;


            ComPort_select.Enabled = false;

            OpenClose.Text = "Close";

            cm.Items["Reset"].Enabled = true;

            return("");
        }
        //********************************************************************************************************************
        //                                          Button Events
        //********************************************************************************************************************

        #region Button_Events

        public void OpenClose_Click(object sender, EventArgs e)
        {
            if (!IsConnected)
            {
                if (ComPort_select.Text == "")   //Wenn kein Port gewählt ist
                {
                    MessageBox.Show("A COM Port has to be selected! \n Try again.", "Warning",
                                    MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                //COMPort anpassen
                Serial_Interface.PortName = ComPort_select.Text;

                //Verbindung herstellen
                try
                {
                    Serial_Interface.Open();
                }
                catch (UnauthorizedAccessException)
                {
                    //Wenn es nicht funktioniert --> abbrechen
                    MessageBox.Show("COM Port is allready in use!\n Try again.", "Warning",
                                    MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                catch (System.IO.IOException)
                {
                    MessageBox.Show("COM Port is not available!\nTry again.", "Warning",
                                    MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }



                //Abfragen ob richtiges Gerät
                DeviceType = Write_N_Read("GID");

                //Checken ob vom richtigen Typ
                if (!DeviceType.Contains("RthTEC TTA-Equipment"))
                {
                    MessageBox.Show("COM Port represents no Rth-Rack!\n Try again.", "Warning",
                                    MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    Serial_Interface.Close();
                    return;
                }

                //Reset
                Write_N_Read("RST");

                //Delay
                Thread.Sleep(2000);

                //Default Einstellungen setzen
                SetEnable(false);

                //SetDefaultSetup();

                //Oberfläche anpassen
                IsConnected = true;

                //Reset_Button.Enabled = true;
                TestPulse.Enabled     = true;
                Enable_Button.Enabled = true;

                UI_KindOfComponent.Enabled = true;
                UI_Heat_Time.Enabled       = true;
                UI_Heat_Current.Enabled    = true;
                UI_Heat_Voltage.Enabled    = true;
                UI_Meas_Time.Enabled       = true;
                UI_Meas_Current.Enabled    = true;
                UI_Meas_Voltage.Enabled    = true;
                UI_Cycles.Enabled          = true;
                UI_Offset_Voltage.Enabled  = true;


                ComPort_select.Enabled = false;

                OpenClose.Text = "Close";

                cm.Items["Reset"].Enabled = true;
            }

            else
            {
                //COMPort schließen
                Serial_Interface.Close();

                //Oberfläche anpassen
                IsConnected = false;

                //Reset_Button.Enabled = false;
                TestPulse.Enabled     = false;
                Enable_Button.Enabled = false;

                UI_KindOfComponent.Enabled = false;
                UI_Heat_Time.Enabled       = false;
                UI_Heat_Current.Enabled    = false;
                UI_Heat_Voltage.Enabled    = false;
                UI_Meas_Time.Enabled       = false;
                UI_Meas_Current.Enabled    = false;
                UI_Meas_Voltage.Enabled    = false;
                UI_Cycles.Enabled          = false;
                UI_Offset_Voltage.Enabled  = false;

                ComPort_select.Enabled = true;

                OpenClose.Text = "Open";

                cm.Items["Reset"].Enabled = false;
            }
        }