using CommunityToolkit.Mvvm.ComponentModel;
|
using OpenTap.Addin;
|
using System.Windows;
|
using System.Windows.Controls;
|
|
namespace SeqEditor.SubWin
|
{
|
/// <summary>
|
/// ArrayVarConfig.xaml 的交互逻辑
|
/// </summary>
|
[ObservableObject]
|
public partial class ArrayVarConfig : Window
|
{
|
[ObservableProperty]
|
private string varName;
|
|
[ObservableProperty]
|
private TestVariableType varType;
|
|
[ObservableProperty]
|
private int length;
|
|
private Func<string,string> validateName;
|
|
public ArrayVarConfig(Func<string, string> func)
|
{
|
validateName = func;
|
DataContext = this;
|
InitializeComponent();
|
CbType.ItemsSource = Enum.GetValues(typeof(TestVariableType));
|
}
|
|
private void Button_Click(object sender, RoutedEventArgs e)
|
{
|
Button btn = (Button)sender;
|
if (!btn.IsCancel)
|
{
|
string msg = validateName(VarName);
|
if (!string.IsNullOrEmpty(msg))
|
{
|
FgName.ValidateResult = Panuon.WPF.UI.ValidateResult.Error;
|
FgName.Message = msg;
|
return;
|
}
|
else
|
{
|
FgName.ValidateResult = Panuon.WPF.UI.ValidateResult.None;
|
FgName.Message = msg;
|
}
|
}
|
|
this.DialogResult = !btn.IsCancel;
|
this.Close();
|
}
|
}
|
}
|