CreateScriptPackageWindow.xaml.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. using System;
  2. using System.Windows;
  3. using AIPlatform.Protocol.Entities;
  4. namespace aipdev
  5. {
  6. /// <summary>
  7. /// Interaction logic for CreateScriptPackageWindow.xaml
  8. /// </summary>
  9. public partial class CreateScriptPackageWindow : Window
  10. {
  11. /// <summary>
  12. /// Gets the new package name.
  13. /// </summary>
  14. public string NewPackageName { get; private set; }
  15. /// <summary>
  16. /// Gets the new package framework.
  17. /// </summary>
  18. public TrainScriptPackageFramework NewPackageFramework { get; private set; }
  19. public CreateScriptPackageWindow()
  20. {
  21. InitializeComponent();
  22. PackageName.Focus();
  23. foreach (TrainScriptPackageFramework type in Enum.GetValues(typeof(TrainScriptPackageFramework)))
  24. {
  25. PackageFramework.Items.Add(type);
  26. }
  27. PackageFramework.SelectedIndex = 1;
  28. }
  29. private void OnOkClick(object sender, RoutedEventArgs e)
  30. {
  31. if (string.IsNullOrWhiteSpace(PackageName.Text) || string.IsNullOrEmpty(PackageName.Text))
  32. {
  33. MessageBox.Show(Application.Current.MainWindow, "请输入脚本包名", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
  34. return;
  35. }
  36. NewPackageName = PackageName.Text.Trim();
  37. NewPackageFramework = (TrainScriptPackageFramework)PackageFramework.SelectedItem;
  38. Close();
  39. }
  40. private void OnCloseClick(object sender, RoutedEventArgs e)
  41. {
  42. Close();
  43. }
  44. }
  45. }