mirror of https://github.com/2dust/v2rayN
Improve the clash connection
parent
834e05999f
commit
9eb9898b61
|
@ -42,6 +42,23 @@
|
||||||
</Button.Content>
|
</Button.Content>
|
||||||
</Button>
|
</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
|
<TextBlock
|
||||||
Margin="8,0"
|
Margin="8,0"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
using Avalonia.Controls;
|
||||||
using Avalonia.Interactivity;
|
using Avalonia.Interactivity;
|
||||||
using Avalonia.ReactiveUI;
|
using Avalonia.ReactiveUI;
|
||||||
using Avalonia.Threading;
|
using Avalonia.Threading;
|
||||||
|
@ -12,6 +13,7 @@ namespace v2rayN.Desktop.Views
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
ViewModel = new ClashConnectionsViewModel(UpdateViewHandler);
|
ViewModel = new ClashConnectionsViewModel(UpdateViewHandler);
|
||||||
|
btnAutofitColumnWidth.Click += BtnAutofitColumnWidth_Click;
|
||||||
|
|
||||||
this.WhenActivated(disposables =>
|
this.WhenActivated(disposables =>
|
||||||
{
|
{
|
||||||
|
@ -42,6 +44,19 @@ namespace v2rayN.Desktop.Views
|
||||||
return await Task.FromResult(true);
|
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)
|
private void btnClose_Click(object? sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
ViewModel?.ClashConnectionClose(false);
|
ViewModel?.ClashConnectionClose(false);
|
||||||
|
|
|
@ -39,6 +39,16 @@
|
||||||
<materialDesign:PackIcon VerticalAlignment="Center" Kind="Close" />
|
<materialDesign:PackIcon VerticalAlignment="Center" Kind="Close" />
|
||||||
</Button>
|
</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
|
<TextBlock
|
||||||
Margin="{StaticResource MarginLeftRight8}"
|
Margin="{StaticResource MarginLeftRight8}"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
|
@ -56,7 +66,6 @@
|
||||||
BorderThickness="1"
|
BorderThickness="1"
|
||||||
CanUserAddRows="False"
|
CanUserAddRows="False"
|
||||||
CanUserResizeRows="False"
|
CanUserResizeRows="False"
|
||||||
CanUserSortColumns="False"
|
|
||||||
EnableRowVirtualization="True"
|
EnableRowVirtualization="True"
|
||||||
GridLinesVisibility="All"
|
GridLinesVisibility="All"
|
||||||
HeadersVisibility="Column"
|
HeadersVisibility="Column"
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
using ReactiveUI;
|
using ReactiveUI;
|
||||||
using System.Reactive.Disposables;
|
using System.Reactive.Disposables;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
using System.Windows.Threading;
|
using System.Windows.Threading;
|
||||||
|
|
||||||
namespace v2rayN.Views
|
namespace v2rayN.Views
|
||||||
|
@ -14,6 +15,7 @@ namespace v2rayN.Views
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
ViewModel = new ClashConnectionsViewModel(UpdateViewHandler);
|
ViewModel = new ClashConnectionsViewModel(UpdateViewHandler);
|
||||||
|
btnAutofitColumnWidth.Click += BtnAutofitColumnWidth_Click;
|
||||||
|
|
||||||
this.WhenActivated(disposables =>
|
this.WhenActivated(disposables =>
|
||||||
{
|
{
|
||||||
|
@ -45,6 +47,18 @@ namespace v2rayN.Views
|
||||||
return await Task.FromResult(true);
|
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)
|
private void btnClose_Click(object sender, System.Windows.RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
ViewModel?.ClashConnectionClose(false);
|
ViewModel?.ClashConnectionClose(false);
|
||||||
|
|
Loading…
Reference in New Issue