diff --git a/Core/AppState.cs b/Core/AppState.cs
new file mode 100644
index 0000000000000000000000000000000000000000..25c7fc80c9c98b23f5e38d2e5b2bdadcae89b292
--- /dev/null
+++ b/Core/AppState.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Core
+{
+ ///
+ /// app状态
+ ///
+ public class AppState
+ {
+ ///
+ /// 是否正在加载中
+ ///
+ public static bool IsLoading { get; set; } = true;
+
+ }
+}
diff --git a/Core/Core.csproj b/Core/Core.csproj
index 7c1005b75e4ae1741411ae063a76d4e348294795..fe0f560aaf02eb2a9c7a9e40caec19b5debd6926 100644
--- a/Core/Core.csproj
+++ b/Core/Core.csproj
@@ -106,6 +106,7 @@
+
diff --git a/Core/Servicers/Instances/Main.cs b/Core/Servicers/Instances/Main.cs
index 64bafe1872d555a4855d09e3edaf2b43f207ac68..d61fee60a98255f304edc8bb65ad7ae0a318e800 100644
--- a/Core/Servicers/Instances/Main.cs
+++ b/Core/Servicers/Instances/Main.cs
@@ -140,6 +140,8 @@ namespace Core.Servicers.Instances
// 加载分类信息
categories.Load();
+
+ AppState.IsLoading = false;
});
diff --git a/UI/App.xaml.cs b/UI/App.xaml.cs
index dafb8be11aed96a8c3c21e6d8ad4cf8af85dd1e3..689137f62347157fda7ba07d1d67948d6bd1595a 100644
--- a/UI/App.xaml.cs
+++ b/UI/App.xaml.cs
@@ -1,4 +1,5 @@
-using Core.Librarys;
+using Core;
+using Core.Librarys;
using Core.Librarys.SQLite;
using Core.Servicers.Instances;
using Core.Servicers.Interfaces;
@@ -42,7 +43,6 @@ namespace UI
private IAppData appData;
-
public App()
{
InitStatusBarIcon();
@@ -119,7 +119,7 @@ namespace UI
CreateStatusBarIconMenu();
statusBarIcon = new System.Windows.Forms.NotifyIcon();
- statusBarIcon.Text = "Tai! [数据加载中...请稍后]";
+ statusBarIcon.Text = "Tai! [加载中,请稍后...]";
Stream iconStream = GetResourceStream(new Uri("pack://application:,,,/Tai;component/Resources/Icons/taibusy.ico")).Stream;
statusBarIcon.Icon = new Icon(iconStream);
//statusBarIcon.Icon = System.Drawing.Icon.ExtractAssociatedIcon(System.Reflection.Assembly.GetEntryAssembly().ManifestModule.Name);
@@ -130,7 +130,7 @@ namespace UI
}
private void NotifyIcon_MouseClick(object sender, System.Windows.Forms.MouseEventArgs e)
{
- if (e.Button == System.Windows.Forms.MouseButtons.Right && !SQLiteBuilder.IsSelfChecking)
+ if (e.Button == System.Windows.Forms.MouseButtons.Right && !AppState.IsLoading)
{
//右键单击弹出托盘菜单
contextMenu.IsOpen = true;
@@ -138,7 +138,7 @@ namespace UI
}
private void NotifyIcon_MouseDoubleClick(object sender, System.Windows.Forms.MouseEventArgs e)
{
- if (e.Button == System.Windows.Forms.MouseButtons.Left && !SQLiteBuilder.IsSelfChecking)
+ if (e.Button == System.Windows.Forms.MouseButtons.Left && !AppState.IsLoading)
{
//双击托盘图标显示主窗口
ShowMainWindow();
@@ -271,7 +271,7 @@ namespace UI
{
await Task.Run(() =>
{
- while (SQLiteBuilder.IsSelfChecking)
+ while (AppState.IsLoading)
{
}
statusBarIcon.Text = "Tai!";