Sync Avalonia management features and separate desktop instances

This commit is contained in:
tongtong committed 2026-11-20 10:32:47 +08:00
1 parent 0a04d5990f
commit 8d3dbe296a
12 files changed
+157 -15

No files matched your search

+4 -4
View File
@@ -2,7 +2,7 @@ using System.Runtime.InteropServices;
namespace Ads.Desktop;
/// <summary>Shares the Windows desktop UI lease with Flutter, including tray mode.</summary>
/// <summary>Owns the Avalonia Windows desktop UI lease, including tray mode.</summary>
internal sealed class DesktopInstance : IDisposable
{
private readonly Mutex mutex;
@@ -10,10 +10,10 @@ internal sealed class DesktopInstance : IDisposable
private RegisteredWaitHandle? registration;
public bool Primary { get; }
public DesktopInstance()
public DesktopInstance(string scope = @"Local\TTSTD.ADS.Avalonia")
{
activation = new EventWaitHandle(false, EventResetMode.AutoReset, @"Local\TTSTD.ADS.Desktop.Activate");
mutex = new Mutex(true, @"Local\TTSTD.ADS.Desktop.Instance", out var primary);
activation = new EventWaitHandle(false, EventResetMode.AutoReset, scope + ".Activate");
mutex = new Mutex(true, scope + ".Instance", out var primary);
Primary = primary;
}