Merge branch '2dust:master' into master

This commit is contained in:
fonaix 2024-12-03 08:43:21 +08:00 committed by GitHub
commit 893c04b3b7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 67 additions and 12 deletions

View file

@ -8,13 +8,13 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Downloader" Version="3.3.0" />
<PackageReference Include="Downloader" Version="3.3.1" />
<PackageReference Include="ReactiveUI" Version="20.1.63" />
<PackageReference Include="ReactiveUI.Fody" Version="19.5.41" />
<PackageReference Include="sqlite-net-pcl" Version="1.9.172" />
<PackageReference Include="Splat.NLog" Version="15.2.22" />
<PackageReference Include="WebDav.Client" Version="2.8.0" />
<PackageReference Include="YamlDotNet" Version="16.2.0" />
<PackageReference Include="YamlDotNet" Version="16.2.1" />
<PackageReference Include="QRCoder" Version="1.6.0" />
<PackageReference Include="CliWrap" Version="3.6.7" />
<PackageReference Include="SkiaSharp.QrCode" Version="0.7.0" />

View file

@ -639,6 +639,7 @@ namespace ServiceLib.ViewModels
NoticeHandler.Instance.Enqueue(ResUI.OperationSuccess);
RefreshServers();
SelectedMoveToGroup = null;
SelectedMoveToGroup = new();
//Reload();
}

View file

@ -42,6 +42,23 @@
</Button.Content>
</Button>
<Button
x:Name="btnAutofitColumnWidth"
Width="30"
Height="30"
Margin="8,0"
Classes="Success"
Theme="{DynamicResource BorderlessButton}"
ToolTip.Tip="{x:Static resx:ResUI.menuProfileAutofitColumnWidth}">
<Button.Content>
<PathIcon
Width="20"
Height="20"
Data="{StaticResource building_fit}"
Foreground="{DynamicResource ButtonDefaultTertiaryForeground}" />
</Button.Content>
</Button>
<TextBlock
Margin="8,0"
VerticalAlignment="Center"

View file

@ -1,3 +1,4 @@
using Avalonia.Controls;
using Avalonia.Interactivity;
using Avalonia.ReactiveUI;
using Avalonia.Threading;
@ -12,6 +13,7 @@ namespace v2rayN.Desktop.Views
{
InitializeComponent();
ViewModel = new ClashConnectionsViewModel(UpdateViewHandler);
btnAutofitColumnWidth.Click += BtnAutofitColumnWidth_Click;
this.WhenActivated(disposables =>
{
@ -42,6 +44,19 @@ namespace v2rayN.Desktop.Views
return await Task.FromResult(true);
}
private void BtnAutofitColumnWidth_Click(object? sender, RoutedEventArgs e)
{
AutofitColumnWidth();
}
private void AutofitColumnWidth()
{
foreach (var it in lstConnections.Columns)
{
it.Width = new DataGridLength(1, DataGridLengthUnitType.Auto);
}
}
private void btnClose_Click(object? sender, RoutedEventArgs e)
{
ViewModel?.ClashConnectionClose(false);

View file

@ -28,8 +28,8 @@
<PackageReference Include="Avalonia.ReactiveUI" Version="11.2.2" />
<PackageReference Include="DialogHost.Avalonia" Version="0.8.1" />
<PackageReference Include="MessageBox.Avalonia" Version="3.2.0" />
<PackageReference Include="Semi.Avalonia" Version="11.2.1" />
<PackageReference Include="Semi.Avalonia.DataGrid" Version="11.2.1" />
<PackageReference Include="Semi.Avalonia" Version="11.2.1.1" />
<PackageReference Include="Semi.Avalonia.DataGrid" Version="11.2.1.1" />
<PackageReference Include="ReactiveUI" Version="20.1.63" />
<PackageReference Include="ReactiveUI.Fody" Version="19.5.41" />
</ItemGroup>

View file

@ -39,6 +39,16 @@
<materialDesign:PackIcon VerticalAlignment="Center" Kind="Close" />
</Button>
<Button
x:Name="btnAutofitColumnWidth"
Width="24"
Height="24"
Margin="{StaticResource MarginLeftRight8}"
Style="{StaticResource MaterialDesignFloatingActionMiniLightButton}"
ToolTip="{x:Static resx:ResUI.menuProfileAutofitColumnWidth}">
<materialDesign:PackIcon VerticalAlignment="Center" Kind="ArrowSplitVertical" />
</Button>
<TextBlock
Margin="{StaticResource MarginLeftRight8}"
VerticalAlignment="Center"
@ -56,7 +66,6 @@
BorderThickness="1"
CanUserAddRows="False"
CanUserResizeRows="False"
CanUserSortColumns="False"
EnableRowVirtualization="True"
GridLinesVisibility="All"
HeadersVisibility="Column"

View file

@ -1,6 +1,7 @@
using ReactiveUI;
using System.Reactive.Disposables;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Threading;
namespace v2rayN.Views
@ -14,6 +15,7 @@ namespace v2rayN.Views
{
InitializeComponent();
ViewModel = new ClashConnectionsViewModel(UpdateViewHandler);
btnAutofitColumnWidth.Click += BtnAutofitColumnWidth_Click;
this.WhenActivated(disposables =>
{
@ -45,6 +47,18 @@ namespace v2rayN.Views
return await Task.FromResult(true);
}
private void BtnAutofitColumnWidth_Click(object sender, RoutedEventArgs e)
{
AutofitColumnWidth();
}
private void AutofitColumnWidth()
{
foreach (var it in lstConnections.Columns)
{
it.Width = new DataGridLength(1, DataGridLengthUnitType.Auto);
}
}
private void btnClose_Click(object sender, System.Windows.RoutedEventArgs e)
{
ViewModel?.ClashConnectionClose(false);

View file

@ -283,13 +283,6 @@ namespace v2rayN.Views
{
switch (e.Key)
{
case Key.V:
if (_backupAndRestoreView?.IsVisible == true) return;
var clipboardData = WindowsUtils.GetClipboardData();
ViewModel?.AddServerViaClipboardAsync(clipboardData);
break;
case Key.S:
ScanScreenTaskAsync().ContinueWith(_ => { });
break;

View file

@ -228,6 +228,12 @@ namespace v2rayN.Views
{
switch (e.Key)
{
case Key.V:
var clipboardData = WindowsUtils.GetClipboardData();
var service = Locator.Current.GetService<MainWindowViewModel>();
if (service != null) _ = service.AddServerViaClipboardAsync(clipboardData);
break;
case Key.A:
menuSelectAll_Click(null, null);
break;