using System.Collections.Generic;
using System.Windows.Controls;
using Aitex.Core.RT.DataCenter;
using Aitex.Core.UI.MVVM;
using Aitex.Core.Util;
namespace VirgoRT.Backends
{
///
/// Interaction logic for FSM.xaml
///
public partial class FSMView : UserControl
{
public FSMView()
{
InitializeComponent();
this.DataContext = new FsmViewModel();
this.IsVisibleChanged += FSM_IsVisibleChanged;
}
private void FSM_IsVisibleChanged(object sender, System.Windows.DependencyPropertyChangedEventArgs e)
{
if (this.DataContext is FsmViewModel vm)
{
vm.EnableTimer(this.IsVisible);
}
}
}
public class FsmViewModel : SubscriptionViewModelBase
{
[Subscription("EFEM.FsmPrevState")]
public string EFEMPrevState { get; set; }
[Subscription("EFEM.FsmState")]
public string EFEMState { get; set; }
[Subscription("EFEM.FsmLastMessage")]
public string EFEMLastMsg { get; set; }
//LP1
[Subscription("LP1.FsmPrevState")]
public string LP1PrevState { get; set; }
[Subscription("LP1.FsmState")]
public string LP1State { get; set; }
[Subscription("LP1.FsmLastMessage")]
public string LP1LastMsg { get; set; }
//LP1
[Subscription("LP2.FsmPrevState")]
public string LP2PrevState { get; set; }
[Subscription("LP2.FsmState")]
public string LP2State { get; set; }
[Subscription("LP2.FsmLastMessage")]
public string LP2LastMsg { get; set; }
// PMA
[Subscription("PMA.FsmPrevState")]
public string PMAPrevState { get; set; }
[Subscription("PMA.FsmState")]
public string PMAState { get; set; }
[Subscription("PMA.FsmLastMessage")]
public string PMALastMsg { get; set; }
// PMB
[Subscription("PMB.FsmPrevState")]
public string PMBPrevState { get; set; }
[Subscription("PMB.FsmState")]
public string PMBState { get; set; }
[Subscription("PMB.FsmLastMessage")]
public string PMBLastMsg { get; set; }
// Constructor
//
public FsmViewModel() : base(nameof(FsmViewModel))
{
PollDataFunction = PerformPollDataFunction;
}
private Dictionary PerformPollDataFunction(IEnumerable arg)
{
return DATA.PollData(arg);
}
}
}