using System.ComponentModel;
using System.Runtime.CompilerServices;
namespace Futonizer.Models;
///
/// Represents one currently-running strip job for display in the "active jobs" list,
/// since multiple files can be stripped concurrently.
///
public class JobProgressItem : INotifyPropertyChanged
{
private int _percent;
private double _megabytesPerSecond;
public string FileName { get; set; } = string.Empty;
///
/// Size of the source file in bytes, used as this job's weight when
/// computing overall cumulative progress across all queued files.
///
public long FileSizeBytes { get; set; }
public int Percent
{
get => _percent;
set
{
_percent = value;
OnPropertyChanged();
OnPropertyChanged(nameof(Display));
}
}
public double MegabytesPerSecond
{
get => _megabytesPerSecond;
set
{
_megabytesPerSecond = value;
OnPropertyChanged();
OnPropertyChanged(nameof(Display));
}
}
public string Display => $"{FileName} - {Percent}% - {MegabytesPerSecond:F1} MB/s";
public event PropertyChangedEventHandler? PropertyChanged;
private void OnPropertyChanged([CallerMemberName] string? name = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
}
}