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

71 lines
1.9 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
{
/// <summary>
/// ShoreBaseStationControlView.xaml 的交互逻辑
/// </summary>
public partial class ShoreBaseStationControlView : UserControl
{
public ShoreBaseStationControlView()
{
InitializeComponent();
this.DataContext = MainViewModel.shoreBaseStationControlViewModel;
}
private void SetVoltageTB_PreviewTextInput(object sender, TextCompositionEventArgs e)
{
e.Handled = !IsTextValidForIntegerOrDecimal(e.Text);
}
private bool IsTextValidForIntegerOrDecimal(string text)
{
if (string.IsNullOrEmpty(text))
return false;
foreach (char c in text)
{
if (char.IsControl(c) || c == '.')
continue;
if (!char.IsDigit(c))
return false;
}
return true;
}
private void SetCurrentTB_PreviewTextInput(object sender, TextCompositionEventArgs e)
{
e.Handled = !IsTextValidForIntegerOrDecimal(e.Text);
}
private void ProVoltageTB_PreviewTextInput(object sender, TextCompositionEventArgs e)
{
e.Handled = !IsTextValidForIntegerOrDecimal(e.Text);
}
private void ProCurrentTB_PreviewTextInput(object sender, TextCompositionEventArgs e)
{
e.Handled = !IsTextValidForIntegerOrDecimal(e.Text);
}
}
}