コード例 #1
0
        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;
        }
コード例 #2
0
        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();
            }
        }
コード例 #3
0
        private void ReadingChangedforVibrator(object sender, AccelerometerReadingChangedEventArgs e)
        {
            AccelerometerReading reading = e.Reading;

            string sMessage = "";


            if (Math.Abs(reading.AccelerationX - 0.09) > 0.07 || Math.Abs(reading.AccelerationY - 0.01) > 0.05 || Math.Abs(Math.Abs(reading.AccelerationZ) - 0.96) > 0.4)
            {
                sMessage  = "";
                sMessage += "Round" + TestRound + "->" + TestCount + ":VibrationDevice Success.";
                sMessage += "\r\n";
                Vlog.WriteText(sMessage);
            }
            else
            {
                sMessage  = "";
                sMessage += "Round" + TestRound + "->" + TestCount + ":VibrationDevice Failed.";
                sMessage += "\r\n";
                Vlog.WriteText(sMessage);
            }


            _accelerometer.ReportInterval  = 0;
            _accelerometer.ReadingChanged -= new Windows.Foundation.TypedEventHandler <Windows.Devices.Sensors.Accelerometer, AccelerometerReadingChangedEventArgs>(ReadingChangedforVibrator);



            if (TestCount >= TestMaxCount)
            {
                Vtimer.Cancel();
                TestCount = 0;
                Gtimer    = ThreadPoolTimer.CreatePeriodicTimer(Gyrometer_Timer_Tick, TimeSpan.FromMilliseconds(2000));
            }
        }