/* Connect to the device */
        public static void Connect()
        {
            //Set connection marker to true
            Connected = true;

            //Try to connect, otherwise return
            if (!Serial.Connect())
            {
                return;
            }

            //If the connection worked
            if (Connected)
            {
                //Show waiting message
                GUI.ConnectInfo.Text = "Waiting for device..";
                GUI.ConnectInfo.Update();

                //Get the infos from the device
                Serial.GetInfos();

                //Connection not working because of an error
                if (!Connected)
                {
                    //Ask the user if he wants to flash anyway
                    DialogResult result = MessageBox.Show("Unable to connect to the Thermocam on port COM10.\n" +
                                                          "Make sure the device is turned on and set to live mode.\n" +
                                                          "Do you want to continue flashing without an active connection?",
                                                          "Continue without Connection", MessageBoxButtons.YesNo);

                    //If the answer is no, return
                    if (result == DialogResult.No)
                    {
                        //Reset label
                        GUI.ConnectInfo.Text = "Press the connect button";

                        //Close the serial connection
                        Serial.CloseConnection();

                        //Leave
                        return;
                    }

                    //If it is yes, set hardware version to unknown
                    HardwareVersion = 0;
                }
            }
            //Set hardware version to unknown for no connection
            else
            {
                HardwareVersion = 0;
            }

            //Connection established
            GUI.ConnectButton.Enabled   = false;
            GUI.ConnectButton.BackColor = Color.DimGray;

            //Set status text
            if (HardwareVersion == 0)
            {
                GUI.ConnectInfo.Text = "Flash without active connection";
            }
            else
            {
                GUI.ConnectInfo.Text = "Connected to DIY-Thermocam V" + HardwareVersion;
            }

            //Add interrupt based serial handler
            Serial.AddSerialHandler();

            //Enable load and button
            GUI.LoadButton.Enabled   = true;
            GUI.LoadButton.BackColor = Color.White;
        }