10-01-2007 04:09 AM
{
timer1.Enabled =
true; // timer runs on 100ms interval if( !InterlockFlag ) // Don't run InterlockButtons if flag is falseInterlockButtons();
//}
private void InterlockButtons(){
InterlockFlag =
true; // Set main flag to inhibit further calling of this functionInInterlockFlag =
true; // This flag stops the timer affecting things while the function is runningNowSwitch = switchArray1.GetValues();
// Get the current settings of the switcharray for (int i = 0; i < NowSwitch.Length; i++) // Exclusively OR current status with last known settings{
CompareArray[i] = NowSwitch[i] ^ LastSwitch[i];
}
switchArray1.SetValues(CompareArray);
// Set new state for switcharrayLastSwitch = CompareArray;
// Store current state for next time roundInInterlockFlag =
false; // Flag shows we are out of the function}
private void timer1_Tick(object sender, EventArgs e){
// Stop the timer and reset the flag, ready for the next button change. if(( InInterlockFlag == false ) & ( InterlockFlag == true)){
timer1.Enabled = false;
InterlockFlag=
false; }}
10-03-2007 07:51 AM
10-03-2007 08:19 AM
10-04-2007 03:48 AM