From 99df058a665ea04065a23e729ec79a2f23f79881 Mon Sep 17 00:00:00 2001
From: alielie <alielie@git.com>
Date: 星期二, 20 五月 2025 16:59:43 +0800
Subject: [PATCH] 优化

---
 WPFProject/LoadingWindow.xaml.cs |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/WPFProject/LoadingWindow.xaml.cs b/WPFProject/LoadingWindow.xaml.cs
index e9d50a4..e0c4fc1 100644
--- a/WPFProject/LoadingWindow.xaml.cs
+++ b/WPFProject/LoadingWindow.xaml.cs
@@ -1,4 +1,5 @@
 锘縰sing HMI.Base;
+using HMI.Core.Api;
 using HMI.UI.Util;
 using Panuon.WPF.UI;
 using System;
@@ -37,7 +38,8 @@
             }
         }
 
-        public Visibility ConsoleVisiable {
+        public Visibility ConsoleVisiable
+        {
             get => showConsole ? Visibility.Visible : Visibility.Collapsed;
         }
 
@@ -65,7 +67,7 @@
                     Add(msg.Message, null);
                     break;
                 case LoadMsgType.LOADING:
-                    HasErr = msg.Result == false;
+                    HasErr = HasErr || msg.Result == false;
                     if (msg.Result != null)
                     {
                         processBar.Value = ++finished / total * 100;
@@ -83,21 +85,21 @@
 
         private void Button_Click(object sender, RoutedEventArgs e)
         {
-            PanuonWindow window = new PanuonWindow();
             window.Show();
             this.Close();
         }
-
+        private PanuonWindow window;
         private double total;
         private double finished;
 
         private void WindowX_ContentRendered(object sender, System.EventArgs e)
         {
+            window = new PanuonWindow();
             PluginLoader loader = PluginLoader.GetLoader();
             loader.LoadMessageAppend += Loader_LoadMessageAppend;
             Task.Run(() =>
             {
-                loader.LoadMenuAndPlugin(Dispatcher);
+                loader.LoadMenuAndPlugin(window, Dispatcher);
                 //
             });
         }
@@ -132,7 +134,7 @@
             };
             //涔熷彲浠ユ彃鍏ュ埌鏈�鍚庨潰
             Console.Document.Blocks.InsertAfter(Console.Document.Blocks.LastBlock, paragraph);
-            
+
             //鎻掑叆鍒版渶鍓嶉潰
             //rtxtLog.Document.Blocks.Add(paragraph);
 

--
Gitblit v1.9.1