98 lines
2.4 KiB
C#
98 lines
2.4 KiB
C#
|
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
|
|||
|
{
|
|||
|
/// <summary>
|
|||
|
/// SunwayRobotView.xaml 的交互逻辑
|
|||
|
/// </summary>
|
|||
|
public partial class SunwayRobotView : UserControl
|
|||
|
{
|
|||
|
public SunwayRobotView()
|
|||
|
{
|
|||
|
InitializeComponent();
|
|||
|
this.DataContext = new SunwayRobotViewModel();
|
|||
|
|
|||
|
this.Loaded += OnViewLoaded;
|
|||
|
}
|
|||
|
|
|||
|
private void OnViewLoaded(object sender, RoutedEventArgs e)
|
|||
|
{
|
|||
|
(DataContext as TimerViewModelBase).Start();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
class SunwayRobotViewModel : SocketDeviceViewModel
|
|||
|
{
|
|||
|
public string Title => "Sunway 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 SunwayRobotViewModel() : base("SunwayRobotViewModel")
|
|||
|
{
|
|||
|
_robot = new SunwayRobotSimulator();
|
|||
|
Init(_robot);
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
}
|