mirror of
https://github.com/2dust/v2rayN.git
synced 2026-11-16 01:15:01 +03:00
Update App.axaml.cs (#9421)
* Update App.axaml.cs * Update App.axaml.cs * Create MacOSAppHelper.cs * Update App.axaml.cs Removed unused macOS activation policy methods and constants. * Update and rename MacOSAppHelper.cs to MacAppUtils.cs * Update App.axaml.cs
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using v2rayN.Desktop.Common;
|
||||
using v2rayN.Desktop.Views;
|
||||
|
||||
namespace v2rayN.Desktop;
|
||||
@@ -24,11 +25,34 @@ public partial class App : Application
|
||||
|
||||
desktop.Exit += OnExit;
|
||||
desktop.MainWindow = new MainWindow();
|
||||
|
||||
if (OperatingSystem.IsMacOS())
|
||||
{
|
||||
Current?.TryGetFeature<IActivatableLifetime>()?.Activated += OnMacOSActivated;
|
||||
}
|
||||
}
|
||||
|
||||
base.OnFrameworkInitializationCompleted();
|
||||
}
|
||||
|
||||
private void OnMacOSActivated(object? sender, ActivatedEventArgs args)
|
||||
{
|
||||
if (args.Kind != ActivationKind.Reopen)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Dispatcher.UIThread.Post(() =>
|
||||
{
|
||||
((ApplicationLifetime as IClassicDesktopStyleApplicationLifetime)?.MainWindow as MainWindow)?.ShowHideWindow(true);
|
||||
|
||||
if (!AppManager.Instance.Config.UiItem.MacOSShowInDock)
|
||||
{
|
||||
MacAppUtils.SetActivationPolicyAccessory();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
|
||||
{
|
||||
if (e.ExceptionObject != null)
|
||||
|
||||
Reference in New Issue
Block a user