コード例 #1
0
 /// <summary>
 /// Calculates a value while ensuring ResultFps and ResultTimeLeft remain valid.
 /// </summary>
 protected void CalcValidate(ITimeLeftCalculator calc, long frame, int seconds)
 {
     environment.ChangeTime(seconds);
     calc.Calculate(frame);
     Assert.True(calc.ResultFps >= 0);
     Assert.True(calc.ResultTimeLeft >= TimeSpan.Zero);
 }
コード例 #2
0
ファイル: FFmpegWindow.xaml.cs プロジェクト: sk8tz/FFmpeg.NET
        private void FFmpeg_StatusUpdated(object sender, FFmpeg.StatusUpdatedEventArgs e)
        {
            Dispatcher.Invoke(() => {
                WorkProgressBar.Value = e.Status.Frame + ResumePos;
                PercentText.Text      = (WorkProgressBar.Value / WorkProgressBar.Maximum).ToString("p1");
                SetPageTitle(PercentText.Text);
                FpsText.Text = e.Status.Fps.ToString();

                // Time left will be updated only 1 out of 2 to prevent changing too quick.
                EstimatedTimeLeftToggle = !EstimatedTimeLeftToggle;
                if (EstimatedTimeLeftToggle)
                {
                    timeCalc?.Calculate(e.Status.Frame + ResumePos);
                    TimeSpan TimeLeft = timeCalc.ResultTimeLeft;
                    if (TimeLeft > TimeSpan.Zero)
                    {
                        TimeLeftText.Text = TimeLeft.ToString(TimeLeft.TotalHours < 1 ? "m\\:ss" : "h\\:mm\\:ss");
                    }
                }
            });
        }