BrrrBayBay.PwmLogic.MainForm.loadControlComponent C# (CSharp) Метод

loadControlComponent() приватный Метод

private loadControlComponent ( ) : void
Результат void
        private void loadControlComponent()
        {
            connector.SampleRate = Properties.Settings.Default.SampleRate;
            controlMode = Properties.Settings.Default.GenerationMode;

            switch (controlMode)
            {
                case PwmControlMode.GenericAsync:
                    mainControl = new GenericPwmControl( PwmGeneratorModes.Asynchronous);
                    this.Text = ApplicationTitle + "  [ASynchronous mode]";
                    break;
                case PwmControlMode.GenericSync:
                    mainControl = new GenericPwmControl( PwmGeneratorModes.Synchronous);
                    this.Text = ApplicationTitle + "  [Synchronous mode]";
                    break;
                case PwmControlMode.RCControl:
                    mainControl = new RcPwmControl();
                    this.Text = ApplicationTitle + "  [R/C control mode]";
                    break;
                default:
                    MessageBox.Show("This mode is not supported yet");
                    endActiveMode();
                    return;
            }

            mainControl.ShowRealValueToolTips = Properties.Settings.Default.ShowRealValueToolTips;
            mainControl.ColoredBorders = Properties.Settings.Default.ColoredChannelBorders;
            mainControl.initialize(connector);
            mainControlPanel.Controls.Add((Control)mainControl);

            this.Size = new System.Drawing.Size(((Control)mainControl).Size.Width + 10, ((Control)mainControl).Size.Height + 100);

            startPwmButton.Enabled = connector.Connected;

            // If there are settings to be loaded
            if (currentSettings != null)
            {
                if (Properties.Settings.Default.GenerationMode == currentSettings.ControlMode)
                {
                    mainControl.loadSettings(currentSettings.ControllerSettings);
                }
                else
                {
                    currentSettings = null;
                }
            }
        }