NewModelNameDlg.xaml.cs 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. using InitializerModel;
  2. using PhihongEv.Lib;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.IO;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows;
  10. using System.Windows.Controls;
  11. using System.Windows.Data;
  12. using System.Windows.Documents;
  13. using System.Windows.Input;
  14. using System.Windows.Media;
  15. using System.Windows.Media.Imaging;
  16. using System.Windows.Shapes;
  17. namespace ConfigEditor
  18. {
  19. /// <summary>
  20. /// NewModelNameDlg.xaml 的互動邏輯
  21. /// </summary>
  22. public partial class NewModelNameDlg : Window
  23. {
  24. public NewModelNameDlg()
  25. {
  26. InitializeComponent();
  27. }
  28. public string ModelName => uxModelName.Text;
  29. private void OK_Click(object sender, RoutedEventArgs e)
  30. {
  31. var enterdModelName = uxModelName.Text;
  32. if (!SystemID.TryLooseParse(enterdModelName, out _))
  33. {
  34. MessageBox.Show("model name error");
  35. return;
  36. }
  37. var folderPath = EvseSettingConfig.GetModelFolder(enterdModelName);
  38. if (Directory.Exists(folderPath))
  39. {
  40. MessageBox.Show("model folder exist");
  41. return;
  42. }
  43. DialogResult = true;
  44. this.Close();
  45. }
  46. }
  47. }