70 lines
2.1 KiB
C#
70 lines
2.1 KiB
C#
|
|
using FujianEarthquake.ViewModels;
|
|||
|
|
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.Navigation;
|
|||
|
|
using System.Windows.Shapes;
|
|||
|
|
|
|||
|
|
namespace FujianEarthquake.Views.UserControls
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// ParaSettingView.xaml 的交互逻辑
|
|||
|
|
/// </summary>
|
|||
|
|
public partial class ParaSettingView : UserControl
|
|||
|
|
{
|
|||
|
|
public ParaSettingView()
|
|||
|
|
{
|
|||
|
|
InitializeComponent();
|
|||
|
|
|
|||
|
|
this.DataContext = MainViewModel.shoreBaseStationStatusDataViewModel;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void SetVoltageTB_PreviewTextInput(object sender, TextCompositionEventArgs e)
|
|||
|
|
{
|
|||
|
|
foreach (char c in e.Text)
|
|||
|
|
{
|
|||
|
|
// 判断是否为中文字符
|
|||
|
|
if (Char.IsControl(c) || Char.IsWhiteSpace(c))
|
|||
|
|
{
|
|||
|
|
// 允许输入控制字符和空白字符
|
|||
|
|
continue;
|
|||
|
|
}
|
|||
|
|
else if (c >= 0x4e00 && c <= 0x9fff)
|
|||
|
|
{
|
|||
|
|
// 中文字符范围,参考Unicode编码
|
|||
|
|
e.Handled = true; // 标记事件已处理,不再传播
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void SetCurrentTB_PreviewTextInput(object sender, TextCompositionEventArgs e)
|
|||
|
|
{
|
|||
|
|
foreach (char c in e.Text)
|
|||
|
|
{
|
|||
|
|
// 判断是否为中文字符
|
|||
|
|
if (Char.IsControl(c) || Char.IsWhiteSpace(c))
|
|||
|
|
{
|
|||
|
|
// 允许输入控制字符和空白字符
|
|||
|
|
continue;
|
|||
|
|
}
|
|||
|
|
else if (c >= 0x4e00 && c <= 0x9fff)
|
|||
|
|
{
|
|||
|
|
// 中文字符范围,参考Unicode编码
|
|||
|
|
e.Handled = true; // 标记事件已处理,不再传播
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|