using Aitex.Core.UI.View.Common; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Text.RegularExpressions; 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.Shapes; namespace Aitex.Sorter.UI.Views { /// /// RecipeNameDialog.xaml 的交互逻辑 /// public partial class RecipeNameDialog : Window, IBaseView { public RecipeNameDialog(string name = null) { InitializeComponent(); tbInput.Text = name; btnOk.IsEnabled = name != null; } private void tbInput_TextChanged(object sender, TextChangedEventArgs e) { btnOk.IsEnabled = IsValidFileName(tbInput.Text); } private void btnOk_Click(object sender, RoutedEventArgs e) { DialogResult = true; } private void btnCancel_Click(object sender, RoutedEventArgs e) { DialogResult = false; } public string RecipeName { get { return tbInput.Text.Trim(); } } bool IsValidFileName(string strIn) { return !string.IsNullOrWhiteSpace(strIn); } } }