using Aitex.Core.UI.MVVM;
using Aitex.Core.Utilities;
using CyberX8_Simulator.Devices;
using MECF.Framework.Simulator.Core.Commons;
using System.Collections.ObjectModel;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
namespace CyberX8_Simulator.Views
{
///
/// GalilView.xaml 的交互逻辑
///
public partial class GalilView : UserControl
{
public GalilView()
{
InitializeComponent();
this.Loaded += OnViewLoaded;
}
private void OnViewLoaded(object sender, RoutedEventArgs e)
{
(DataContext as TimerViewModelBase)?.Start();
}
}
class GalilViewModel : SocketDeviceViewModel
{
#region 属性
public string Title
{
get { return "Galil Simulator"; }
}
private string _inputsSelectedItem;
[IgnorePropertyChange]
public string InputsSelectedItem
{
get
{
return _inputsSelectedItem;
}
set
{
_inputsSelectedItem = value;
}
}
private int _inputValue;
[IgnorePropertyChange]
public int InputValue
{
get
{
return _inputValue;
}
set
{
_inputValue = value;
}
}
private int _inputCurrentValue;
[IgnorePropertyChange]
public int InputCurrentValue
{
get
{
return _inputCurrentValue;
}
set
{
_inputCurrentValue = value;
}
}
public ObservableCollection InputsNameItems { get; set; }
public ObservableCollection DigitalOutputSelected { get; set; }
#endregion
#region 内部变量
public ICommand SetInputsCommand { get; set; }
public ICommand InputsSelectionChangedCommand { get; set; }
private GalilSocketSimulator _sim;
#endregion
public GalilViewModel(string str) : base("GalilViewModel")
{
int.TryParse(str, out int port);
_sim = new GalilSocketSimulator(port);
Init(_sim);
InitData(port);
SetInputsCommand = new DelegateCommand