Пример #1
0
        private async void FinishGatePin_ValueChanged(GpioPin sender, GpioPinValueChangedEventArgs args)
        {
            System.Diagnostics.Debug.WriteLine("Track " + this.TrackNumber + " Value: " + args.Edge);
            if (args.Edge == GpioPinEdge.RisingEdge)
            {
                return;
            }

            if (!ViewModels.MainViewModel.Instance.InRace)
            {
                return;
            }

            if (this.HasFinished)
            {
                return;
            }

            this.HasFinished = true;

            await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                this.TrackTime            = ((decimal)HeatStopWatch.ElapsedMilliseconds) / 1000M;
                TrackCompletedEventArgs e = new TrackCompletedEventArgs();
                e.ElapsedTime             = TrackTime;
                e.TrackNo = this.TrackNumber;
                OnTrackCompleted(e);
            });
        }
Пример #2
0
        protected virtual void OnTrackCompleted(TrackCompletedEventArgs e)
        {
            EventHandler <TrackCompletedEventArgs> handler = TrackCompleted;

            if (handler != null)
            {
                handler(this, e);
            }
        }