progressbar tweaks
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
using System.ComponentModel;
|
||||
using PropertyChanged;
|
||||
|
||||
namespace ModpackUpdater.Apps.Manager.Ui.Models;
|
||||
|
||||
@@ -7,9 +6,43 @@ public class ProgressInfos : INotifyPropertyChanged
|
||||
{
|
||||
public event PropertyChangedEventHandler? PropertyChanged;
|
||||
|
||||
public bool Visible { get; set; }
|
||||
public bool IsVisible { get; set; }
|
||||
public bool IsGeneric { get; set; }
|
||||
public bool ShowText { get; set; }
|
||||
public double MaxValue { get; set; }
|
||||
public double Value { get; set; }
|
||||
[DependsOn(nameof(Value), nameof(MaxValue))]
|
||||
public string? Text => $"{Math.Round(Value / MaxValue * 100)}%";
|
||||
|
||||
public void Start(int maxValue)
|
||||
{
|
||||
IsGeneric = false;
|
||||
Value = 0;
|
||||
MaxValue = maxValue;
|
||||
ShowText = true;
|
||||
IsVisible = true;
|
||||
}
|
||||
|
||||
public void Start()
|
||||
{
|
||||
ShowText = false;
|
||||
IsGeneric = true;
|
||||
IsVisible = true;
|
||||
}
|
||||
|
||||
public void Set(int value)
|
||||
{
|
||||
if (!IsGeneric)
|
||||
Value = value;
|
||||
}
|
||||
|
||||
public void Increment()
|
||||
{
|
||||
if (!IsGeneric)
|
||||
Value += 1;
|
||||
}
|
||||
|
||||
public void End()
|
||||
{
|
||||
IsVisible = false;
|
||||
IsGeneric = false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user