diff --git a/XplorePlane/App.xaml.cs b/XplorePlane/App.xaml.cs index 2d147a2..14f3155 100644 --- a/XplorePlane/App.xaml.cs +++ b/XplorePlane/App.xaml.cs @@ -154,7 +154,7 @@ namespace XplorePlane protected override Window CreateShell() { - return Container.Resolve(); + return Container.Resolve(); } protected override void RegisterTypes(IContainerRegistry containerRegistry) diff --git a/XplorePlane/ViewModels/ImageProcessing/PipelineEditorViewModel.cs b/XplorePlane/ViewModels/ImageProcessing/PipelineEditorViewModel.cs index a914794..16b817f 100644 --- a/XplorePlane/ViewModels/ImageProcessing/PipelineEditorViewModel.cs +++ b/XplorePlane/ViewModels/ImageProcessing/PipelineEditorViewModel.cs @@ -56,10 +56,13 @@ namespace XplorePlane.ViewModels SaveAsPipelineCommand = new DelegateCommand(async () => await SaveAsPipelineAsync()); DeletePipelineCommand = new DelegateCommand(async () => await DeletePipelineAsync()); LoadPipelineCommand = new DelegateCommand(async () => await LoadPipelineAsync()); + OpenToolboxCommand = new DelegateCommand(OpenToolbox); MoveNodeUpCommand = new DelegateCommand(MoveNodeUp); MoveNodeDownCommand = new DelegateCommand(MoveNodeDown); } + + // ── State Properties ────────────────────────────────────────── public ObservableCollection PipelineNodes { get; } @@ -137,6 +140,9 @@ namespace XplorePlane.ViewModels public DelegateCommand SaveAsPipelineCommand { get; } public DelegateCommand DeletePipelineCommand { get; } public DelegateCommand LoadPipelineCommand { get; } + + public DelegateCommand OpenToolboxCommand { get; } + public DelegateCommand MoveNodeUpCommand { get; } public DelegateCommand MoveNodeDownCommand { get; } @@ -461,6 +467,26 @@ namespace XplorePlane.ViewModels } } + private void OpenToolbox() //打开图像工具箱 + { + Serilog.Log.Information("OpenToolbox 被调用"); + try + { + var window = new Views.OperatorToolboxWindow + { + Owner = System.Windows.Application.Current.MainWindow + }; + Serilog.Log.Information("OperatorToolboxWindow 已创建,准备 Show()"); + window.Show(); + Serilog.Log.Information("OperatorToolboxWindow.Show() 完成"); + } + catch (Exception ex) + { + Serilog.Log.Error(ex, "OpenToolbox 打开窗口失败"); + } + } + + private PipelineModel BuildPipelineModel() { return new PipelineModel diff --git a/XplorePlane/Views/ImageProcessing/OperatorToolboxView.xaml.cs b/XplorePlane/Views/ImageProcessing/OperatorToolboxView.xaml.cs index d6c3ef5..de1bfc0 100644 --- a/XplorePlane/Views/ImageProcessing/OperatorToolboxView.xaml.cs +++ b/XplorePlane/Views/ImageProcessing/OperatorToolboxView.xaml.cs @@ -22,7 +22,7 @@ namespace XplorePlane.Views private void OnLoaded(object sender, RoutedEventArgs e) { - if (DataContext == null) + if (DataContext is not OperatorToolboxViewModel) DataContext = ContainerLocator.Container.Resolve(); ToolboxListBox.PreviewMouseLeftButtonDown += OnPreviewMouseDown; diff --git a/XplorePlane/Views/ImageProcessing/PipelineEditorView.xaml b/XplorePlane/Views/ImageProcessing/PipelineEditorView.xaml index 2923b2b..d78746b 100644 --- a/XplorePlane/Views/ImageProcessing/PipelineEditorView.xaml +++ b/XplorePlane/Views/ImageProcessing/PipelineEditorView.xaml @@ -98,13 +98,19 @@ Content="■" Style="{StaticResource ToolbarBtn}" ToolTip="取消执行" /> +