Пример #1
0
 public void RunButtons(bool enabled)
 {
     if (buttonStep.InvokeRequired)
     {
         buttonDelegate d = new buttonDelegate(RunButtons);
         buttonStep.Invoke(d, new object[] { enabled });
     }
     else
     {
         if (enabled)
         {
             panelRunning.BackColor = Color.DarkGreen;
             panelStopped.BackColor = Color.Red;
             timer1.Stop();
         }
         else
         {
             panelRunning.BackColor = Color.LimeGreen;
             panelStopped.BackColor = Color.DarkRed;
             timer1.Enabled         = true;
             timer1.Start();
         }
         buttonStep.Enabled     = enabled;
         buttonStepOver.Enabled = enabled;
         buttonStepOut.Enabled  = enabled;
         buttonRun.Enabled      = enabled;
         buttonPause.Enabled    = !enabled;
     }
 }
Пример #2
0
        // This function is called by the long timer when the entire
        // measuring period is up.  It will stop the timers and
        // start another run if any are remaining.
        private void MeasureDone(object src, EventArgs e)
        {
            // change timer to be inactive
            //LongThreadTimer.Change(Timeout.Infinite, Timeout.Infinite);
            LongTimer.Enabled = false;
            SetPriority       = false;

            // stop appropriate timing method
            StopMeasuring();

            // if we have another run left, start again
            if (NumRuns > 0)
            {
                StartMeasuring();
            }
            else
            {
                // change system power state back if needed
                if (!NewState.Equals(OldState) && !NewState.Equals(""))
                {
                    bool success = SetSysPowerState(OldState);
                    if (!success)
                    {
                        // bad stuff
                    }
                    else
                    {
                        NewState = "";
                    }
                }

                // display number of measurements
                MessageBox.Show(MeasureCount.ToString());

                // since this method runs on a separate thread than the form
                // we need to use a delegate method to reset the button text to "Start"
                buttonDelegate d = new buttonDelegate(ResetButtonText);
                btnStartStop.Invoke(d);
            }
        }
Пример #3
0
        // This function is called by the long timer when the entire
        // measuring period is up.  It will stop the timers and
        // start another run if any are remaining.
        private void MeasureDone(object src, EventArgs e)
        {
            // change timer to be inactive
            //LongThreadTimer.Change(Timeout.Infinite, Timeout.Infinite);
            LongTimer.Enabled = false;
            SetPriority = false;

            // stop appropriate timing method
            StopMeasuring();

            // if we have another run left, start again
            if (NumRuns > 0)
            {
                StartMeasuring();
            }
            else
            {
                // change system power state back if needed
                if (!NewState.Equals(OldState) && !NewState.Equals(""))
                {
                    bool success = SetSysPowerState(OldState);
                    if (!success)
                    {
                        // bad stuff
                    }
                    else
                        NewState = "";

                }

                // display number of measurements
                MessageBox.Show(MeasureCount.ToString());

                // since this method runs on a separate thread than the form
                // we need to use a delegate method to reset the button text to "Start"
                buttonDelegate d = new buttonDelegate(ResetButtonText);
                btnStartStop.Invoke(d);
            }
        }
Пример #4
0
 // takes in function delegate and assigns them to appropriate buttons
 public void assignYButton(buttonDelegate yPress, buttonDelegate yRelease)
 {
     yButtonPress   = yPress;
     yButtonRelease = yRelease;
 }
Пример #5
0
 // takes in function delegate and assigns them to appropriate buttons
 public void assignXButton(buttonDelegate xPress, buttonDelegate xRelease)
 {
     xButtonPress   = xPress;
     xButtonRelease = xRelease;
 }
Пример #6
0
 // takes in function delegate and assigns them to appropriate buttons
 public void assignBButton(buttonDelegate bPress, buttonDelegate bRelease)
 {
     bButtonPress   = bPress;
     bButtonRelease = bRelease;
 }
Пример #7
0
 // takes in function delegate and assigns them to appropriate buttons
 public void assignAButton(buttonDelegate aPress, buttonDelegate aRelease)
 {
     aButtonPress   = aPress;
     aButtonRelease = aRelease;
 }