终端一体化运控平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

74 lines
1.9 KiB

  1. using BPA.Helper;
  2. using BPASmart.Model;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. using System.Windows;
  9. using System.Windows.Controls;
  10. using System.Windows.Data;
  11. using System.Windows.Documents;
  12. using System.Windows.Input;
  13. using System.Windows.Media;
  14. using System.Windows.Media.Imaging;
  15. using System.Windows.Shapes;
  16. namespace BPASmart.ConfigurationSoftware
  17. {
  18. /// <summary>
  19. /// NewPageView.xaml 的交互逻辑
  20. /// </summary>
  21. public partial class NewPageView : Window
  22. {
  23. public NewPageView()
  24. {
  25. InitializeComponent();
  26. DefaultPageName();
  27. this.pageName.Focus();
  28. }
  29. private void DefaultPageName()
  30. {
  31. int count = 0;
  32. while (true)
  33. {
  34. count++;
  35. if (!Json<ProjectModel>.Data.Pages.ContainsKey($"Page{count}"))
  36. {
  37. this.pageName.Text = $"Page{count}";
  38. break;
  39. }
  40. }
  41. }
  42. private void Button_Click(object sender, RoutedEventArgs e)
  43. {
  44. this.DialogResult = false;
  45. this.Close();
  46. }
  47. private void Button_Click_1(object sender, RoutedEventArgs e)
  48. {
  49. if (this.pageName.Text.Trim().Length > 0)
  50. {
  51. if (!Json<ProjectModel>.Data.Pages.ContainsKey(this.pageName.Text.Trim()))
  52. {
  53. this.DialogResult = true;
  54. ActionManage.GetInstance.Send("AddPage", this.pageName.Text);
  55. this.Close();
  56. }
  57. else
  58. {
  59. ErrorInfo.Text = "该页面已存在";
  60. }
  61. }
  62. else
  63. {
  64. ErrorInfo.Text = "请输入页面名称";
  65. }
  66. }
  67. }
  68. }