12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- using AIPlatform.Protocol.Entities;
- using System;
- using System.Windows;
- using System.Windows.Controls;
- namespace aipdev
- {
- /// <summary>
- /// Interaction logic for CreateTestFolderWindow.xaml
- /// </summary>
- public partial class CreateTestFolderWindow : Window
- {
- /// <summary>
- /// Gets the new folder name.
- /// </summary>
- public string NewFolderName { get; private set; }
- /// <summary>
- /// Gets the new folder description.
- /// </summary>
- public string NewFolderDescription { get; private set; }
- /// <summary>
- /// Gets the value that assign the image count from the source folder to the new folder
- /// </summary>
- public int AssignCount { get; private set; }
- /// <summary>
- /// Gets the value to indicate whether the folder is shared to other developers.
- /// </summary>
- public bool IsShared { get; private set; }
- /// <summary>
- /// Gets the folder's image count which to copy.
- /// </summary>
- private int SourceFolderImageCount { get; set; }
- public CreateTestFolderWindow(ImageFolder folder)
- {
- InitializeComponent();
- TestFolderName.Focus();
- SourceFolderImageCount = folder.ImageCount;
- }
- private void OnTestOkClick(object sender, RoutedEventArgs e)
- {
- if (string.IsNullOrWhiteSpace(TestFolderName.Text) || string.IsNullOrEmpty(TestFolderName.Text))
- {
- MessageBox.Show(this, "请填写文件夹名", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
- return;
- }
- if (string.IsNullOrWhiteSpace(TestFolderDesc.Text) || string.IsNullOrEmpty(TestFolderDesc.Text))
- {
- MessageBox.Show(this, "请填写文件夹描述", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
- return;
- }
- AssignCount = int.Parse(AssignTestImageCount.Text?.Trim() ?? "0");
- if (AssignCount == 0)
- {
- MessageBox.Show(this, "请填写要分配的图片数量", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
- return;
- }
- if (AssignCount > SourceFolderImageCount)
- {
- MessageBox.Show(this, $"要分配的图片数量超出,最大分配数量是{SourceFolderImageCount},请重新填写。", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
- return;
- }
- NewFolderName = TestFolderName.Text.Trim();
- NewFolderDescription = TestFolderDesc.Text.Trim();
- //IsShared = IsSharedTestCheckbox.IsChecked == null ? false : IsSharedTestCheckbox.IsChecked.Value;
- Close();
- }
- private void OnTestCancelClick(object sender, RoutedEventArgs e)
- {
- Close();
- }
- }
- }
|