using Ping9719.WpfEx;
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.Shapes;
using 智慧物流软件系统.ViewModel;
using 智慧物流软件系统.Views.Controls;

namespace 智慧物流软件系统
{
    /// <summary>
    /// InInventoryView.xaml 的交互逻辑
    /// </summary>
    public partial class InInventoryView : UserControlBase
    {
        public InInventoryViewModel viewModel = new InInventoryViewModel();
        public InInventoryView()
        {
            InitializeComponent();
            this.DataContext = viewModel;
            //初始化扫码枪
            var scanners = ScannerManager.Scanners.Select(t => t).ToList();
            scanners.ForEach(t =>
            {
                var control = new ScannerDisplayControl(t.COM);
                t.ScannerDisplayControl = control;
                scannersWrapPanel.Children.Add(control);
            });
        }
        private void DataGrid_SelectedCellsChanged(object sender, SelectedCellsChangedEventArgs e)
        {
            DataGrid datagrid = sender as DataGrid;
            datagrid.UnselectAllCells();
        }

        private void UserControlBase_Loaded(object sender, RoutedEventArgs e)
        {
        }

        private void Border_MouseUp(object sender, MouseButtonEventArgs e)
        {
        }

        private void UserControlBase_LoadedVisibleFirst(object sender, EventArgs e)
        {
            if (IsInDesignMode)
                return;
        }

        private void UserControlBase_LoadedVisible(object sender, EventArgs e)
        {
        }

        private void Button_PreviewKeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Space)
            {
                e.Handled = true; // 阻止空格键触发按钮点击事件  
            }
        }
    }
}
