12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- using System;
- using System.IO;
- using System.Windows;
- namespace AIPractice.LabellerServer.WPF
- {
- /// <summary>
- /// Interaction logic for SelectLabelWindow.xaml
- /// </summary>
- public partial class SelectLabelWindow : Window
- {
- public string SelectedLabel { get; private set; }
- public SelectLabelWindow()
- {
- InitializeComponent();
- SelectedLabel = null;
- var labelFolder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Database","SpecialLabels");
- if (Directory.Exists(labelFolder))
- {
- var labels = Directory.GetFiles(labelFolder, "*.lb", SearchOption.TopDirectoryOnly);
- foreach (var label in labels)
- {
- var fileName = Path.GetFileName(label);
- LabelList.Items.Add(fileName);
- }
- }
- }
- private void OnOkClick(object sender, RoutedEventArgs e)
- {
- if (LabelList.SelectedIndex != -1)
- {
- SelectedLabel = LabelList.SelectedItem.ToString();
- Close();
- }
- else
- {
- MessageBox.Show("请选择一个标签", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
- }
- }
- private void OnCloseClick(object sender, RoutedEventArgs e)
- {
- Close();
- }
- }
- }
|