using Aitex.Core.UI.MVVM; using Aitex.Core.Utilities; using MECF.Framework.Simulator.Core.Commons; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; namespace MECF.Framework.Simulator.Core.Robots.Sunway { /// /// SunwayTrayRobotView.xaml 的交互逻辑 /// public partial class SunwayTrayRobotView : UserControl { public SunwayTrayRobotView() { InitializeComponent(); this.DataContext = new SunwayTrayRobotViewModel(); this.Loaded += OnViewLoaded; } private void OnViewLoaded(object sender, RoutedEventArgs e) { (DataContext as TimerViewModelBase).Start(); } } class SunwayTrayRobotViewModel : SocketDeviceViewModel { public string Title => "Sunway Tray Robot Simulator"; private SunwayRobotSimulator _robot; public bool IsError { get => _robot.IsError; set => _robot.IsError = value; } //private string _value; [IgnorePropertyChange] public string ErrorCode { get => _robot.ErrorCode; set => _robot.ErrorCode = value; } public bool StateChecked { get => _robot.StateChecked; set => _robot.StateChecked = value; } public int StateCode { get => _robot.StateCode; set => _robot.StateCode = 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 SunwayTrayRobotViewModel() : base("SunwayRobotViewModel") { _robot = new SunwayRobotSimulator(1104); Init(_robot); } } }