vpr/ShadowStream/Views/ProgressBar.cs
2025-06-17 12:42:39 +01:00

35 lines
858 B
C#

using System.Windows;
namespace ModuleManager;
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
//Quinn and Reda and Yazan
public partial class ProgressBar : Window
{ //quinn
private int currentValue = 0;
public ProgressBar(string title,int maxValue)
{
InitializeComponent();
lab.Content = title;
Bar.Maximum = maxValue;
Bar.Minimum = 0;
}
//Quinn
public void UpdateProgress(int value)
{
//force update and enshure ui thread updates
Dispatcher.Invoke(() =>
{
currentValue += value;
if (currentValue > Bar.Maximum)
currentValue = (int)Bar.Maximum;
Bar.Value = currentValue;
Bar.Dispatcher.Invoke(() => { }, System.Windows.Threading.DispatcherPriority.Render);
});
}
}