using HandyControl.Controls; using HandyControl.Tools.Extension; using SqlSugar; using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using System.Threading; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Input; using WCS.BLL.DbModels; using WCS.Model; using WCS.Model.ApiModel.MatBaseInfo; using 货架标准上位机.Api; using 货架标准上位机.Tool; using 货架标准上位机.ViewModel; using 货架标准上位机.Views.Controls; namespace 货架标准上位机 { public partial class MatBaseInoScanGenarateMatInfoView : System.Windows.Window { public MatBaseInoScanGenarateMatInfoViewModel viewModel = new MatBaseInoScanGenarateMatInfoViewModel(); public MatBaseInoScanGenarateMatInfoView() { InitializeComponent(); this.DataContext = viewModel; viewModel.ChangelessCode = LocalFile.Config.ChangelessCode; viewModel.ReservedCode = LocalFile.Config.ReservedCode; this.Topmost = true; this.WindowStartupLocation = WindowStartupLocation.CenterScreen; } private void btnOk_Click(object sender, RoutedEventArgs e) { var button = sender as Button; this.DialogResult = true; this.Close(); } private void closeClick(object sender, RoutedEventArgs e) { this.DialogResult = false; this.Close(); } private void txtMatBatch_PreviewTextInput(object sender, System.Windows.Input.TextCompositionEventArgs e) { e.Handled = !IsInputNumberAllowed(e.Text); } private bool IsInputNumberAllowed(string text) { Regex regex = new Regex("^[0-9]+$"); // 只允许数字 return regex.IsMatch(text); } private void TextBox_PreviewKeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Enter) { txtMatQty.Focus(); Thread.Sleep(1); txtTotalCount.Focus(); } } } }