50 lines
1.4 KiB
C#
50 lines
1.4 KiB
C#
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 RookieStation
|
|
{
|
|
/// <summary>
|
|
/// WpfLampsLayout.xaml 的交互逻辑
|
|
/// </summary>
|
|
public partial class WpfLampsLayout
|
|
{
|
|
public double LeftRightDistance { get; set; }
|
|
public double FrontDistance { get; set; }
|
|
|
|
public WpfLampsLayout()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void btnConfirm_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
double lrDistance, fDistance;
|
|
bool a = double.TryParse(tbDistanceLR.Text, out lrDistance);
|
|
bool b = double.TryParse(tbDistanceFB.Text, out fDistance);
|
|
if (a && b)
|
|
{
|
|
LeftRightDistance = lrDistance;
|
|
FrontDistance = fDistance;
|
|
DialogResult = true;
|
|
}
|
|
}
|
|
|
|
private void tb_PreviewTextInput(object sender, TextCompositionEventArgs e)
|
|
{
|
|
System.Text.RegularExpressions.Regex re = new System.Text.RegularExpressions.Regex("[^0-9]+");
|
|
e.Handled = re.IsMatch(e.Text);
|
|
}
|
|
}
|
|
} |