Skip to content

Commit 0cb9c9e

Browse files
committed
Reduce startup time by running event scheduler as background task
1 parent 7a7d1e3 commit 0cb9c9e

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

src/AppContext.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
using System;
66
using System.Reflection;
7+
using System.Threading.Tasks;
78
using System.Windows.Forms;
89

910
namespace WinDynamicDesktop
@@ -26,13 +27,16 @@ public AppContext(string[] args) : base(new HiddenForm())
2627
ipcManager.ProcessArgs(args);
2728

2829
InitializeTrayIcon();
29-
LocationManager.Initialize();
3030
ThemeManager.Initialize();
3131
ScriptManager.Initialize();
3232

33-
scheduler.RunAndUpdateLocation();
34-
LaunchSequence.NextStep();
35-
UpdateChecker.Initialize();
33+
Task.Run(() =>
34+
{
35+
LocationManager.Initialize();
36+
scheduler.RunAndUpdateLocation();
37+
MainForm.Invoke(() => LaunchSequence.NextStep());
38+
UpdateChecker.Initialize();
39+
});
3640
}
3741

3842
private void CheckSingleInstance(string[] args)

src/ConfigMigrator.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,11 @@ private static DateTime SafeParse(string dateTime) // Added 2020-05-21
116116

117117
private static void UpdateToVersion4(string jsonText) // Added 2020-01-01
118118
{
119+
if (jsonText.IndexOf("\"changeSystemTheme\"") == -1)
120+
{
121+
return;
122+
}
123+
119124
OldAppConfigV3 oldSettings;
120125
try
121126
{

0 commit comments

Comments
 (0)