agrobot_base/AgroBase/OperationControl/ViewModels/Views/Operacao/Monitoramento/ResumoViewModel.cs

40 lines
1.1 KiB
C#
Raw Normal View History

using OperationControl.Models.Operacao;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OperationControl.ViewModels.Views.Operacao.Monitoramento
{
public class ResumoViewModel : INotifyPropertyChanged
{
public ResumoOperacionalModel Resumo { get; } = new ResumoOperacionalModel();
public ResumoViewModel()
{
}
public void AtualizarResumo(Action<ResumoOperacionalModel> updateAction)
{
if (!System.Windows.Application.Current.Dispatcher.CheckAccess())
{
System.Windows.Application.Current.Dispatcher.BeginInvoke(new Action(() => updateAction?.Invoke(Resumo)));
return;
}
updateAction?.Invoke(Resumo);
}
public event PropertyChangedEventHandler PropertyChanged;
private void OnPropertyChanged(string nome)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nome));
}
}
}