20240801_FJEQ_upperpc/FujianEarthquake_seabed_now/FujianEarthquake/Views/UserControls/ProSettingView.xaml.cs
XuMin 78cfbd3709 1 增加岸基站通信数据解析代码;
2 增加岸基站通信数据发送代码;
3 对岸基站通信数据收发代码进行测试,并解决出现的问题;
2024-09-30 14:06:43 +08:00

70 lines
2.1 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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>
/// ProSettingView.xaml 的交互逻辑
/// </summary>
public partial class ProSettingView : UserControl
{
public ProSettingView()
{
InitializeComponent();
this.DataContext = MainViewModel.shoreBaseStationStatusDataViewModel;
}
private void ProVoltageTB_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 ProCurrentTB_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;
}
}
}
}
}