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.Security.Cryptography.X509Certificates;
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 PunkHPX8_Simulator.Views
{
    /// 
    /// BarcodeReaderView.xaml 的交互逻辑
    /// 
    public partial class BarcodeReaderView : UserControl
    {
        public BarcodeReaderView()
        {
            InitializeComponent();
            this.DataContext = new BarcodeReaderViewModel();
            
        }
        private void SerialPortTitleView_Loaded(object sender, RoutedEventArgs e)
        {
        }
        
        
    }
    class BarcodeReaderViewModel : SerialPortDeviceViewModel
    {
        public string Title
        {
            get { return "BarcodeReader controller simulator"; }
        }
        
        private string _barcode;
        [IgnorePropertyChange]
        /// 
        /// Barcode用于获取和设置条形码的值
        /// 
        public string Barcode
        {
            get
            {
                return _barcode;
            }
            set
            {
                _barcode = value;
                _sim.SetBarcode(_barcode);
            }
        }
        private BarcodeReaderSerialPortDevice _sim;
        public BarcodeReaderViewModel() : base("BarcodeReaderSimulator")
        {
            _sim = new BarcodeReaderSerialPortDevice();
            Init(_sim);
        }
    }
}