84 lines
2.1 KiB
C#
84 lines
2.1 KiB
C#
using Aurora.View;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Globalization;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows;
|
|
using System.Windows.Controls;
|
|
using System.Windows.Data;
|
|
using System.Windows.Documents;
|
|
using System.Windows.Input;
|
|
using System.Windows.Media;
|
|
using System.Windows.Media.Imaging;
|
|
using System.Windows.Navigation;
|
|
using System.Windows.Shapes;
|
|
|
|
namespace WeldingCommon.Views
|
|
{
|
|
public class BlinkBGConverter : IValueConverter
|
|
{
|
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
var model = value as BlinkModel;
|
|
if (model == null) {
|
|
return Brushes.Transparent;
|
|
}
|
|
|
|
if (!(bool)model.IsActivated) {
|
|
return Brushes.White;
|
|
}
|
|
|
|
return model.BlinkColor;
|
|
}
|
|
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
return null;
|
|
}
|
|
}
|
|
|
|
public class BlinkModel : NotifyPropertyChangedBase
|
|
{
|
|
private string position;
|
|
public string Position { get => position; set => SetProperty(ref position, value); }
|
|
private bool isRunning;
|
|
public bool IsRunning { get => isRunning; set => SetProperty(ref isRunning, value); }
|
|
|
|
private bool isActivated;
|
|
public bool IsActivated { get => isActivated; set => SetProperty(ref isActivated, value); }
|
|
|
|
public Brush BlinkColor { get; set; } = Brushes.DodgerBlue;
|
|
|
|
internal void SetRunning(bool isRunning)
|
|
{
|
|
if (isRunning) {
|
|
IsActivated = true;
|
|
IsRunning = true;
|
|
} else {
|
|
IsRunning = false;
|
|
}
|
|
}
|
|
|
|
internal void Init()
|
|
{
|
|
IsActivated = false;
|
|
IsRunning = false;
|
|
}
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// Interaction logic for UCBlinkText.xaml
|
|
/// </summary>
|
|
public partial class UCBlinkText : UserControl
|
|
{
|
|
public UCBlinkText()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
}
|
|
}
|