示例#1
0
        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;
                }
            }
        }
示例#2
0
        private void endActiveMode()
        {
            startPwmButton.Enabled = false;
            stopPwmButton.Enabled  = false;

            if (connector.Running)
            {
                connector.Stop();
            }

            mainControl.deInitialize();
            mainControlPanel.Controls.Clear();

            mainControl.Dispose();
            mainControl = null;

            this.Text = ApplicationTitle;

            jitterLabel.Visible = false;
            jitterCount         = 0;

            GC.Collect();                       // Just to make sure
        }
示例#3
0
        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;
                }
            }
        }
示例#4
0
        private void endActiveMode()
        {
            startPwmButton.Enabled = false;
            stopPwmButton.Enabled = false;

            if (connector.Running)
            {
                connector.Stop();
            }

            mainControl.deInitialize();
            mainControlPanel.Controls.Clear();

            mainControl.Dispose();
            mainControl = null;

            this.Text = ApplicationTitle;

            jitterLabel.Visible = false;
            jitterCount = 0;

            GC.Collect();		// Just to make sure
        }