mirror of
https://github.com/sp-tarkov/patcher.git
synced 2025-02-13 08:30:47 -05:00
50 lines
1.3 KiB
C#
50 lines
1.3 KiB
C#
using System.Windows;
|
|
using System.Windows.Controls;
|
|
using System.Windows.Shell;
|
|
|
|
namespace PatchClient.Extensions
|
|
{
|
|
public static class ControlExtensions
|
|
{
|
|
public static void DispatcherSetValue(this ProgressBar pb, int Value)
|
|
{
|
|
Application.Current.Dispatcher.Invoke(() =>
|
|
{
|
|
pb.Value = Value;
|
|
});
|
|
}
|
|
|
|
public static void DispatcherSetIndetermination(this ProgressBar pb, bool Indeterminate)
|
|
{
|
|
Application.Current.Dispatcher.Invoke(() =>
|
|
{
|
|
pb.IsIndeterminate = Indeterminate;
|
|
});
|
|
}
|
|
|
|
public static void DispaatcherSetContent(this ContentControl cc, object content)
|
|
{
|
|
Application.Current.Dispatcher.Invoke(() =>
|
|
{
|
|
cc.Content = content;
|
|
});
|
|
}
|
|
|
|
public static void DispatcherSetText(this TextBlock tb, string Text)
|
|
{
|
|
Application.Current.Dispatcher.Invoke(() =>
|
|
{
|
|
tb.Text = Text;
|
|
});
|
|
}
|
|
|
|
public static void DispatcherSetEnabled(this UIElement uie, bool Enabled)
|
|
{
|
|
Application.Current.Dispatcher.Invoke(() =>
|
|
{
|
|
uie.IsEnabled = Enabled;
|
|
});
|
|
}
|
|
}
|
|
}
|