Exemple #1
0
        public void UpdateSpeedLineValue(ulong value)
        {
            if ((value / 0.8) > currentMaximum)
            {
                currentMaximum  = (ulong)(value / 0.8);
                yAxis.Maximum   = currentMaximum;
                yAxis.MajorStep = currentMaximum / 5;
            }

            speedLine.Dispatcher.Invoke(() =>
            {
                speedLine.Text = string.Format("Speed: {0}/s", Helpers.BytesToXbytes(value));
                if (!firsCall)
                {
                    DoubleAnimation anim = new DoubleAnimation(value, TimeSpan.FromMilliseconds(AppSettings.Settings.EnableAnimations ? 500 : 0));
                    anim.SetCurrentValue(Timeline.DesiredFrameRateProperty, 30);
                    speedLine.BeginAnimation(OxyPlot.Wpf.LineAnnotation.YProperty, anim);
                }
                else
                {
                    firsCall    = false;
                    speedLine.Y = value;
                }
            });
        }