progressbar tweaks

This commit is contained in:
2025-11-17 15:51:50 +01:00
parent ea8d1522f1
commit d68df750a6
6 changed files with 96 additions and 71 deletions

View File

@@ -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;
}
}