Tray notification icon dot

This commit is contained in:
Natsumi
2025-10-30 01:16:17 +11:00
parent 814a66abea
commit 3836b9b4ce
15 changed files with 90 additions and 35 deletions

View File

@@ -216,5 +216,10 @@ namespace VRCX
using var client = MainForm.Instance.Browser.GetDevToolsClient();
_ = client.Network.SetUserAgentOverrideAsync(Program.Version);
}
public override void SetTrayIconNotification(bool notify)
{
MainForm.Instance.BeginInvoke(new MethodInvoker(() => { MainForm.Instance.SetTrayIconNotification(notify); }));
}
}
}

View File

@@ -14,6 +14,7 @@ namespace VRCX
public abstract void SetZoom(double zoomLevel);
public abstract Task<double> GetZoom();
public abstract void DesktopNotification(string BoldText, string Text = "", string Image = "");
public abstract void SetTrayIconNotification(bool notify);
public abstract void RestartApplication(bool isUpgrade);
public abstract bool CheckForUpdateExe();

View File

@@ -143,5 +143,9 @@ namespace VRCX
public override void SetUserAgent()
{
}
public override void SetTrayIconNotification(bool notify)
{
}
}
}

View File

@@ -7,7 +7,7 @@
using System;
using System.Diagnostics.CodeAnalysis;
using System.Drawing;
using System.Reflection;
using System.IO;
using System.Windows.Forms;
using CefSharp;
using CefSharp.WinForms;
@@ -22,6 +22,8 @@ namespace VRCX
public static NativeWindow nativeWindow;
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
public ChromiumWebBrowser Browser;
private readonly Icon _appIcon;
private readonly Icon _appIconNoty;
private readonly Timer _saveTimer;
private int LastLocationX;
private int LastLocationY;
@@ -41,10 +43,11 @@ namespace VRCX
_saveTimer.Tick += SaveTimer_Tick;
try
{
var location = Assembly.GetExecutingAssembly().Location;
var icon = Icon.ExtractAssociatedIcon(location);
Icon = icon;
TrayIcon.Icon = icon;
var path = Path.GetDirectoryName(Environment.ProcessPath) ?? string.Empty;
_appIcon = new Icon(Path.Combine(path, "VRCX.ico"));
_appIconNoty = new Icon(Path.Combine(path, "VRCX_notify.ico"));
Icon = _appIcon;
TrayIcon.Icon = _appIcon;
}
catch (Exception ex)
{
@@ -246,5 +249,10 @@ namespace VRCX
SaveWindowState();
Application.Exit();
}
public void SetTrayIconNotification(bool notify)
{
TrayIcon.Icon = notify ? _appIconNoty : _appIcon;
}
}
}

View File

@@ -85,6 +85,9 @@
<Content Include="..\images\VRCX.ico">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\images\VRCX_notify.ico">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\images\VRCX.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
@@ -100,7 +103,7 @@
<PackageReference Include="Silk.NET.Direct3D11" Version="2.22.0" />
<PackageReference Include="Silk.NET.DXGI" Version="2.22.0" />
<PackageReference Include="Silk.NET.Windowing" Version="2.22.0" />
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.11" />
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.12" />
<PackageReference Include="SixLabors.ImageSharp.Drawing" Version="2.1.7" />
<PackageReference Include="SourceGear.sqlite3" Version="3.50.4.2" />
<PackageReference Include="System.Data.SQLite" Version="2.0.2" />

View File

@@ -64,6 +64,9 @@
<Content Include="..\images\VRCX.ico">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\images\VRCX_notify.ico">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\images\VRCX.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
@@ -74,7 +77,7 @@
<PackageReference Include="DiscordRichPresence" Version="1.6.1.70" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
<PackageReference Include="NLog" Version="6.0.5" />
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.11" />
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.12" />
<PackageReference Include="SixLabors.ImageSharp.Drawing" Version="2.1.7" />
<PackageReference Include="SourceGear.sqlite3" Version="3.50.4.2" />
<PackageReference Include="System.Data.SQLite" Version="2.0.2" />

View File

@@ -69,6 +69,9 @@
<Content Include="..\images\VRCX.ico">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\images\VRCX_notify.ico">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\images\VRCX.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
@@ -79,7 +82,7 @@
<PackageReference Include="DiscordRichPresence" Version="1.6.1.70" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
<PackageReference Include="NLog" Version="6.0.5" />
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.11" />
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.12" />
<PackageReference Include="SixLabors.ImageSharp.Drawing" Version="2.1.7" />
<PackageReference Include="SourceGear.sqlite3" Version="3.50.4.2" />
<PackageReference Include="System.Data.SQLite" Version="1.0.119" />