Browse Source

Add int ProgressReport overload

pull/5/head
Ionite 1 year ago
parent
commit
083234b767
No known key found for this signature in database
  1. 13
      StabilityMatrix/Models/ProgressReport.cs

13
StabilityMatrix/Models/ProgressReport.cs

@ -42,6 +42,19 @@ public record struct ProgressReport
Type = type;
}
public ProgressReport(int current, int total, string? title = null, string? message = null, bool isIndeterminate = false, ProgressType type = ProgressType.Generic)
{
if (current < 0) throw new ArgumentOutOfRangeException(nameof(current), "Current progress cannot negative.");
if (total < 0) throw new ArgumentOutOfRangeException(nameof(total), "Total progress cannot be negative.");
Current = (ulong) current;
Total = (ulong) total;
Progress = (double) current / total;
Title = title;
Message = message;
IsIndeterminate = isIndeterminate;
Type = type;
}
public ProgressReport(ulong current, string? title = null, string? message = null, ProgressType type = ProgressType.Generic)
{
Current = current;

Loading…
Cancel
Save