using BPA.Helper; using BPASmart.Model; 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.Shapes; namespace BPASmart.ConfigurationSoftware { /// /// NewPageView.xaml 的交互逻辑 /// public partial class NewPageView : Window { public NewPageView() { InitializeComponent(); DefaultPageName(); this.pageName.Focus(); } private void DefaultPageName() { int count = 0; while (true) { count++; if (!Json.Data.Pages.ContainsKey($"Page{count}")) { this.pageName.Text = $"Page{count}"; break; } } } private void Button_Click(object sender, RoutedEventArgs e) { this.DialogResult = false; this.Close(); } private void Button_Click_1(object sender, RoutedEventArgs e) { if (this.pageName.Text.Trim().Length > 0) { if (!Json.Data.Pages.ContainsKey(this.pageName.Text.Trim())) { this.DialogResult = true; ActionManage.GetInstance.Send("AddPage", this.pageName.Text); this.Close(); } else { ErrorInfo.Text = "该页面已存在"; } } else { ErrorInfo.Text = "请输入页面名称"; } } } }