45 lines
1.5 KiB
C#
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;
|
|
}
|
|
}
|
|
}
|