Optimize connection function
This commit is contained in:
36
clashN/clashN/Resx/ResUI.Designer.cs
generated
36
clashN/clashN/Resx/ResUI.Designer.cs
generated
@@ -1528,6 +1528,15 @@ namespace clashN.Resx {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 Chain 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
public static string TbSortingChain {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("TbSortingChain", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找类似 Default 的本地化字符串。
|
/// 查找类似 Default 的本地化字符串。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -1564,6 +1573,15 @@ namespace clashN.Resx {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 Host 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
public static string TbSortingHost {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("TbSortingHost", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找类似 Name 的本地化字符串。
|
/// 查找类似 Name 的本地化字符串。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -1573,6 +1591,15 @@ namespace clashN.Resx {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 Network 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
public static string TbSortingNetwork {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("TbSortingNetwork", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找类似 Time 的本地化字符串。
|
/// 查找类似 Time 的本地化字符串。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -1582,6 +1609,15 @@ namespace clashN.Resx {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 Type 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
public static string TbSortingType {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("TbSortingType", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找类似 Upload Speed 的本地化字符串。
|
/// 查找类似 Upload Speed 的本地化字符串。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -652,4 +652,16 @@
|
|||||||
<data name="TbSystemProxyPac" xml:space="preserve">
|
<data name="TbSystemProxyPac" xml:space="preserve">
|
||||||
<value>Pac Mode</value>
|
<value>Pac Mode</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="TbSortingChain" xml:space="preserve">
|
||||||
|
<value>Chain</value>
|
||||||
|
</data>
|
||||||
|
<data name="TbSortingHost" xml:space="preserve">
|
||||||
|
<value>Host</value>
|
||||||
|
</data>
|
||||||
|
<data name="TbSortingNetwork" xml:space="preserve">
|
||||||
|
<value>Network</value>
|
||||||
|
</data>
|
||||||
|
<data name="TbSortingType" xml:space="preserve">
|
||||||
|
<value>Type</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -655,4 +655,16 @@
|
|||||||
<data name="TbSystemProxyPac" xml:space="preserve">
|
<data name="TbSystemProxyPac" xml:space="preserve">
|
||||||
<value>Pac模式</value>
|
<value>Pac模式</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="TbSortingChain" xml:space="preserve">
|
||||||
|
<value>路由链</value>
|
||||||
|
</data>
|
||||||
|
<data name="TbSortingHost" xml:space="preserve">
|
||||||
|
<value>主机</value>
|
||||||
|
</data>
|
||||||
|
<data name="TbSortingNetwork" xml:space="preserve">
|
||||||
|
<value>网络</value>
|
||||||
|
</data>
|
||||||
|
<data name="TbSortingType" xml:space="preserve">
|
||||||
|
<value>类型</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -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 = $"<EFBFBD><EFBFBD> {Utils.HumanFy(item.upload)}";
|
model.uploadTraffic = $"{Utils.HumanFy(item.upload)}";
|
||||||
model.downloadTraffic = $"<EFBFBD><EFBFBD> {Utils.HumanFy(item.download)}";
|
model.downloadTraffic = $"{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;
|
||||||
|
|
||||||
@@ -160,6 +160,9 @@ namespace clashN.ViewModels
|
|||||||
case 4:
|
case 4:
|
||||||
lstModel = lstModel.OrderBy(t => t.time).ToList();
|
lstModel = lstModel.OrderBy(t => t.time).ToList();
|
||||||
break;
|
break;
|
||||||
|
case 5:
|
||||||
|
lstModel = lstModel.OrderBy(t => t.host).ToList();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
_connectionItems.AddRange(lstModel);
|
_connectionItems.AddRange(lstModel);
|
||||||
|
|||||||
@@ -45,6 +45,7 @@
|
|||||||
<ComboBoxItem Content="{x:Static resx:ResUI.TbSortingUpTraffic}" />
|
<ComboBoxItem Content="{x:Static resx:ResUI.TbSortingUpTraffic}" />
|
||||||
<ComboBoxItem Content="{x:Static resx:ResUI.TbSortingDownTraffic}" />
|
<ComboBoxItem Content="{x:Static resx:ResUI.TbSortingDownTraffic}" />
|
||||||
<ComboBoxItem Content="{x:Static resx:ResUI.TbSortingTime}" />
|
<ComboBoxItem Content="{x:Static resx:ResUI.TbSortingTime}" />
|
||||||
|
<ComboBoxItem Content="{x:Static resx:ResUI.TbSortingHost}" />
|
||||||
</ComboBox>
|
</ComboBox>
|
||||||
<Separator />
|
<Separator />
|
||||||
<Button x:Name="btnConnectionCloseAll" ToolTip="{x:Static resx:ResUI.menuConnectionCloseAll}">
|
<Button x:Name="btnConnectionCloseAll" ToolTip="{x:Static resx:ResUI.menuConnectionCloseAll}">
|
||||||
@@ -64,83 +65,55 @@
|
|||||||
HorizontalAlignment="Left" />
|
HorizontalAlignment="Left" />
|
||||||
</ToolBar>
|
</ToolBar>
|
||||||
</ToolBarTray>
|
</ToolBarTray>
|
||||||
<ListView
|
<DataGrid
|
||||||
x:Name="lstConnections"
|
x:Name="lstConnections"
|
||||||
HorizontalContentAlignment="Stretch"
|
AutoGenerateColumns="False"
|
||||||
BorderThickness="0"
|
BorderThickness="1"
|
||||||
ItemContainerStyle="{StaticResource lvItemSelected}"
|
CanUserAddRows="False"
|
||||||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
|
CanUserResizeRows="False"
|
||||||
ScrollViewer.VerticalScrollBarVisibility="Auto">
|
CanUserSortColumns="False"
|
||||||
<ListView.ContextMenu>
|
EnableRowVirtualization="True"
|
||||||
|
GridLinesVisibility="All"
|
||||||
|
HeadersVisibility="Column"
|
||||||
|
IsReadOnly="True">
|
||||||
|
<DataGrid.ContextMenu>
|
||||||
<ContextMenu Style="{StaticResource DefMenu}">
|
<ContextMenu Style="{StaticResource DefMenu}">
|
||||||
<MenuItem x:Name="menuConnectionClose" Header="{x:Static resx:ResUI.menuConnectionClose}" />
|
<MenuItem x:Name="menuConnectionClose" Header="{x:Static resx:ResUI.menuConnectionClose}" />
|
||||||
<MenuItem x:Name="menuConnectionCloseAll" Header="{x:Static resx:ResUI.menuConnectionCloseAll}" />
|
<MenuItem x:Name="menuConnectionCloseAll" Header="{x:Static resx:ResUI.menuConnectionCloseAll}" />
|
||||||
</ContextMenu>
|
</ContextMenu>
|
||||||
</ListView.ContextMenu>
|
</DataGrid.ContextMenu>
|
||||||
<ListView.ItemsPanel>
|
<DataGrid.Columns>
|
||||||
<ItemsPanelTemplate>
|
<DataGridTextColumn
|
||||||
<StackPanel />
|
Width="300"
|
||||||
</ItemsPanelTemplate>
|
Binding="{Binding host}"
|
||||||
</ListView.ItemsPanel>
|
Header="{x:Static resx:ResUI.TbSortingHost}" />
|
||||||
<ListView.ItemTemplate>
|
<DataGridTextColumn
|
||||||
<DataTemplate>
|
Width="100"
|
||||||
<StackPanel>
|
Binding="{Binding network}"
|
||||||
<DockPanel>
|
Header="{x:Static resx:ResUI.TbSortingNetwork}" />
|
||||||
<Button
|
<DataGridTextColumn
|
||||||
x:Name="btnClose"
|
Width="100"
|
||||||
Margin="8,0"
|
Binding="{Binding type}"
|
||||||
Click="btnClose_Click"
|
Header="{x:Static resx:ResUI.TbSortingType}" />
|
||||||
Content="{materialDesign:PackIcon Kind=Close}"
|
<DataGridTextColumn
|
||||||
DockPanel.Dock="Left"
|
Width="200"
|
||||||
IsEnabled="{Binding Path=IsSelected, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ListViewItem}}}"
|
Binding="{Binding chain}"
|
||||||
Style="{StaticResource MaterialDesignFloatingActionMiniButton}" />
|
Header="{x:Static resx:ResUI.TbSortingChain}" />
|
||||||
<Grid>
|
<DataGridTextColumn
|
||||||
<Grid.RowDefinitions>
|
Width="100"
|
||||||
<RowDefinition Height="Auto" />
|
Binding="{Binding uploadTraffic}"
|
||||||
<RowDefinition Height="Auto" />
|
Header="{x:Static resx:ResUI.TbSortingUpTraffic}" />
|
||||||
</Grid.RowDefinitions>
|
<DataGridTextColumn
|
||||||
<StackPanel
|
Width="100"
|
||||||
Grid.Row="0"
|
Binding="{Binding downloadTraffic}"
|
||||||
Margin="8,0,8,0"
|
Header="{x:Static resx:ResUI.TbSortingDownTraffic}" />
|
||||||
HorizontalAlignment="Left"
|
<DataGridTextColumn
|
||||||
Orientation="Horizontal">
|
Width="100"
|
||||||
<TextBlock Style="{StaticResource ListItemSubTitle}" Text="{Binding host}" />
|
Binding="{Binding elapsed}"
|
||||||
</StackPanel>
|
Header="{x:Static resx:ResUI.TbSortingTime}" />
|
||||||
<StackPanel
|
|
||||||
Grid.Row="1"
|
</DataGrid.Columns>
|
||||||
HorizontalAlignment="Left"
|
</DataGrid>
|
||||||
Orientation="Horizontal">
|
|
||||||
<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>
|
|
||||||
</StackPanel>
|
|
||||||
</DataTemplate>
|
|
||||||
</ListView.ItemTemplate>
|
|
||||||
</ListView>
|
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
|
|
||||||
</reactiveui:ReactiveUserControl>
|
</reactiveui:ReactiveUserControl>
|
||||||
|
|||||||
Reference in New Issue
Block a user