// Desarmar o Alarme
        private void close_device(object sender, EventArgs e)
        {
            DateTime currentDate = DateTime.Now;

            if (alarmIsArmed)
            {
                AlarmPin alarmPin = new AlarmPin();
                alarmPin.ShowDialog();

                if (alarmPin.correctPin)
                {
                    alarmSound("stop");
                    K8055.ClearDigitalChannel(1);
                    K8055.ClearDigitalChannel(2);
                    K8055.CloseDevice();
                    textBoxLogs.Text         += "[" + currentDate.ToString() + "]" + " Alarme Desarmado (Manualmente)" + Environment.NewLine;
                    labelS1.BackColor         = Color.Red;
                    labelS2.BackColor         = Color.Red;
                    labelS3.BackColor         = Color.Red;
                    labelS4.BackColor         = Color.Red;
                    labelS5.BackColor         = Color.Red;
                    labelOpenDevice.BackColor = Color.Red;
                    alarmIsArmed         = false;
                    alarmEnabled         = false;
                    externalArm          = false;
                    randomIlumination    = false;
                    timeToEnableExternal = 0;
                    alarmPin.correctPin  = false;
                    ringAlarmLog         = 0;
                    playTime             = 10;
                }
                else
                {
                    attempts += 1;

                    if (attempts == 3)
                    {
                        alarmSound("play");
                        textBoxLogs.Text += "[" + currentDate.ToString() + "]" + " Alarme Ativado! (Devido a exesso de tentativas sem sucesso)" + Environment.NewLine;
                        if (state == 1)
                        {
                            send_Mail(2);
                            mailFlag = 1;
                        }
                    }
                    else
                    {
                        textBoxLogs.Text += "[" + currentDate.ToString() + "]" + " PIN INCORRETO!!! Tentativa de desarme sem sucesso: (" + attempts + ")" + Environment.NewLine;
                    }

                    alarmPin.Close();
                }
            }
            else
            {
                textBoxLogs.Text += "[" + currentDate.ToString() + "]" + " O Alarme já está Desarmado" + Environment.NewLine;
            }
        }
        // Botão para confirmar o desarmar automatico
        private void buttonSetDisarm_Click(object sender, EventArgs e)
        {
            DateTime dateNow  = DateTime.Now;
            AlarmPin alarmPin = new AlarmPin();

            alarmPin.ShowDialog();
            if (alarmPin.correctPin)
            {
                // Desarmar
                hourDisarm = timePickerDesarmar.Value.Hour;
                minDisarm  = timePickerDesarmar.Value.Minute;

                String horarioDesarmar = timePickerDesarmar.Value.TimeOfDay.Hours.ToString() + "H" + timePickerDesarmar.Value.TimeOfDay.Minutes.ToString();

                textBoxLogs.Text += "[" + dateNow.ToString() + "]" + " Desarme Automático às: " + horarioDesarmar + Environment.NewLine;
            }
        }