Example #1
0
        private static void OnUnitPropertyChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args)
        {
            var    control = (MovementControl)obj;
            double factor  = SpeedUtils.GetFactor((SpeedUnit)args.NewValue) / SpeedUtils.GetFactor((SpeedUnit)args.OldValue);

            control.ChangeUnits(factor);
        }
Example #2
0
        protected override void ChangeSpeed(double speed)
        {
            int factoredSpeed = (int)Math.Round(speed * SpeedUtils.GetFactor(Unit));

            Average = (Average * dataCount + factoredSpeed) / (dataCount + 1);
            Max     = Math.Max(Max, factoredSpeed);
            Current = factoredSpeed;

            dataCount++;
        }