/// <summary>
        /// Periodically check switching progress.
        /// </summary>
        /// <exception cref="ApplicationException">Wrong TemperatureControlMode.</exception>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void TimerSwitch_Tick(object sender, EventArgs e)
        {
            switch (temperatureControlMode)
            {
            case TemperatureControlMode.None:
                throw new ApplicationException("Wrong mode.");

            case TemperatureControlMode.ET2PC_switch:
                if (!ADC.Switched2Eurotherm())
                {
                    timerSwitch.Stop();
                    temperatureControlMode      = TemperatureControlMode.None;
                    Front.SwitchButtonTextIndex = 0;
                    LED(LEDcolour.Off);
                }
                break;

            case TemperatureControlMode.PC2ET_equal:
                // If switched before the voltages are equalized.
                if (ADC.Switched2Eurotherm())
                {
                    timerSwitch.Stop();
                    temperatureControlMode      = TemperatureControlMode.None;
                    Front.SwitchButtonTextIndex = 0;
                    LED(LEDcolour.Off);
                    break;
                }
                // If difference is lesser than error.
                Front.My_msg("XX AR" + ADC.ReadEurothermV() + "  AL" + DAC.LastWrittenValue);
                if (Math.Abs(ADC.ReadEurothermV() - DAC.LastWrittenValue) < 0.05)
                {
                    temperatureControlMode = TemperatureControlMode.PC2ET_switch;
                    Front.My_msg("You can switch to Eurotherm.");
                    LED(LEDcolour.Green);
                }
                break;

            case TemperatureControlMode.PC2ET_switch:
                // If difference is greater again than error.
                if (Math.Abs(ADC.ReadEurothermV() - DAC.LastWrittenValue) >= 0.05)
                {
                    temperatureControlMode = TemperatureControlMode.PC2ET_equal;
                    LED(LEDcolour.Red);
                }
                if (ADC.Switched2Eurotherm())
                {
                    timerSwitch.Stop();
                    temperatureControlMode      = TemperatureControlMode.None;
                    Front.SwitchButtonTextIndex = 0;
                    LED(LEDcolour.Off);
                }
                break;

            default:
                break;
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public bool Switch(out double outputVoltage)
        {
            outputVoltage = double.NaN;
            if (temperatureControlMode == TemperatureControlMode.None)
            {
                if (!double.IsNaN(outputVoltage))
                {
                    // Switched to eurotherm, so switching to this app.
                    if (ADC.Switched2Eurotherm())
                    {
                        outputVoltage = ADC.ReadEurothermV();
                        // Round to 12b - this should be given by DAC.
                        outputVoltage = Math.Round(outputVoltage / 10 * 4096) / 409.6;  // ??
                        DAC.SetV(outputVoltage, 2);

                        Front.My_msg("You can switch to PC.");
                        LED(LEDcolour.Green);
                    }
                    // Switched to this app, so switching to eurotherm.
                    else
                    {
                        double percent = DAC.LastWrittenValue / 5 * 100;                                                 // Percentage out of 5 V.
                        var    a       = DAC.GetV();
                        Front.My_msg("XX  P" + percent + "  DL" + DAC.LastWrittenValue + "  a0" + a[0] + "  a1" + a[1]); // Analyze. DELETE!!!

                        Front.My_msg(string.Format("Set Eurotherm to Manual / {0:F1} %.", percent));
                        LED(LEDcolour.Red);
                    }
                    timerSwitch.Start();
                    temperatureControlMode = TemperatureControlMode.ET2PC_switch;
                }
                else
                {
                    temperatureControlMode = TemperatureControlMode.PC2ET_equal;
                }
            }
            // Sth is already happening => abort.
            else
            {
                timerSwitch.Stop();
                LED(LEDcolour.Off);
                temperatureControlMode = TemperatureControlMode.None;
            }
            return(temperatureControlMode == TemperatureControlMode.None);
        }