#0031 新增打开图像工具箱
This commit is contained in:
@@ -154,7 +154,7 @@ namespace XplorePlane
|
|||||||
|
|
||||||
protected override Window CreateShell()
|
protected override Window CreateShell()
|
||||||
{
|
{
|
||||||
return Container.Resolve<MainWindowB>();
|
return Container.Resolve<MainWindow>();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void RegisterTypes(IContainerRegistry containerRegistry)
|
protected override void RegisterTypes(IContainerRegistry containerRegistry)
|
||||||
|
|||||||
@@ -56,10 +56,13 @@ namespace XplorePlane.ViewModels
|
|||||||
SaveAsPipelineCommand = new DelegateCommand(async () => await SaveAsPipelineAsync());
|
SaveAsPipelineCommand = new DelegateCommand(async () => await SaveAsPipelineAsync());
|
||||||
DeletePipelineCommand = new DelegateCommand(async () => await DeletePipelineAsync());
|
DeletePipelineCommand = new DelegateCommand(async () => await DeletePipelineAsync());
|
||||||
LoadPipelineCommand = new DelegateCommand(async () => await LoadPipelineAsync());
|
LoadPipelineCommand = new DelegateCommand(async () => await LoadPipelineAsync());
|
||||||
|
OpenToolboxCommand = new DelegateCommand(OpenToolbox);
|
||||||
MoveNodeUpCommand = new DelegateCommand<PipelineNodeViewModel>(MoveNodeUp);
|
MoveNodeUpCommand = new DelegateCommand<PipelineNodeViewModel>(MoveNodeUp);
|
||||||
MoveNodeDownCommand = new DelegateCommand<PipelineNodeViewModel>(MoveNodeDown);
|
MoveNodeDownCommand = new DelegateCommand<PipelineNodeViewModel>(MoveNodeDown);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ── State Properties ──────────────────────────────────────────
|
// ── State Properties ──────────────────────────────────────────
|
||||||
|
|
||||||
public ObservableCollection<PipelineNodeViewModel> PipelineNodes { get; }
|
public ObservableCollection<PipelineNodeViewModel> PipelineNodes { get; }
|
||||||
@@ -137,6 +140,9 @@ namespace XplorePlane.ViewModels
|
|||||||
public DelegateCommand SaveAsPipelineCommand { get; }
|
public DelegateCommand SaveAsPipelineCommand { get; }
|
||||||
public DelegateCommand DeletePipelineCommand { get; }
|
public DelegateCommand DeletePipelineCommand { get; }
|
||||||
public DelegateCommand LoadPipelineCommand { get; }
|
public DelegateCommand LoadPipelineCommand { get; }
|
||||||
|
|
||||||
|
public DelegateCommand OpenToolboxCommand { get; }
|
||||||
|
|
||||||
public DelegateCommand<PipelineNodeViewModel> MoveNodeUpCommand { get; }
|
public DelegateCommand<PipelineNodeViewModel> MoveNodeUpCommand { get; }
|
||||||
public DelegateCommand<PipelineNodeViewModel> MoveNodeDownCommand { get; }
|
public DelegateCommand<PipelineNodeViewModel> 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()
|
private PipelineModel BuildPipelineModel()
|
||||||
{
|
{
|
||||||
return new PipelineModel
|
return new PipelineModel
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ namespace XplorePlane.Views
|
|||||||
|
|
||||||
private void OnLoaded(object sender, RoutedEventArgs e)
|
private void OnLoaded(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (DataContext == null)
|
if (DataContext is not OperatorToolboxViewModel)
|
||||||
DataContext = ContainerLocator.Container.Resolve<OperatorToolboxViewModel>();
|
DataContext = ContainerLocator.Container.Resolve<OperatorToolboxViewModel>();
|
||||||
|
|
||||||
ToolboxListBox.PreviewMouseLeftButtonDown += OnPreviewMouseDown;
|
ToolboxListBox.PreviewMouseLeftButtonDown += OnPreviewMouseDown;
|
||||||
|
|||||||
@@ -98,13 +98,19 @@
|
|||||||
Content="■"
|
Content="■"
|
||||||
Style="{StaticResource ToolbarBtn}"
|
Style="{StaticResource ToolbarBtn}"
|
||||||
ToolTip="取消执行" />
|
ToolTip="取消执行" />
|
||||||
|
<Button
|
||||||
|
Command="{Binding DeletePipelineCommand}"
|
||||||
|
Content="🗑"
|
||||||
|
Style="{StaticResource ToolbarBtn}"
|
||||||
|
ToolTip="工具箱" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<Button
|
<Button
|
||||||
|
Width="50"
|
||||||
HorizontalAlignment="Right"
|
HorizontalAlignment="Right"
|
||||||
Command="{Binding DeletePipelineCommand}"
|
Command="{Binding OpenToolboxCommand}"
|
||||||
Content="🗑"
|
Content="工具箱"
|
||||||
Style="{StaticResource ToolbarBtn}"
|
Style="{StaticResource ToolbarBtn}"
|
||||||
ToolTip="删除流水线" />
|
ToolTip="打开算子工具箱" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using System;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using Prism.Ioc;
|
using Prism.Ioc;
|
||||||
@@ -16,8 +17,21 @@ namespace XplorePlane.Views
|
|||||||
|
|
||||||
private void OnLoaded(object sender, RoutedEventArgs e)
|
private void OnLoaded(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (DataContext == null)
|
try
|
||||||
DataContext = ContainerLocator.Container.Resolve<PipelineEditorViewModel>();
|
{
|
||||||
|
if (DataContext is not PipelineEditorViewModel)
|
||||||
|
{
|
||||||
|
Log.Information("PipelineEditorView DataContext 不是 PipelineEditorViewModel(当前={Type}),正在从容器解析...",
|
||||||
|
DataContext?.GetType().Name);
|
||||||
|
DataContext = ContainerLocator.Container.Resolve<PipelineEditorViewModel>();
|
||||||
|
}
|
||||||
|
Log.Information("PipelineEditorView DataContext 类型={Type}, HashCode={Hash}",
|
||||||
|
DataContext?.GetType().Name, DataContext?.GetHashCode());
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, "PipelineEditorView 解析 DataContext 失败");
|
||||||
|
}
|
||||||
|
|
||||||
PipelineListBox.AllowDrop = true;
|
PipelineListBox.AllowDrop = true;
|
||||||
PipelineListBox.Drop += OnOperatorDropped;
|
PipelineListBox.Drop += OnOperatorDropped;
|
||||||
|
|||||||
Reference in New Issue
Block a user