optimized connections

This commit is contained in:
2dust
2022-10-11 20:43:45 +08:00
parent cdfaccc038
commit 6db357fa02
4 changed files with 46 additions and 21 deletions

View File

@@ -36,9 +36,8 @@ namespace clashN.Mode
public string systemProxyExceptions { get; set; } public string systemProxyExceptions { get; set; }
public string systemProxyAdvancedProtocol { get; set; } public string systemProxyAdvancedProtocol { get; set; }
public int autoUpdateInterval { get; set; } = 0; public int autoUpdateSubInterval { get; set; } = 10;
public int autoUpdateSubInterval { get; set; } = 0; public int autoDelayTestInterval { get; set; } = 10;
public int autoDelayTestInterval { get; set; } = 0;
public bool enableSecurityProtocolTls13 { get; set; } public bool enableSecurityProtocolTls13 { get; set; }

View File

@@ -133,8 +133,8 @@ namespace clashN.ViewModels
model.time = sp.TotalSeconds < 0 ? 1 : sp.TotalSeconds; model.time = sp.TotalSeconds < 0 ? 1 : sp.TotalSeconds;
model.upload = item.upload; model.upload = item.upload;
model.download = item.download; model.download = item.download;
model.uploadTraffic = Utils.HumanFy(item.upload); model.uploadTraffic = $"<22><> {Utils.HumanFy(item.upload)}";
model.downloadTraffic = Utils.HumanFy(item.download); model.downloadTraffic = $"<22><> {Utils.HumanFy(item.download)}";
model.elapsed = sp.ToString(@"hh\:mm\:ss"); model.elapsed = sp.ToString(@"hh\:mm\:ss");
model.chain = item.chains.Count > 0 ? item.chains[0] : String.Empty; model.chain = item.chains.Count > 0 ? item.chains[0] : String.Empty;

View File

@@ -23,6 +23,7 @@
<materialDesign:Chip <materialDesign:Chip
x:Name="chipCount" x:Name="chipCount"
Height="20" Height="20"
IsEnabled="False"
Style="{StaticResource ListItemChip}" /> Style="{StaticResource ListItemChip}" />
</StackPanel> </StackPanel>
<ToolBarTray Margin="0,8,0,8" DockPanel.Dock="Top"> <ToolBarTray Margin="0,8,0,8" DockPanel.Dock="Top">
@@ -58,6 +59,7 @@
</ToolBarTray> </ToolBarTray>
<ListView <ListView
x:Name="lstConnections" x:Name="lstConnections"
HorizontalContentAlignment="Stretch"
BorderThickness="0" BorderThickness="0"
ItemContainerStyle="{StaticResource lvItemSelected}" ItemContainerStyle="{StaticResource lvItemSelected}"
ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.HorizontalScrollBarVisibility="Disabled"
@@ -75,8 +77,16 @@
</ListView.ItemsPanel> </ListView.ItemsPanel>
<ListView.ItemTemplate> <ListView.ItemTemplate>
<DataTemplate> <DataTemplate>
<materialDesign:Card MinWidth="800" materialDesign:UniformCornerRadius="8"> <StackPanel>
<DockPanel> <DockPanel>
<Button
x:Name="btnClose"
Margin="8,0"
Click="btnClose_Click"
Content="{materialDesign:PackIcon Kind=Close}"
DockPanel.Dock="Left"
IsEnabled="{Binding Path=IsSelected, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ListViewItem}}}"
Style="{StaticResource MaterialDesignFloatingActionMiniButton}" />
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
@@ -93,24 +103,35 @@
Grid.Row="1" Grid.Row="1"
HorizontalAlignment="Left" HorizontalAlignment="Left"
Orientation="Horizontal"> Orientation="Horizontal">
<materialDesign:Chip Content="{Binding network}" Style="{StaticResource ListItemChip}" /> <materialDesign:Chip
<materialDesign:Chip Content="{Binding type}" Style="{StaticResource ListItemChip}" /> Content="{Binding network}"
<materialDesign:Chip Content="{Binding chain}" Style="{StaticResource ListItemChip}" /> IsEnabled="False"
<materialDesign:Chip Content="{Binding uploadTraffic}" Style="{StaticResource ListItemChip}"> Style="{StaticResource ListItemChip}" />
<materialDesign:Chip.Icon> <materialDesign:Chip
<materialDesign:PackIcon Kind="ArrowUpThin" /> Content="{Binding type}"
</materialDesign:Chip.Icon> IsEnabled="False"
</materialDesign:Chip> Style="{StaticResource ListItemChip}" />
<materialDesign:Chip Content="{Binding downloadTraffic}" Style="{StaticResource ListItemChip}"> <materialDesign:Chip
<materialDesign:Chip.Icon> Content="{Binding chain}"
<materialDesign:PackIcon Kind="ArrowDownThin" /> IsEnabled="False"
</materialDesign:Chip.Icon> Style="{StaticResource ListItemChip}" />
</materialDesign:Chip> <materialDesign:Chip
<materialDesign:Chip Content="{Binding elapsed}" Style="{StaticResource ListItemChip}" /> Content="{Binding uploadTraffic}"
IsEnabled="False"
Style="{StaticResource ListItemChip}" />
<materialDesign:Chip
Content="{Binding downloadTraffic}"
IsEnabled="False"
Style="{StaticResource ListItemChip}" />
<materialDesign:Chip
Content="{Binding elapsed}"
IsEnabled="False"
Style="{StaticResource ListItemChip}" />
</StackPanel> </StackPanel>
</Grid> </Grid>
</DockPanel> </DockPanel>
</materialDesign:Card> <Separator />
</StackPanel>
</DataTemplate> </DataTemplate>
</ListView.ItemTemplate> </ListView.ItemTemplate>
</ListView> </ListView>

View File

@@ -28,5 +28,10 @@ namespace clashN.Views
this.Bind(ViewModel, vm => vm.AutoRefresh, v => v.togAutoRefresh.IsChecked).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.AutoRefresh, v => v.togAutoRefresh.IsChecked).DisposeWith(disposables);
}); });
} }
private void btnClose_Click(object sender, System.Windows.RoutedEventArgs e)
{
ViewModel?.ClashConnectionClose(false);
}
} }
} }