123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120 |
- 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.Light
- {
-
- public partial class SimLightPdcView : UserControl
- {
- //public static readonly DependencyProperty PortProperty = DependencyProperty.Register(
- // "Port", typeof(string), typeof(SimHipaceTurboPumpView),
- // new FrameworkPropertyMetadata("COM11", FrameworkPropertyMetadataOptions.AffectsRender));
- //public string Port
- //{
- // get { return (string) this.GetValue(PortProperty); }
- // set { this.SetValue(PortProperty, value); }
- //}
- public SimLightPdcView()
- {
- InitializeComponent();
- DataContext = new SimLightPdcViewModel("COM24");
- (DataContext as TimerViewModelBase).Start();
- this.Loaded += OnViewLoaded;
- }
- private void OnViewLoaded(object sender, RoutedEventArgs e)
- {
- if (DataContext == null)
- {
- }
- }
- }
- class SimLightPdcViewModel : SerialPortDeviceViewModel
- {
- public string Title
- {
- get { return "PDC Light Simulator"; }
- }
- private SimLightPdc _reader;
-
- public bool IsFailed
- {
- get
- {
- return _reader.Failed;
- }
- set
- {
- _reader.Failed = value;
- }
- }
- public bool IsPumpOn
- {
- get
- {
- return _reader.IsPumpOn;
- }
- set
- {
- _reader.IsPumpOn = value;
- }
- }
- public bool IsOverTemp
- {
- get
- {
- return _reader.IsOverTemp;
- }
- set
- {
- _reader.IsOverTemp = value;
- }
- }
- public bool IsAtSpeed
- {
- get
- {
- return _reader.IsAtSpeed;
- }
- set
- {
- _reader.IsAtSpeed = value;
- }
- }
- //private string _value;
- [IgnorePropertyChange]
- public string ResultValue
- {
- get
- {
- return _reader.ResultValue;
- }
- set
- {
- _reader.ResultValue = value;
- }
- }
-
- public SimLightPdcViewModel(string port) : base("SimLightPdcViewModel")
- {
- _reader = new SimLightPdc(port);
- Init(_reader, false);
- }
- }
- }
|