private void InitializeControls()
        {
            var errorIcon = BitmapProcessor.CreateIcon(Resources.exclamation);

            if (errorIcon != null)
            {
                MainErrorProvider.Icon = errorIcon;
            }

            MainContainer.SelectedPage = WelcomePage;

            FirmwareVersionTextBox.ReadOnly  = true;
            FirmwareVersionTextBox.BackColor = Color.White;

            BuildTextBox.ReadOnly  = true;
            BuildTextBox.BackColor = Color.White;

            HardwareVersionTextBox.ReadOnly  = true;
            HardwareVersionTextBox.BackColor = Color.White;

            BootModeTextBox.ReadOnly  = true;
            BootModeTextBox.BackColor = Color.White;

            TraceTextBox.ReadOnly  = true;
            TraceTextBox.BackColor = Color.White;

            InititalizeComboBoxes();

            TemperatureTypeComboBox.SelectedValueChanged += (s, e) =>
            {
                var isCelcius = TemperatureTypeComboBox.GetSelectedItem <bool>();
                if (isCelcius)
                {
                    TemperatureUpDown.Minimum = 100;
                    TemperatureUpDown.Maximum = 315;
                }
                else
                {
                    TemperatureUpDown.Minimum = 200;
                    TemperatureUpDown.Maximum = 600;
                }
            };

            PreheatTypeComboBox.SelectedValueChanged += (s, e) =>
            {
                var isPercents = PreheatTypeComboBox.GetSelectedItem <bool>();
                if (isPercents)
                {
                    PreheatPowerUpDown.DecimalPlaces = 0;
                    PreheatPowerUpDown.Increment     = 1;
                    PreheatPowerUpDown.Minimum       = 100;
                    PreheatPowerUpDown.Maximum       = 250;
                }
                else
                {
                    PreheatPowerUpDown.DecimalPlaces = 1;
                    PreheatPowerUpDown.Increment     = 0.1m;
                    PreheatPowerUpDown.Minimum       = 1;
                    PreheatPowerUpDown.Maximum       = 75;
                }
            };

            SelectedModeComboBox.SelectedValueChanged += (s, e) =>
            {
                var mode = SelectedModeComboBox.GetSelectedItem <VapeMode>();
                switch (mode)
                {
                case VapeMode.TempNi:
                    SetupModesCheckBoxes(TempNiModeCheckBox);
                    break;

                case VapeMode.TempTi:
                    SetupModesCheckBoxes(TempTiModeCheckBox);
                    break;

                case VapeMode.TempSS:
                    SetupModesCheckBoxes(TempSSModeCheckBox);
                    break;

                case VapeMode.TCR:
                    SetupModesCheckBoxes(TCRModeCheckBox);
                    break;

                case VapeMode.Power:
                    SetupModesCheckBoxes(PowerModeCheckBox);
                    break;

                case VapeMode.Bypass:
                    SetupModesCheckBoxes(BypassModeCheckBox);
                    break;

                case VapeMode.Start:
                    SetupModesCheckBoxes(SmartModeCheckBox);
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }

                SelectedTCRComboBox.SelectedIndex = Math.Min(m_dataflash.ParamsBlock.SelectedTCRIndex, (byte)2);
                SelectedTCRComboBox.Visible       = TCRIndexLabel.Visible = mode == VapeMode.TCR;
            };

            BatteryModelComboBox.SelectedValueChanged += (s, e) =>
            {
                var batteryModel = BatteryModelComboBox.GetSelectedItem <BatteryModel>();
                BatteryEditButton.Visible = batteryModel == BatteryModel.Custom;
            };

            PortComboBox.SelectedIndex       = 0;
            BrightnessTrackBar.ValueChanged += (s, e) => BrightnessPercentLabel.Text = (int)(BrightnessTrackBar.Value * 100m / 255) + @"%";

            DownloadButton.Click += DownloadButton_Click;
            UploadButton.Click   += UploadButton_Click;
            ResetButton.Click    += ResetButton_Click;

            BatteryEditButton.Click += BatteryEditButton_Click;

            TakeScreenshotButton.Click += TakeScreenshotButton_Click;
            SaveScreenshotButton.Click += SaveScreenshotButton_Click;
            BroadcastButton.Click      += BroadcastButton_Click;
            RebootButton.Click         += RebootButton_Click;

            ComConnectButton.Click    += ComConnectButton_Click;
            ComDisconnectButton.Click += ComDisconnectButton_Click;
            CommandTextBox.KeyDown    += CommandTextBox_KeyDown;
        }