diff --git a/XplorePlane/Views/ImageProcessing/OperatorToolboxView.xaml b/XplorePlane/Views/ImageProcessing/OperatorToolboxView.xaml index 1143c01..11bfd62 100644 --- a/XplorePlane/Views/ImageProcessing/OperatorToolboxView.xaml +++ b/XplorePlane/Views/ImageProcessing/OperatorToolboxView.xaml @@ -3,7 +3,9 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:prism="http://prismlibrary.com/" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" + prism:ViewModelLocator.AutoWireViewModel="True" mc:Ignorable="d" d:DesignHeight="600" d:DesignWidth="200"> diff --git a/XplorePlane/Views/ImageProcessing/OperatorToolboxView.xaml.cs b/XplorePlane/Views/ImageProcessing/OperatorToolboxView.xaml.cs index de1bfc0..5f2a575 100644 --- a/XplorePlane/Views/ImageProcessing/OperatorToolboxView.xaml.cs +++ b/XplorePlane/Views/ImageProcessing/OperatorToolboxView.xaml.cs @@ -1,7 +1,6 @@ using System.Windows; using System.Windows.Controls; using System.Windows.Input; -using Prism.Ioc; using Serilog; using XplorePlane.ViewModels; @@ -22,12 +21,10 @@ namespace XplorePlane.Views private void OnLoaded(object sender, RoutedEventArgs e) { - if (DataContext is not OperatorToolboxViewModel) - DataContext = ContainerLocator.Container.Resolve(); - ToolboxListBox.PreviewMouseLeftButtonDown += OnPreviewMouseDown; ToolboxListBox.PreviewMouseMove += OnPreviewMouseMove; - Log.Debug("OperatorToolboxView 原生拖拽源已注册"); + Log.Debug("OperatorToolboxView 原生拖拽源已注册, DataContext={Type}", + DataContext?.GetType().Name); } private void OnPreviewMouseDown(object sender, MouseButtonEventArgs e) diff --git a/XplorePlane/Views/ImageProcessing/PipelineEditorView.xaml b/XplorePlane/Views/ImageProcessing/PipelineEditorView.xaml index d78746b..270e9cc 100644 --- a/XplorePlane/Views/ImageProcessing/PipelineEditorView.xaml +++ b/XplorePlane/Views/ImageProcessing/PipelineEditorView.xaml @@ -4,7 +4,9 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:prism="http://prismlibrary.com/" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" + prism:ViewModelLocator.AutoWireViewModel="True" d:DesignHeight="700" d:DesignWidth="350" mc:Ignorable="d"> diff --git a/XplorePlane/Views/ImageProcessing/PipelineEditorView.xaml.cs b/XplorePlane/Views/ImageProcessing/PipelineEditorView.xaml.cs index ae58a7c..b9dfae5 100644 --- a/XplorePlane/Views/ImageProcessing/PipelineEditorView.xaml.cs +++ b/XplorePlane/Views/ImageProcessing/PipelineEditorView.xaml.cs @@ -1,7 +1,5 @@ -using System; using System.Windows; using System.Windows.Controls; -using Prism.Ioc; using Serilog; using XplorePlane.ViewModels; @@ -17,21 +15,8 @@ namespace XplorePlane.Views private void OnLoaded(object sender, RoutedEventArgs e) { - try - { - if (DataContext is not PipelineEditorViewModel) - { - Log.Information("PipelineEditorView DataContext 不是 PipelineEditorViewModel(当前={Type}),正在从容器解析...", - DataContext?.GetType().Name); - DataContext = ContainerLocator.Container.Resolve(); - } - Log.Information("PipelineEditorView DataContext 类型={Type}, HashCode={Hash}", - DataContext?.GetType().Name, DataContext?.GetHashCode()); - } - catch (Exception ex) - { - Log.Error(ex, "PipelineEditorView 解析 DataContext 失败"); - } + Log.Information("PipelineEditorView DataContext 类型={Type}", + DataContext?.GetType().Name); PipelineListBox.AllowDrop = true; PipelineListBox.Drop += OnOperatorDropped;