From b74ddc0b433568dfc7993900c50b999fec6224ab Mon Sep 17 00:00:00 2001 From: 2dust <31833384+2dust@users.noreply.github.com> Date: Thu, 17 Oct 2024 15:29:23 +0800 Subject: [PATCH] Adjust Resources --- v2rayN/v2rayN.Desktop/{ => Assets}/v2rayN.ico | Bin .../v2rayN.Desktop/ViewModels/AppViewModel.cs | 98 ------------------ .../v2rayN.Desktop/Views/ProfilesView.axaml | 4 +- .../Views/ThemeSettingView.axaml | 16 +-- v2rayN/v2rayN.Desktop/v2rayN.Desktop.csproj | 4 +- v2rayN/v2rayN/{ => Resources}/v2rayN.ico | Bin v2rayN/v2rayN/v2rayN.csproj | 8 +- 7 files changed, 8 insertions(+), 122 deletions(-) rename v2rayN/v2rayN.Desktop/{ => Assets}/v2rayN.ico (100%) delete mode 100644 v2rayN/v2rayN.Desktop/ViewModels/AppViewModel.cs rename v2rayN/v2rayN/{ => Resources}/v2rayN.ico (100%) diff --git a/v2rayN/v2rayN.Desktop/v2rayN.ico b/v2rayN/v2rayN.Desktop/Assets/v2rayN.ico similarity index 100% rename from v2rayN/v2rayN.Desktop/v2rayN.ico rename to v2rayN/v2rayN.Desktop/Assets/v2rayN.ico diff --git a/v2rayN/v2rayN.Desktop/ViewModels/AppViewModel.cs b/v2rayN/v2rayN.Desktop/ViewModels/AppViewModel.cs deleted file mode 100644 index 4b56a9a56c..0000000000 --- a/v2rayN/v2rayN.Desktop/ViewModels/AppViewModel.cs +++ /dev/null @@ -1,98 +0,0 @@ -using Avalonia; -using Avalonia.Controls.ApplicationLifetimes; -using ReactiveUI; -using Splat; -using System.Reactive; -using v2rayN.Desktop.Common; - -namespace v2rayN.Desktop.ViewModels -{ - public class AppViewModel : MyReactiveObject - { - public ReactiveCommand SystemProxyClearCmd { get; } - public ReactiveCommand SystemProxySetCmd { get; } - public ReactiveCommand SystemProxyNothingCmd { get; } - public ReactiveCommand AddServerViaClipboardCmd { get; } - public ReactiveCommand SubUpdateCmd { get; } - public ReactiveCommand SubUpdateViaProxyCmd { get; } - public ReactiveCommand ExitCmd { get; } - - public AppViewModel() - { - _config = AppHandler.Instance.Config; - - SystemProxyClearCmd = ReactiveCommand.CreateFromTask(async () => - { - await SetListenerType(ESysProxyType.ForcedClear); - }); - SystemProxySetCmd = ReactiveCommand.CreateFromTask(async () => - { - await SetListenerType(ESysProxyType.ForcedChange); - }); - SystemProxyNothingCmd = ReactiveCommand.CreateFromTask(async () => - { - await SetListenerType(ESysProxyType.Unchanged); - }); - - AddServerViaClipboardCmd = ReactiveCommand.CreateFromTask(async () => - { - await AddServerViaClipboard(); - }); - - SubUpdateCmd = ReactiveCommand.CreateFromTask(async () => - { - await UpdateSubscriptionProcess(false); - }); - SubUpdateViaProxyCmd = ReactiveCommand.CreateFromTask(async () => - { - await UpdateSubscriptionProcess(true); - }); - - ExitCmd = ReactiveCommand.CreateFromTask(async () => - { - await Exit(); - }); - } - - private async Task SetListenerType(ESysProxyType type) - { - if (_config.systemProxyItem.sysProxyType == type) - { - return; - } - - var service = Locator.Current.GetService(); - if (service != null) await service.SetListenerType(type); - } - - private async Task AddServerViaClipboard() - { - if (Application.Current?.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) - { - if (desktop.MainWindow != null) - { - var clipboardData = await AvaUtils.GetClipboardData(desktop.MainWindow); - var service = Locator.Current.GetService(); - if (service != null) await service.AddServerViaClipboardAsync(clipboardData); - } - } - } - - private async Task UpdateSubscriptionProcess(bool blProxy) - { - var service = Locator.Current.GetService(); - if (service != null) await service.UpdateSubscriptionProcess("", blProxy); - } - - private async Task Exit() - { - if (Application.Current?.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) - { - var service = Locator.Current.GetService(); - if (service != null) await service.MyAppExitAsync(false); - - desktop.Shutdown(); - } - } - } -} \ No newline at end of file diff --git a/v2rayN/v2rayN.Desktop/Views/ProfilesView.axaml b/v2rayN/v2rayN.Desktop/Views/ProfilesView.axaml index 6adffd7d28..53e0e305c5 100644 --- a/v2rayN/v2rayN.Desktop/Views/ProfilesView.axaml +++ b/v2rayN/v2rayN.Desktop/Views/ProfilesView.axaml @@ -170,10 +170,10 @@ Content="{x:Static resx:ResUI.TipActiveServer}" IsVisible="{Binding isActive}" Theme="{StaticResource TagLabel}" /> -