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; } }
// 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); } }
// 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); } }
// takes in function delegate and assigns them to appropriate buttons public void assignYButton(buttonDelegate yPress, buttonDelegate yRelease) { yButtonPress = yPress; yButtonRelease = yRelease; }
// takes in function delegate and assigns them to appropriate buttons public void assignXButton(buttonDelegate xPress, buttonDelegate xRelease) { xButtonPress = xPress; xButtonRelease = xRelease; }
// takes in function delegate and assigns them to appropriate buttons public void assignBButton(buttonDelegate bPress, buttonDelegate bRelease) { bButtonPress = bPress; bButtonRelease = bRelease; }
// takes in function delegate and assigns them to appropriate buttons public void assignAButton(buttonDelegate aPress, buttonDelegate aRelease) { aButtonPress = aPress; aButtonRelease = aRelease; }