예제 #1
0
 private void radioButtonDivide_CheckedChanged(object sender, EventArgs e)
 {
     if (sender is RadioButton)
     {
         if ((sender as RadioButton).Checked)
         {
             // update trace math operation
             traceMathOperationType = TraceMathOperationTypeEnum.DIVIDE;
             Properties.Settings.Default.traceMathOperationSetting = traceMathOperationType.ToString();
             Properties.Settings.Default.Save();
         }
     }
 }
예제 #2
0
        // ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

        private void initTraceMathOperationRadioButtons(TraceMathOperationTypeEnum operation)
        {
            switch (operation)
            {
            default:
            case TraceMathOperationTypeEnum.ADD:
                radioButtonAdd.Checked = true;
                break;

            case TraceMathOperationTypeEnum.SUBTRACT:
                radioButtonSubtract.Checked = true;
                break;

            case TraceMathOperationTypeEnum.MULTIPLY:
                radioButtonMultiply.Checked = true;
                break;

            case TraceMathOperationTypeEnum.DIVIDE:
                radioButtonDivide.Checked = true;
                break;
            }
        }
예제 #3
0
        // ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

        public FormMain()
        {
            InitializeComponent();

            // --------------------------------------------------------------------------------------------------------

            // set form icon
            Icon = Properties.Resources.app_icon;

            // set form title
            Text = Program.programName;

            // disable resizing the window
            FormBorderStyle = FormBorderStyle.FixedSingle;
            MaximizeBox     = false;
            MinimizeBox     = true;

            // position the plug-in in the lower right corner of the screen
            Rectangle workingArea = Screen.GetWorkingArea(this);

            Location = new Point(workingArea.Right - Size.Width - 130,
                                 workingArea.Bottom - Size.Height - 50);

            // always display on top
            TopMost = true;

            // --------------------------------------------------------------------------------------------------------

            // disable ui
            panelMain.Enabled = false;

            // set version label text
            toolStripStatusLabelVersion.Text = "v" + Assembly.GetExecutingAssembly().GetName().Version.ToString(3);

            // --------------------------------------------------------------------------------------------------------

            // init trace math operation
            if (string.IsNullOrEmpty(Properties.Settings.Default.traceMathOperationSetting))
            {
                Properties.Settings.Default.traceMathOperationSetting = TraceMathOperationTypeEnum.ADD.ToString();
                Properties.Settings.Default.Save();
            }

            // update trace math operation
            string value = Properties.Settings.Default.traceMathOperationSetting;

            traceMathOperationType = (TraceMathOperationTypeEnum)Enum.Parse(typeof(TraceMathOperationTypeEnum), value);

            // init trace math operation radio buttons
            initTraceMathOperationRadioButtons(traceMathOperationType);

            // --------------------------------------------------------------------------------------------------------

            // update the channel selection combo box
            updateChanComboBox();

            // --------------------------------------------------------------------------------------------------------

            // init color button enabled state
            buttonColorTraceA.Enabled       = false;
            buttonColorTraceB.Enabled       = false;
            buttonColorTraceResults.Enabled = false;

            // init color button background color
            buttonColorTraceA.BackColor       = colorTraceA;
            buttonColorTraceB.BackColor       = colorTraceB;
            buttonColorTraceResults.BackColor = colorTraceResults;

            // --------------------------------------------------------------------------------------------------------

            // start the ready timer
            readyTimer.Interval = 250; // 250 ms interval
            readyTimer.Enabled  = true;
            readyTimer.Start();

            // start the update timer
            updateTimer.Interval = 250; // 250 ms interval
            updateTimer.Enabled  = true;
            updateTimer.Start();

            // start the refresh timer
            refreshTimer.Interval = 100; // 100 ms interval
            refreshTimer.Enabled  = true;
            refreshTimer.Start();

            // --------------------------------------------------------------------------------------------------------
        }