private void btnStop_Click(object sender, RoutedEventArgs e) { if (Atimer != null) { Atimer.Cancel(); } if (Gtimer != null) { Gtimer.Cancel(); } if (Vtimer != null) { Vtimer.Cancel(); } if (Ctimer != null) { Ctimer.Cancel(); } if (Ftimer != null) { Ftimer.Cancel(); } if (Htimer != null) { Htimer.Cancel(); } combox.IsEnabled = true; combox2.IsEnabled = true; btnStart.IsEnabled = true; btnStop.IsEnabled = false; }
private void appBarButton_Click(object sender, RoutedEventArgs e) { if (this.Frame.CanGoBack) { if (Atimer != null) { Atimer.Cancel(); } if (Gtimer != null) { Gtimer.Cancel(); } if (Vtimer != null) { Vtimer.Cancel(); } if (Ctimer != null) { Ctimer.Cancel(); } if (Ftimer != null) { Ftimer.Cancel(); } if (Htimer != null) { Htimer.Cancel(); } this.Frame.GoBack(); } }
private void ReadingChanged(object sender, GyrometerReadingChangedEventArgs e) { TestCount++; GyrometerReading reading = e.Reading; string sMessage = ""; if (reading.AngularVelocityX > -311 && reading.AngularVelocityX < 575 && reading.AngularVelocityY > -621 && reading.AngularVelocityY < 615 && reading.AngularVelocityZ > -513 && reading.AngularVelocityZ < 494) { sMessage = ""; sMessage += "Round" + TestRound + "->" + TestCount + ":"; sMessage += string.Format(" Gyrometer X({0,5:0.00})", reading.AngularVelocityX); sMessage += string.Format(" Y({0,5:0.00})", reading.AngularVelocityY); sMessage += string.Format(" Z({0,5:0.00})", reading.AngularVelocityZ); sMessage += "\r\n"; Glog.WriteText(sMessage); } else { sMessage = ""; sMessage += "Round" + TestRound + "->" + TestCount + ":"; sMessage += "Gyrometer Failed."; sMessage += "\r\n"; Glog.WriteText(sMessage); } _gyrometer.ReportInterval = 0; _gyrometer.ReadingChanged -= ReadingChanged; if (TestCount >= TestMaxCount) { Gtimer.Cancel(); TestCount = 0; Atimer = ThreadPoolTimer.CreatePeriodicTimer(Accelerometer_Timer_Tick, TimeSpan.FromMilliseconds(2000)); } }