git_bsmd/ENI2/Controls/BusyControl.xaml.cs
2023-02-05 11:14:07 +01:00

45 lines
1.5 KiB
C#

// Copyright (c) 2023- schick Informatik
//
// Description: Idea to have a simple control that shows if the application is busy or not using a simple icon
// that will be set according to a state
//
using ENI2.Util;
using System.Windows.Controls;
namespace ENI2.Controls
{
/// <summary>
/// Interaction logic for BusyControl.xaml
/// </summary>
public partial class BusyControl : UserControl
{
UIHelper.BusyStateEnum _busyState = UIHelper.BusyStateEnum.NEUTRAL;
public BusyControl()
{
InitializeComponent();
}
public UIHelper.BusyStateEnum BusyState
{
set
{
_busyState = value;
//Dispatcher.Invoke(() =>
//{
switch (_busyState)
{
case UIHelper.BusyStateEnum.NEUTRAL: imageBall.Source = Properties.Resources.bullet_ball_grey.CreateBitmapSource(); break;
case UIHelper.BusyStateEnum.BUSY: imageBall.Source = Properties.Resources.bullet_ball_yellow.CreateBitmapSource(); break;
case UIHelper.BusyStateEnum.FAIL: imageBall.Source = Properties.Resources.bullet_ball_red.CreateBitmapSource(); break;
case UIHelper.BusyStateEnum.SUCCESS: imageBall.Source = Properties.Resources.bullet_ball_green.CreateBitmapSource(); break;
}
//});
}
get => _busyState;
}
}
}