From 0940f31b7eba1cf6b6a8c1fca72d97cf686e79f2 Mon Sep 17 00:00:00 2001
From: alielie <alielie@git.com>
Date: 星期五, 04 七月 2025 10:43:00 +0800
Subject: [PATCH] 优化插件,完善TreeListView

---
 HMI.MenuManage/MenuManage.xaml.cs |   19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/HMI.MenuManage/MenuManage.xaml.cs b/HMI.MenuManage/MenuManage.xaml.cs
index 8ffc3c0..fa38a3a 100644
--- a/HMI.MenuManage/MenuManage.xaml.cs
+++ b/HMI.MenuManage/MenuManage.xaml.cs
@@ -5,6 +5,7 @@
 using HMI.UI.Util;
 using System;
 using System.Collections.Generic;
+using System.ComponentModel;
 using System.Linq;
 using System.Windows;
 using System.Windows.Controls;
@@ -71,12 +72,12 @@
                     List<string> ids = Model.DataSource.Where(x => x.Selected).Select(x => x.Id).ToList();
                     if (ids == null || ids.Count <= 0)
                     {
-                        ToastHelper.Warning(Window.GetWindow(this), LangUtil.Get("HMI.Menu.NoDeleteData"));
+                        ToastHelper.Warning(Window.GetWindow(this), LangUtil.Get("HMI.NoDeleteData"));
                         return;
                     }
 
                     var res = MsgBoxHelper.WarnMessage(Window.GetWindow(this),
-                        string.Format(LangUtil.Get("HMI.Menu.MakeSureDeletes"), ids.Count));
+                        string.Format(LangUtil.Get("HMI.MakeSureDeletes"), ids.Count));
                     if (res == MessageBoxResult.OK)
                     {
                         Model.DeleteMenuByIds(ids);
@@ -118,7 +119,7 @@
                 {
                     var data = (MenuData)((Button)sender).DataContext;
                     var res = MsgBoxHelper.WarnMessage(Window.GetWindow(this),
-                        string.Format(LangUtil.Get("HMI.Menu.MakeSureDeleteSingle"), data.Name));
+                        string.Format(LangUtil.Get("HMI.MakeSureDeleteSingle"), data.Name));
                     if (res == MessageBoxResult.OK)
                     {
                         Model.DeleteMenuById(data.Id);
@@ -133,6 +134,18 @@
             }
         }
 
+        public override void DoClose(object sender, EventArgs e)
+        {
+            try
+            {
+                Model?.sqliteHelper?.Close();
+            }
+            catch (Exception ex)
+            {
+                log.Warn("Do Close Failed.", ex);
+            }
+        }
+
         private void DataGrid_Loaded(object sender, RoutedEventArgs e)
         {
             Model.LoadData();

--
Gitblit v1.9.1