33 lines
1.6 KiB
C#
33 lines
1.6 KiB
C#
using Avalonia;
|
|
using Avalonia.Controls;
|
|
using Avalonia.Layout;
|
|
using Avalonia.Media;
|
|
|
|
namespace SopHelper.Training;
|
|
|
|
/// <summary>每次导入显式选择目标,确认前不修改当前标注项目。</summary>
|
|
public sealed class ImportPartDialog : Window
|
|
{
|
|
public ImportPartDialog(IReadOnlyList<string> parts)
|
|
{
|
|
Title = "选择目标零件"; Width = 460; SizeToContent = SizeToContent.Height;
|
|
CanResize = false; WindowStartupLocation = WindowStartupLocation.CenterOwner;
|
|
var picker = new ComboBox { Name = "ImportTargetPartPicker", ItemsSource = parts, HorizontalAlignment = HorizontalAlignment.Stretch, PlaceholderText = "请选择本视频要标注的零件" };
|
|
var confirm = new Button { Content = "下一步:选择视频", IsEnabled = false, IsDefault = true };
|
|
var cancel = new Button { Content = "取消", IsCancel = true };
|
|
picker.SelectionChanged += (_, _) => confirm.IsEnabled = picker.SelectedItem is string;
|
|
confirm.Click += (_, _) => { if (picker.SelectedItem is string target) Close(target); };
|
|
cancel.Click += (_, _) => Close(null);
|
|
Content = new StackPanel
|
|
{
|
|
Margin = new Thickness(20), Spacing = 16,
|
|
Children =
|
|
{
|
|
new TextBlock { Text = "每个视频只标注一个目标零件。导入后,目标零件将锁定,标注和训练时不能切换。", TextWrapping = TextWrapping.Wrap },
|
|
picker,
|
|
new StackPanel { Orientation = Orientation.Horizontal, HorizontalAlignment = HorizontalAlignment.Right, Spacing = 8, Children = { cancel, confirm } }
|
|
}
|
|
};
|
|
}
|
|
}
|