|
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
|
|
using SlnMesnac.Config;
|
|
|
using SlnMesnac.WPF.ViewModel;
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Linq;
|
|
|
using System.Text;
|
|
|
using System.Text.RegularExpressions;
|
|
|
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 SlnMesnac.WPF.Page
|
|
|
{
|
|
|
/// <summary>
|
|
|
/// BaseConfigInfoPage.xaml 的交互逻辑
|
|
|
/// </summary>
|
|
|
public partial class BaseConfigInfoPage : UserControl
|
|
|
{
|
|
|
private DebugConfig debugConfig = DebugConfig.Instance;
|
|
|
private BaseConfigInfoViewModel ViewModel;
|
|
|
public BaseConfigInfoPage()
|
|
|
{
|
|
|
InitializeComponent();
|
|
|
ViewModel = new BaseConfigInfoViewModel();
|
|
|
this.DataContext = ViewModel;
|
|
|
}
|
|
|
|
|
|
private void SaveButton_Click(object sender, RoutedEventArgs e)
|
|
|
{
|
|
|
string configKey = ConfigKey.Text;
|
|
|
string configName = ConfigName.Text;
|
|
|
string configValue = ConfigValue.Text;
|
|
|
string configFlag = ConfigFlag.Text;
|
|
|
// 调用 ViewModel 中的方法并传递参数
|
|
|
ViewModel.Save(configKey, configName, configValue, configFlag);
|
|
|
}
|
|
|
|
|
|
private void EditButton_Click(object sender, RoutedEventArgs e)
|
|
|
{
|
|
|
var result = MessageBox.Show("确认修改吗","确认框", MessageBoxButton.YesNo, MessageBoxImage.Question);
|
|
|
|
|
|
if (result == MessageBoxResult.Yes)
|
|
|
{
|
|
|
string configId = ConfigId.Text;
|
|
|
string configKey = ConfigKey.Text;
|
|
|
string configName = ConfigName.Text;
|
|
|
string configValue = ConfigValue.Text;
|
|
|
string configFlag = ConfigFlag.Text;
|
|
|
// 调用 ViewModel 中的方法并传递参数
|
|
|
ViewModel.Edit(configId, configKey, configName, configValue, configFlag);
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
private void InputRFIDButton_Click(object sender, RoutedEventArgs e)
|
|
|
{
|
|
|
string RFID = Microsoft.VisualBasic.Interaction.InputBox("请输入小包出口RFID:", "人工处理", "", -1, -1);
|
|
|
// 定义正则表达式模式
|
|
|
string pattern = @"^JYHB\d{8}$";
|
|
|
|
|
|
// 创建正则表达式对象
|
|
|
Regex regex = new Regex(pattern);
|
|
|
|
|
|
// 校验输入字符串是否符合模式
|
|
|
if (regex.IsMatch(RFID))
|
|
|
{
|
|
|
debugConfig.MdjOutRFID = RFID;
|
|
|
MessageBox.Show("保存成功");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
MessageBox.Show($"输入的RFID:{RFID}无效,JYHB开头后接8位数字!");
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}
|