mirror of
https://github.com/2dust/v2rayN.git
synced 2025-08-26 21:06:56 +00:00
Merge branch '2dust:master' into master
This commit is contained in:
commit
5028b4b52e
5 changed files with 23 additions and 12 deletions
|
@ -4,7 +4,7 @@
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<Version>7.0.7</Version>
|
<Version>7.0.8</Version>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
@ -69,11 +69,12 @@ public partial class App : Application
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void MenuExit_Click(object? sender, EventArgs e)
|
private async void MenuExit_Click(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
|
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
|
||||||
{
|
{
|
||||||
Locator.Current.GetService<MainWindowViewModel>()?.MyAppExitAsync(false);
|
var service = Locator.Current.GetService<MainWindowViewModel>();
|
||||||
|
if (service != null) await service.MyAppExitAsync(false);
|
||||||
|
|
||||||
desktop.Shutdown();
|
desktop.Shutdown();
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,6 @@ using DialogHostAvalonia;
|
||||||
using MsBox.Avalonia.Enums;
|
using MsBox.Avalonia.Enums;
|
||||||
using ReactiveUI;
|
using ReactiveUI;
|
||||||
using Splat;
|
using Splat;
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Reactive.Disposables;
|
using System.Reactive.Disposables;
|
||||||
using v2rayN.Desktop.Common;
|
using v2rayN.Desktop.Common;
|
||||||
|
|
||||||
|
@ -30,7 +29,6 @@ namespace v2rayN.Desktop.Views
|
||||||
_config = AppHandler.Instance.Config;
|
_config = AppHandler.Instance.Config;
|
||||||
_manager = new WindowNotificationManager(TopLevel.GetTopLevel(this)) { MaxItems = 3, Position = NotificationPosition.BottomRight };
|
_manager = new WindowNotificationManager(TopLevel.GetTopLevel(this)) { MaxItems = 3, Position = NotificationPosition.BottomRight };
|
||||||
|
|
||||||
this.Closing += MainWindow_Closing;
|
|
||||||
this.KeyDown += MainWindow_KeyDown;
|
this.KeyDown += MainWindow_KeyDown;
|
||||||
menuSettingsSetUWP.Click += menuSettingsSetUWP_Click;
|
menuSettingsSetUWP.Click += menuSettingsSetUWP_Click;
|
||||||
menuPromotion.Click += menuPromotion_Click;
|
menuPromotion.Click += menuPromotion_Click;
|
||||||
|
@ -274,10 +272,22 @@ namespace v2rayN.Desktop.Views
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void MainWindow_Closing(object? sender, CancelEventArgs e)
|
protected override async void OnClosing(WindowClosingEventArgs e)
|
||||||
{
|
{
|
||||||
|
Logging.SaveLog("OnClosing -> " + e.CloseReason.ToString());
|
||||||
|
|
||||||
|
switch (e.CloseReason)
|
||||||
|
{
|
||||||
|
case WindowCloseReason.OwnerWindowClosing or WindowCloseReason.WindowClosing:
|
||||||
e.Cancel = true;
|
e.Cancel = true;
|
||||||
ShowHideWindow(false);
|
ShowHideWindow(false);
|
||||||
|
break;
|
||||||
|
case WindowCloseReason.ApplicationShutdown or WindowCloseReason.OSShutdown:
|
||||||
|
await ViewModel?.MyAppExitAsync(true);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
base.OnClosing(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void MainWindow_KeyDown(object? sender, KeyEventArgs e)
|
private async void MainWindow_KeyDown(object? sender, KeyEventArgs e)
|
||||||
|
|
|
@ -270,11 +270,11 @@ namespace v2rayN.Views
|
||||||
StorageUI();
|
StorageUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Current_SessionEnding(object sender, SessionEndingCancelEventArgs e)
|
private async void Current_SessionEnding(object sender, SessionEndingCancelEventArgs e)
|
||||||
{
|
{
|
||||||
Logging.SaveLog("Current_SessionEnding");
|
Logging.SaveLog("Current_SessionEnding");
|
||||||
StorageUI();
|
StorageUI();
|
||||||
ViewModel?.MyAppExitAsync(true);
|
await ViewModel?.MyAppExitAsync(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void MainWindow_PreviewKeyDown(object sender, KeyEventArgs e)
|
private void MainWindow_PreviewKeyDown(object sender, KeyEventArgs e)
|
||||||
|
|
|
@ -100,11 +100,11 @@ namespace v2rayN.Views
|
||||||
return await Task.FromResult(true);
|
return await Task.FromResult(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void menuExit_Click(object sender, RoutedEventArgs e)
|
private async void menuExit_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
tbNotify.Dispose();
|
tbNotify.Dispose();
|
||||||
var service = Locator.Current.GetService<MainWindowViewModel>();
|
var service = Locator.Current.GetService<MainWindowViewModel>();
|
||||||
if (service != null) service.MyAppExitAsync(false);
|
if (service != null) await service.MyAppExitAsync(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void txtRunningInfoDisplay_MouseDoubleClick(object sender, MouseButtonEventArgs e)
|
private void txtRunningInfoDisplay_MouseDoubleClick(object sender, MouseButtonEventArgs e)
|
||||||
|
|
Loading…
Reference in a new issue