Sic.Framework/SimulatorCore/Robots/TrayRobot/TrayRobotView.xaml.cs

86 lines
2.0 KiB
C#

using System.Windows;
using System.Windows.Controls;
using Aitex.Core.UI.MVVM;
using Aitex.Core.Utilities;
using MECF.Framework.Simulator.Core.Commons;
namespace MECF.Framework.Simulator.Core.Robots
{
/// <summary>
/// HwinRobotView.xaml 的交互逻辑
/// </summary>
public partial class TrayRobotView : UserControl
{
public TrayRobotView()
{
InitializeComponent();
this.DataContext = new TrayRobotViewModel();
this.Loaded += OnViewLoaded;
}
private void OnViewLoaded(object sender, RoutedEventArgs e)
{
(DataContext as TimerViewModelBase).Start();
}
}
class TrayRobotViewModel : SocketDeviceViewModel
{
public string Title
{
get { return "Tray Robot Simulator"; }
}
private TrayRobotSimulator _robot;
public bool IsError
{
get => _robot.IsError;
set => _robot.IsError = value;
}
public bool StateChecked
{
get => _robot.StateChecked;
set => _robot.StateChecked = value;
}
//private string _value;
[IgnorePropertyChange]
public string ErrorCode
{
get => _robot.ErrorCode;
set => _robot.ErrorCode = value;
}
public bool EventChecked
{
get => _robot.EventChecked;
set
{
_robot.EventChecked = value;
if (value) EventCode = "_EVENT ROBOR 02610 0003 B -00028 000028 000028 -00002\r";
else EventCode = null;
}
}
[IgnorePropertyChange]
public string EventCode
{
get => _robot.EventCode;
set => _robot.EventCode = value;
}
public TrayRobotViewModel() : base("TrayRobotViewModel")
{
_robot = new TrayRobotSimulator();
Init(_robot);
}
}
}