Skip to content

Commit 63c81b3

Browse files
committed
simplify the tray icon
1 parent 07a4182 commit 63c81b3

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

src/Starward/Features/ViewHost/SystemTrayWindow.xaml.cs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
using Starward.Features.Setting;
77
using Starward.Frameworks;
88
using Starward.Helpers;
9-
using System;
10-
using System.IO;
119
using Vanara.PInvoke;
1210
using Windows.Foundation;
1311

@@ -68,11 +66,9 @@ private void SetTrayIcon()
6866
{
6967
try
7068
{
71-
string icon = Path.Combine(AppContext.BaseDirectory, "Assets", "logo.ico");
72-
if (File.Exists(icon))
73-
{
74-
trayIcon.Icon = new(icon);
75-
}
69+
nint hInstance = Kernel32.GetModuleHandle(null).DangerousGetHandle();
70+
nint hIcon = User32.LoadIcon(hInstance, "#32512").DangerousGetHandle();
71+
trayIcon.Icon = System.Drawing.Icon.FromHandle(hIcon);
7672
}
7773
catch { }
7874
}

src/Starward/Features/ViewHost/WelcomeView.xaml.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,10 @@ private void InitializeDefaultUserDataFolder()
8888
}
8989
else
9090
{
91-
#if DEBUG || DEV
91+
#if DEBUG
9292
UserDataFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Starward");
9393
#else
94-
UserDataFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Starward");
94+
UserDataFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "Starward");
9595
#endif
9696
}
9797
}

0 commit comments

Comments
 (0)