agrobot_base/AgroBase/OperationControl/ViewModels/Views/Operacao/OperacaoTopViewModel.cs

143 lines
4.3 KiB
C#

using System.ComponentModel;
using System.Windows.Media;
using Brush = System.Windows.Media.Brush;
using Brushes = System.Windows.Media.Brushes;
using Color = System.Windows.Media.Color;
using ColorConverter = System.Windows.Media.ColorConverter;
namespace OperationControl.ViewModels.Views.Operacao
{
public class OperacaoTopViewModel : INotifyPropertyChanged
{
private string _contextoSelecionado = "BASE";
public string ContextoSelecionado
{
get => _contextoSelecionado;
set
{
if (_contextoSelecionado != value)
{
_contextoSelecionado = value;
OnPropertyChanged(nameof(ContextoSelecionado));
}
}
}
private string _mensagemStatus = "Sistema inicializado.";
public string MensagemStatus
{
get => _mensagemStatus;
set
{
if (_mensagemStatus != value)
{
_mensagemStatus = value;
OnPropertyChanged(nameof(MensagemStatus));
}
}
}
private string _badgeTexto = "PRONTO";
public string BadgeTexto
{
get => _badgeTexto;
set
{
if (_badgeTexto != value)
{
_badgeTexto = value;
OnPropertyChanged(nameof(BadgeTexto));
}
}
}
private Brush _corFundo = Brushes.DimGray;
public Brush CorFundo
{
get => _corFundo;
set
{
if (_corFundo != value)
{
_corFundo = value;
OnPropertyChanged(nameof(CorFundo));
}
}
}
private Brush _corBadge = Brushes.SteelBlue;
public Brush CorBadge
{
get => _corBadge;
set
{
if (_corBadge != value)
{
_corBadge = value;
OnPropertyChanged(nameof(CorBadge));
}
}
}
private Brush _corTexto = Brushes.White;
public Brush CorTexto
{
get => _corTexto;
set
{
if (_corTexto != value)
{
_corTexto = value;
OnPropertyChanged(nameof(CorTexto));
}
}
}
public void DefinirStatusNormal(string contexto, string mensagem)
{
ContextoSelecionado = contexto;
MensagemStatus = mensagem;
BadgeTexto = "NORMAL";
CorFundo = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#1F3A2D"));
CorBadge = Brushes.LightGreen;
CorTexto = Brushes.White;
}
public void DefinirStatusManual(string contexto, string mensagem)
{
ContextoSelecionado = contexto;
MensagemStatus = mensagem;
BadgeTexto = "MANUAL";
CorFundo = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#2D3440"));
CorBadge = Brushes.Gold;
CorTexto = Brushes.White;
}
public void DefinirStatusAtencao(string contexto, string mensagem)
{
ContextoSelecionado = contexto;
MensagemStatus = mensagem;
BadgeTexto = "ATENÇÃO";
CorFundo = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#4A3315"));
CorBadge = Brushes.Orange;
CorTexto = Brushes.White;
}
public void DefinirStatusCritico(string contexto, string mensagem)
{
ContextoSelecionado = contexto;
MensagemStatus = mensagem;
BadgeTexto = "CRÍTICO";
CorFundo = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#4A1F1F"));
CorBadge = Brushes.OrangeRed;
CorTexto = Brushes.White;
}
public event PropertyChangedEventHandler? PropertyChanged;
private void OnPropertyChanged(string nome)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nome));
}
}
}