From d1451a579c1cbfea23c79813ea445baf49cb332f Mon Sep 17 00:00:00 2001 From: fyf Date: Tue, 20 Sep 2022 10:05:44 +0800 Subject: [PATCH] 1 --- .../MainWindowViewModel.cs | 4 ++-- .../CustomerControls/StatusLight.cs | 2 +- BeDesignerSCADA/Adorners/SelectionAdorner.cs | 4 +++- .../Controls/MainCanvasPanel.xaml.cs | 20 +++++++++---------- 4 files changed, 16 insertions(+), 14 deletions(-) diff --git a/BPASmart.ConfigurationSoftware/MainWindowViewModel.cs b/BPASmart.ConfigurationSoftware/MainWindowViewModel.cs index ac95b7d1..328a618d 100644 --- a/BPASmart.ConfigurationSoftware/MainWindowViewModel.cs +++ b/BPASmart.ConfigurationSoftware/MainWindowViewModel.cs @@ -77,8 +77,8 @@ namespace BPASmart.ConfigurationSoftware var res = mainCanvasPanels.FirstOrDefault(p => p.PageName == o.ToString()); if (res != null) { - ConstructorInfo cti = res.MainCanvasPanelModel.GetType()?.GetConstructor(System.Type.EmptyTypes); - MainContent = (FrameworkElement)cti?.Invoke(null); + //ConstructorInfo cti = res.MainCanvasPanelModel.GetType()?.GetConstructor(System.Type.EmptyTypes); + MainContent = res.MainCanvasPanelModel;// (FrameworkElement)cti?.Invoke(null); } }); diff --git a/BPASmartClient.SCADAControl/CustomerControls/StatusLight.cs b/BPASmartClient.SCADAControl/CustomerControls/StatusLight.cs index 05637421..8f72bbe8 100644 --- a/BPASmartClient.SCADAControl/CustomerControls/StatusLight.cs +++ b/BPASmartClient.SCADAControl/CustomerControls/StatusLight.cs @@ -72,7 +72,7 @@ namespace BPASmartClient.SCADAControl.CustomerControls switch (StatusValue) { case 0: - image.Source = new BitmapImage(new Uri("pack://application:,,,/Images/State0.png", UriKind.Absolute)); + image.Source = new BitmapImage(new Uri(@"/BPASmartClient.SCADAControl;component/Images/State0.png", UriKind.Absolute)); break; case -1: image.Source = new BitmapImage(new Uri("pack://application:,,,/Images/State11.png", UriKind.Absolute)); diff --git a/BeDesignerSCADA/Adorners/SelectionAdorner.cs b/BeDesignerSCADA/Adorners/SelectionAdorner.cs index 61139545..2dfbaa35 100644 --- a/BeDesignerSCADA/Adorners/SelectionAdorner.cs +++ b/BeDesignerSCADA/Adorners/SelectionAdorner.cs @@ -28,7 +28,9 @@ namespace BeDesignerSCADA.Adorners MouseDown += SelectionAdorner_MouseDown; MouseMove += SelectionAdorner_MouseMove; MouseUp += SelectionAdorner_MouseUp; - + ResourceDictionary languageResDic = new ResourceDictionary(); + languageResDic.Source = new Uri(@"/BeDesignerSCADA;component/Themes/Styles.xaml", UriKind.RelativeOrAbsolute); + this.Resources.MergedDictionaries.Add(languageResDic); ContextMenu = FindResource("AdornerRightMenu") as ContextMenu; Tag = CanvasPanel.GetParentObject(AdornedElement); diff --git a/BeDesignerSCADA/Controls/MainCanvasPanel.xaml.cs b/BeDesignerSCADA/Controls/MainCanvasPanel.xaml.cs index 8d4337a3..45b8b840 100644 --- a/BeDesignerSCADA/Controls/MainCanvasPanel.xaml.cs +++ b/BeDesignerSCADA/Controls/MainCanvasPanel.xaml.cs @@ -49,16 +49,16 @@ namespace BeDesignerSCADA.Controls //读取文件 FileRead(_Path); } - public MainCanvasPanel() - { - InitializeComponent(); - this.DataContext = viewModel; - viewModel.Loaded(cav, runCanvas); - //控件加载 - Assembly assembly = Assembly.LoadFile($"{System.AppDomain.CurrentDomain.BaseDirectory}\\BPASmartClient.SCADAControl.dll"); //Assembly.GetExecutingAssembly(); - var controls = assembly.GetTypes().Where(t => t.GetInterface("IExecutable") != null).OrderBy(o => o.Name); - CtlList.ItemsSource = controls; - } + //public MainCanvasPanel() + //{ + // InitializeComponent(); + // this.DataContext = viewModel; + // viewModel.Loaded(cav, runCanvas); + // //控件加载 + // Assembly assembly = Assembly.LoadFile($"{System.AppDomain.CurrentDomain.BaseDirectory}\\BPASmartClient.SCADAControl.dll"); //Assembly.GetExecutingAssembly(); + // var controls = assembly.GetTypes().Where(t => t.GetInterface("IExecutable") != null).OrderBy(o => o.Name); + // CtlList.ItemsSource = controls; + //} #region 位置调整 ///