using OpenTap; using System.Windows; using System.Windows.Controls; namespace OpenTapEditor.UI { /// /// FileSelector.xaml 的交互逻辑 /// public partial class VariableTextBox : UserControl { public static readonly DependencyProperty ValueProperty = DependencyProperty.Register( "Value", typeof(string), typeof(VariableTextBox), new FrameworkPropertyMetadata()); public static readonly DependencyProperty StepProperty = DependencyProperty.Register( "Step", typeof(ITestStep), typeof(VariableTextBox), new FrameworkPropertyMetadata()); public ITestStep Step { get => (ITestStep)GetValue(StepProperty); set { SetValue(StepProperty, value); } } public string Value { get => (string)GetValue(ValueProperty); set { SetValue(ValueProperty, value); } } public VariableTextBox() { DataContext = this; InitializeComponent(); } private void Button_Click(object sender, RoutedEventArgs e) { var win = new VariableSelector() { Owner = Window.GetWindow(this) }; if (win.Open(Step.Root, new TestStepList()) == true) { Value = win.Result; } } } }