示例#1
0
        private async void MainPage_uxUpdate(uxUpdateEventArgs args)
        {
            await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.High,
                                      () =>
            {
                var uxBinding = GPIOPinToUxBindingDictionary[args.PinNumber];
                var pin       = uxBinding.GpioPin;
                var uxElement = uxBinding.UxObject as Ellipse;

                var pinValue   = uxBinding.GpioPin.Read();
                uxElement.Fill = (pinValue == GpioPinValue.High) ? redBrush : grayBrush;

                _BestTimeLane1.Text = Globals.theRaceController.BestTimeLane1;
                _BestTimeLane2.Text = Globals.theRaceController.BestTimeLane2;

                for (int i = 0; i < RaceController.NumberOfLaps; i++)
                {
                    TextBlock lane1Lap = _Lane1Laps.Children[i] as TextBlock;
                    TextBlock lane2Lap = _Lane2Laps.Children[i] as TextBlock;

                    lane1Lap.Text = Globals.theRaceController.LapTime(Player.Lane1, i);
                    lane2Lap.Text = Globals.theRaceController.LapTime(Player.Lane2, i);
                }

                _BestLapOfTheDay.Text = Globals.theRaceController.BestTimeAsString;
            });
        }
示例#2
0
 public static void OnuxUpdate(int pinNumber, GpioPinValue pinValue)
 {
     if (uxUpdate != null)
     {
         uxUpdateEventArgs args = new uxUpdateEventArgs(pinNumber, pinValue);
         uxUpdate(args);
     }
 }