示例#1
0
        public void ChangeValues(Message message)
        {
            if (message == null)
            {
                return;
            }

            //Allow other threads to work on the UI thread.
            Application.Current.Dispatcher.Invoke(new Action(() =>
            {
                switch (message)
                {
                case GeneralDataMessage generalMessage:
                    lblSpeed.Content = string.Format("Snelheid: {0} km/u", bikeSession.Speed.ToString());
                    Speed.Add(bikeSession.Speed);
                    speedcycle = (int)bikeSession.Speed;
                    RPM.Add(bikeSession.CycleRPM);
                    spin = (int)bikeSession.CycleRPM;
                    lblDistance.Content = string.Format("Afstand afgelegd: {0} meter", bikeSession.GetMetersTravelled().ToString());
                    lblRPM.Content      = string.Format("RPM: {0}", bikeSession.CycleRPM);

                    ChartSpeedValues.Add(new ObservableValue(bikeSession.GetSpeed()));
                    ChartRPM.Add(new ObservableValue(bikeSession.CycleRPM));

                    /*    if (ChartSpeedValues.Count == 30)
                     *  {
                     *      ChartSpeedValues.RemoveAt(0);
                     *  }
                     *  else if(ChartRPM.Count == 30)
                     *  {
                     *      ChartRPM.RemoveAt(0);
                     *  }*/
                    break;

                case StationaryDataMessage stationaryMessage:
                    lblVoltage.Content = string.Format("Voltage: {0} Watt", bikeSession.Voltage.ToString());
                    this.voltage       = bikeSession.Voltage;
                    break;

                case HearthDataMessage hearthDataMessage:
                    lblHearthRate.Content = string.Format("Hartslag {0} bpm", bikeSession.GetHearthBeats().ToString());
                    BPM.Add(bikeSession.GetHearthBeats());
                    HeartRate = bikeSession.GetHearthBeats();
                    ChartBeat.Add(new ObservableValue(bikeSession.GetHearthBeats()));

                    /* if(ChartBeat.Count == 30)
                     * {
                     *   ChartBeat.RemoveAt(0);
                     * }*/
                    break;
                }
            }));
        }
示例#2
0
        public void ShouldAdd()
        {
            //arrange
            ISpeed expectedSpeed = new Speed(22);
            ISpeed firstSpeed    = new Speed(10);
            ISpeed secondSpeed   = new Speed(12);

            //act
            ISpeed actualSpeed = firstSpeed.Add(secondSpeed);

            //assert
            actualSpeed.Should().Be(expectedSpeed);
        }