mirror of
https://github.com/2dust/v2rayN.git
synced 2025-04-20 06:02:23 +00:00
Adjust Resources
This commit is contained in:
parent
d004c6860e
commit
b74ddc0b43
7 changed files with 8 additions and 122 deletions
Before Width: | Height: | Size: 60 KiB After Width: | Height: | Size: 60 KiB |
|
@ -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<Unit, Unit> SystemProxyClearCmd { get; }
|
|
||||||
public ReactiveCommand<Unit, Unit> SystemProxySetCmd { get; }
|
|
||||||
public ReactiveCommand<Unit, Unit> SystemProxyNothingCmd { get; }
|
|
||||||
public ReactiveCommand<Unit, Unit> AddServerViaClipboardCmd { get; }
|
|
||||||
public ReactiveCommand<Unit, Unit> SubUpdateCmd { get; }
|
|
||||||
public ReactiveCommand<Unit, Unit> SubUpdateViaProxyCmd { get; }
|
|
||||||
public ReactiveCommand<Unit, Unit> 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<StatusBarViewModel>();
|
|
||||||
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<MainWindowViewModel>();
|
|
||||||
if (service != null) await service.AddServerViaClipboardAsync(clipboardData);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task UpdateSubscriptionProcess(bool blProxy)
|
|
||||||
{
|
|
||||||
var service = Locator.Current.GetService<MainWindowViewModel>();
|
|
||||||
if (service != null) await service.UpdateSubscriptionProcess("", blProxy);
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task Exit()
|
|
||||||
{
|
|
||||||
if (Application.Current?.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
|
|
||||||
{
|
|
||||||
var service = Locator.Current.GetService<MainWindowViewModel>();
|
|
||||||
if (service != null) await service.MyAppExitAsync(false);
|
|
||||||
|
|
||||||
desktop.Shutdown();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -170,10 +170,10 @@
|
||||||
Content="{x:Static resx:ResUI.TipActiveServer}"
|
Content="{x:Static resx:ResUI.TipActiveServer}"
|
||||||
IsVisible="{Binding isActive}"
|
IsVisible="{Binding isActive}"
|
||||||
Theme="{StaticResource TagLabel}" />
|
Theme="{StaticResource TagLabel}" />
|
||||||
<Label
|
<TextBlock
|
||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Content="{Binding remarks}" />
|
Text="{Binding remarks}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</DataGridTemplateColumn.CellTemplate>
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
|
|
@ -27,46 +27,32 @@
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Grid.Row="0"
|
|
||||||
Grid.Column="0"
|
|
||||||
Width="100"
|
Width="100"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Classes="Margin8"
|
Classes="Margin8"
|
||||||
Text="{x:Static resx:ResUI.TbSettingsColorMode}" />
|
Text="{x:Static resx:ResUI.TbSettingsColorMode}" />
|
||||||
<ToggleSwitch
|
<ToggleSwitch x:Name="togDarkMode" Classes="Margin8" />
|
||||||
x:Name="togDarkMode"
|
|
||||||
Grid.Row="0"
|
|
||||||
Grid.Column="1"
|
|
||||||
Classes="Margin8" />
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Grid.Row="1"
|
|
||||||
Grid.Column="0"
|
|
||||||
Width="100"
|
Width="100"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Classes="Margin8"
|
Classes="Margin8"
|
||||||
Text="{x:Static resx:ResUI.TbSettingsFontSize}" />
|
Text="{x:Static resx:ResUI.TbSettingsFontSize}" />
|
||||||
<ComboBox
|
<ComboBox
|
||||||
x:Name="cmbCurrentFontSize"
|
x:Name="cmbCurrentFontSize"
|
||||||
Grid.Row="1"
|
|
||||||
Grid.Column="1"
|
|
||||||
Width="100"
|
Width="100"
|
||||||
Classes="Margin8" />
|
Classes="Margin8" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Grid.Row="2"
|
|
||||||
Grid.Column="0"
|
|
||||||
Width="100"
|
Width="100"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Classes="Margin8"
|
Classes="Margin8"
|
||||||
Text="{x:Static resx:ResUI.TbSettingsLanguage}" />
|
Text="{x:Static resx:ResUI.TbSettingsLanguage}" />
|
||||||
<ComboBox
|
<ComboBox
|
||||||
x:Name="cmbCurrentLanguage"
|
x:Name="cmbCurrentLanguage"
|
||||||
Grid.Row="2"
|
|
||||||
Grid.Column="1"
|
|
||||||
Width="100"
|
Width="100"
|
||||||
Classes="Margin8" />
|
Classes="Margin8" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<ApplicationIcon>v2rayN.ico</ApplicationIcon>
|
<ApplicationIcon>Assets\v2rayN.ico</ApplicationIcon>
|
||||||
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
|
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
|
||||||
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
|
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
@ -37,7 +37,7 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<EmbeddedResource Include="v2rayN.ico">
|
<EmbeddedResource Include="Assets\v2rayN.ico">
|
||||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
Before Width: | Height: | Size: 60 KiB After Width: | Height: | Size: 60 KiB |
|
@ -8,7 +8,7 @@
|
||||||
<UseWPF>true</UseWPF>
|
<UseWPF>true</UseWPF>
|
||||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<ApplicationIcon>v2rayN.ico</ApplicationIcon>
|
<ApplicationIcon>Resources\v2rayN.ico</ApplicationIcon>
|
||||||
<Copyright>Copyright © 2017-2024 (GPLv3)</Copyright>
|
<Copyright>Copyright © 2017-2024 (GPLv3)</Copyright>
|
||||||
<SupportedOSPlatformVersion>7.0</SupportedOSPlatformVersion>
|
<SupportedOSPlatformVersion>7.0</SupportedOSPlatformVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
@ -24,15 +24,13 @@
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<AdditionalFiles Include="app.manifest" />
|
<AdditionalFiles Include="app.manifest" />
|
||||||
<EmbeddedResource Include="v2rayN.ico">
|
<EmbeddedResource Include="Resources\v2rayN.ico">
|
||||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
<Resource Include="Resources\NotifyIcon1.ico" />
|
<Resource Include="Resources\NotifyIcon1.ico" />
|
||||||
<Resource Include="Resources\NotifyIcon2.ico" />
|
<Resource Include="Resources\NotifyIcon2.ico" />
|
||||||
<Resource Include="Resources\NotifyIcon3.ico" />
|
<Resource Include="Resources\NotifyIcon3.ico" />
|
||||||
<Resource Include="v2rayN.ico">
|
<Resource Include="Resources\v2rayN.ico" />
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
|
||||||
</Resource>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
Loading…
Reference in a new issue