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 systemProxyAdvancedProtocol { get; set; }
public int autoUpdateInterval { get; set; } = 0;
public int autoUpdateSubInterval { get; set; } = 0;
public int autoDelayTestInterval { get; set; } = 0;
public int autoUpdateSubInterval { get; set; } = 10;
public int autoDelayTestInterval { get; set; } = 10;
public bool enableSecurityProtocolTls13 { get; set; }

View File

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

View File

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

View File

@@ -27,6 +27,11 @@ namespace clashN.Views
this.Bind(ViewModel, vm => vm.SortingSelected, v => v.cmbSorting.SelectedIndex).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);
}
}
}