From 82a9f67d8c9696f4fafa98b1d9efe339dabf76a6 Mon Sep 17 00:00:00 2001 From: lihanbo Date: Fri, 8 Nov 2024 17:10:10 +0800 Subject: [PATCH] =?UTF-8?q?105040=20Update=20=E7=AA=97=E5=8F=A3=E6=89=93?= =?UTF-8?q?=E5=BC=80=E6=97=B6=E9=87=8D=E6=96=B0=E5=8A=A0=E8=BD=BD=E7=BC=93?= =?UTF-8?q?=E5=AD=98=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sinvo.EplanHpD.Plugin.WPFUI/MainWindow.xaml.cs | 5 +++++ Sinvo.EplanHpD.Plugin.WPFUI/Utils/ExcelHelper.cs | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/MainWindow.xaml.cs b/Sinvo.EplanHpD.Plugin.WPFUI/MainWindow.xaml.cs index 658a9bc..99f8be3 100644 --- a/Sinvo.EplanHpD.Plugin.WPFUI/MainWindow.xaml.cs +++ b/Sinvo.EplanHpD.Plugin.WPFUI/MainWindow.xaml.cs @@ -139,8 +139,13 @@ public partial class MainWindow : Window { try { + LoadingMask.Visibility = Visibility.Visible; + this.Dispatcher.BeginInvoke(async delegate () + { + ExcelHelper.CheckAndGetCache(true); await LoadDataAsync(datas, reportColumns); + }); } catch (System.Exception ex) { diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/Utils/ExcelHelper.cs b/Sinvo.EplanHpD.Plugin.WPFUI/Utils/ExcelHelper.cs index 7654a56..4332427 100644 --- a/Sinvo.EplanHpD.Plugin.WPFUI/Utils/ExcelHelper.cs +++ b/Sinvo.EplanHpD.Plugin.WPFUI/Utils/ExcelHelper.cs @@ -26,11 +26,11 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.Utils CheckAndGetCache(); return _terminalMappingCache.Where(item => item.WireModelSpecification == wireModel && (item.Prefix == prefix || item.Prefix == null)); } - private static void CheckAndGetCache() + public static void CheckAndGetCache(bool isForceReload = false) { lock (_terminalMappingCache) { - if (_terminalMappingCache == null || !_terminalMappingCache.Any()) + if ((_terminalMappingCache == null || !_terminalMappingCache.Any()) || isForceReload) { GetAllWireTerminalMappingTable(); }