private string GetTimeRemaining() { if (DownloadSpeed.Content == null || string.IsNullOrEmpty(DownloadSize.Text)) { return(""); } var downloadSize = new DownloadSize(DownloadEstimator.DownloadSize.Type.GigaByte, double.Parse(DownloadSize.Text)); var downloadSpeed = new DownloadSpeed(DownloadEstimator.DownloadSpeed.Type.Mbps, double.Parse((string)DownloadSpeed.Content)); if (Math.Abs(downloadSpeed.BitsPerSecond) < .001) { return("00h:00m:00s"); } var timeRemaining = TimeSpan.FromSeconds(DownloadCalculations.GetTimeRemaining(downloadSpeed, downloadSize)); return ($"{timeRemaining.Hours:D2}h:{timeRemaining.Minutes:D2}m:{timeRemaining.Seconds:D2}s"); }
private string GetDownloadSpeed() { var downloadSpeed = DownloadCalculations.GetProcessDownloadSpeed(_readByteSec); return($"{downloadSpeed.Mbps:F2}"); }