150 lines
2.9 KiB
C#
150 lines
2.9 KiB
C#
|
|
using MaterialDesignThemes.Wpf;
|
|||
|
|
using SamplePre.Common;
|
|||
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.ComponentModel;
|
|||
|
|
using System.Linq;
|
|||
|
|
using System.Runtime.CompilerServices;
|
|||
|
|
using System.Text;
|
|||
|
|
using System.Threading.Tasks;
|
|||
|
|
using System.Windows.Media;
|
|||
|
|
|
|||
|
|
namespace SamplePreSystem.UI.ViewModel.Monitor
|
|||
|
|
{
|
|||
|
|
public class WorkUnit : INotifyPropertyChanged
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
private int _state;
|
|||
|
|
|
|||
|
|
public int state
|
|||
|
|
{
|
|||
|
|
get { return _state; }
|
|||
|
|
set { _state = value;
|
|||
|
|
OnPropertyChanged();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private string _stateName;
|
|||
|
|
|
|||
|
|
public string StateName
|
|||
|
|
{
|
|||
|
|
get { return _stateName; }
|
|||
|
|
set { _stateName = value;
|
|||
|
|
|
|||
|
|
OnPropertyChanged();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
private string _actionName;
|
|||
|
|
|
|||
|
|
public string actionName
|
|||
|
|
{
|
|||
|
|
get { return _actionName; }
|
|||
|
|
set { _actionName = value;
|
|||
|
|
OnPropertyChanged();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
private string _unitName;
|
|||
|
|
|
|||
|
|
public string unitName
|
|||
|
|
{
|
|||
|
|
get { return _unitName; }
|
|||
|
|
set { _unitName = value;
|
|||
|
|
OnPropertyChanged();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
private string _unitCode;
|
|||
|
|
|
|||
|
|
public string unitCode
|
|||
|
|
{
|
|||
|
|
get { return _unitCode; }
|
|||
|
|
set { _unitCode = value;
|
|||
|
|
|
|||
|
|
OnPropertyChanged();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
public string imgPath { get; set; }
|
|||
|
|
|
|||
|
|
public PackIconKind packIconKind { get; set; }
|
|||
|
|
|
|||
|
|
private Brush runColor = Brushes.Orange ;
|
|||
|
|
|
|||
|
|
public Brush RunColor
|
|||
|
|
{
|
|||
|
|
get { return runColor; }
|
|||
|
|
set { runColor = value;
|
|||
|
|
|
|||
|
|
OnPropertyChanged();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
public event PropertyChangedEventHandler PropertyChanged;
|
|||
|
|
protected void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
|||
|
|
{
|
|||
|
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 获取运行状态的颜色
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="state"></param>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
public static Brush GetStateColor(int state)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
if (state == 0)
|
|||
|
|
{
|
|||
|
|
return Brushes.Red;
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
if (state == 1)
|
|||
|
|
{
|
|||
|
|
return Brushes.Orange;
|
|||
|
|
}
|
|||
|
|
else if (state == 2)
|
|||
|
|
{
|
|||
|
|
return Brushes.LightGreen;
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
else if (state == 3)
|
|||
|
|
{
|
|||
|
|
return Brushes.Green;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
return Brushes.Orange;
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
LoggerHelper.Logger.Error(ex.Message + ex.StackTrace);
|
|||
|
|
return Brushes.Orange;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|