|
|
|
@ -7,6 +7,7 @@ using Avalonia.Interactivity;
|
|
|
|
|
using Avalonia.ReactiveUI; |
|
|
|
|
using Avalonia.Threading; |
|
|
|
|
using DialogHostAvalonia; |
|
|
|
|
using MsBox.Avalonia.Enums; |
|
|
|
|
using ReactiveUI; |
|
|
|
|
using Splat; |
|
|
|
|
using System.ComponentModel; |
|
|
|
@ -28,12 +29,11 @@ namespace v2rayN.Desktop.Views
|
|
|
|
|
|
|
|
|
|
_config = AppHandler.Instance.Config; |
|
|
|
|
_manager = new WindowNotificationManager(TopLevel.GetTopLevel(this)) { MaxItems = 3, Position = NotificationPosition.BottomRight }; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.Closing += MainWindow_Closing; |
|
|
|
|
this.KeyDown += MainWindow_KeyDown; |
|
|
|
|
menuSettingsSetUWP.Click += menuSettingsSetUWP_Click; |
|
|
|
|
menuPromotion.Click += menuPromotion_Click; |
|
|
|
|
menuClose.Click += menuClose_Click; |
|
|
|
|
menuCheckUpdate.Click += MenuCheckUpdate_Click; |
|
|
|
|
menuBackupAndRestore.Click += MenuBackupAndRestore_Click; |
|
|
|
|
|
|
|
|
@ -80,6 +80,7 @@ namespace v2rayN.Desktop.Views
|
|
|
|
|
|
|
|
|
|
this.BindCommand(ViewModel, vm => vm.ReloadCmd, v => v.menuReload).DisposeWith(disposables); |
|
|
|
|
this.OneWayBind(ViewModel, vm => vm.BlReloadEnabled, v => v.menuReload.IsEnabled).DisposeWith(disposables); |
|
|
|
|
this.BindCommand(ViewModel, vm => vm.ExitCmd, v => v.menuClose).DisposeWith(disposables); |
|
|
|
|
|
|
|
|
|
switch (_config.UiItem.MainGirdOrientation) |
|
|
|
|
{ |
|
|
|
@ -242,6 +243,14 @@ namespace v2rayN.Desktop.Views
|
|
|
|
|
Locator.Current.GetService<ProfilesViewModel>()?.AutofitColumnWidthAsync(), |
|
|
|
|
DispatcherPriority.Default); |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
case EViewAction.ShowYesNo: |
|
|
|
|
if (await UI.ShowYesNo(this, ResUI.menuExitTips) == ButtonResult.No) |
|
|
|
|
{ |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
StorageUI(); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return await Task.FromResult(true); |
|
|
|
@ -304,12 +313,6 @@ namespace v2rayN.Desktop.Views
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void menuClose_Click(object? sender, RoutedEventArgs e) |
|
|
|
|
{ |
|
|
|
|
StorageUI(); |
|
|
|
|
ShowHideWindow(false); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void menuPromotion_Click(object? sender, RoutedEventArgs e) |
|
|
|
|
{ |
|
|
|
|
Utils.ProcessStart($"{Utils.Base64Decode(Global.PromotionUrl)}?t={DateTime.Now.Ticks}"); |
|
|
|
@ -376,8 +379,16 @@ namespace v2rayN.Desktop.Views
|
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
this.Hide(); |
|
|
|
|
if (Utils.IsWindows()) |
|
|
|
|
{ |
|
|
|
|
this.Hide(); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
this.WindowState = WindowState.Minimized; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
_config.UiItem.ShowInTaskbar = bl; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|