mirror of https://github.com/2dust/v2rayN
Add clash display in the main interface
parent
e3c2a4b8da
commit
e963f9e349
|
@ -10,7 +10,6 @@ namespace v2rayN.Handler
|
|||
|
||||
private Dictionary<String, ProxiesItem> _proxies;
|
||||
public Dictionary<string, object> ProfileContent { get; set; }
|
||||
public bool ShowInTaskbar { get; set; } = true;
|
||||
|
||||
public void SetProxies(Dictionary<String, ProxiesItem> proxies)
|
||||
{
|
||||
|
|
|
@ -216,11 +216,12 @@ namespace v2rayN.Models
|
|||
public class ClashUIItem
|
||||
{
|
||||
public ERuleMode ruleMode { get; set; }
|
||||
public bool showInTaskbar { get; set; }
|
||||
public int proxiesSorting { get; set; }
|
||||
public bool proxiesAutoRefresh { get; set; }
|
||||
public int AutoDelayTestInterval { get; set; } = 10;
|
||||
public int proxiesAutoDelayTestInterval { get; set; } = 10;
|
||||
public int connectionsSorting { get; set; }
|
||||
public bool connectionsAutoRefresh { get; set; }
|
||||
|
||||
public int connectionsRefreshInterval { get; set; } = 2;
|
||||
}
|
||||
}
|
|
@ -36,11 +36,8 @@ namespace v2rayN.ViewModels
|
|||
[Reactive]
|
||||
public bool AutoRefresh { get; set; }
|
||||
|
||||
private int AutoRefreshInterval;
|
||||
|
||||
public ClashConnectionsViewModel()
|
||||
{
|
||||
AutoRefreshInterval = 10;
|
||||
SortingSelected = _config.clashUIItem.connectionsSorting;
|
||||
AutoRefresh = _config.clashUIItem.connectionsAutoRefresh;
|
||||
|
||||
|
@ -87,15 +84,26 @@ namespace v2rayN.ViewModels
|
|||
|
||||
private void Init()
|
||||
{
|
||||
Observable.Interval(TimeSpan.FromSeconds(AutoRefreshInterval))
|
||||
.Subscribe(x =>
|
||||
{
|
||||
if (!(AutoRefresh && ClashApiHandler.Instance.ShowInTaskbar))
|
||||
{
|
||||
return;
|
||||
}
|
||||
GetClashConnections();
|
||||
});
|
||||
var lastTime = DateTime.Now;
|
||||
|
||||
Observable.Interval(TimeSpan.FromSeconds(10))
|
||||
.Subscribe(x =>
|
||||
{
|
||||
if (!(AutoRefresh && _config.clashUIItem.showInTaskbar))
|
||||
{
|
||||
return;
|
||||
}
|
||||
var dtNow = DateTime.Now;
|
||||
if (_config.clashUIItem.connectionsRefreshInterval > 0)
|
||||
{
|
||||
if ((dtNow - lastTime).Minutes % _config.clashUIItem.connectionsRefreshInterval == 0)
|
||||
{
|
||||
GetClashConnections();
|
||||
lastTime = dtNow;
|
||||
}
|
||||
Thread.Sleep(1000);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void GetClashConnections()
|
||||
|
|
|
@ -434,8 +434,8 @@ namespace v2rayN.ViewModels
|
|||
var dicResult = JsonUtils.Deserialize<Dictionary<string, object>>(result);
|
||||
if (dicResult != null && dicResult.ContainsKey("delay"))
|
||||
{
|
||||
detail.delay = Convert.ToInt32(dicResult["delay"]);
|
||||
detail.delayName = $"{dicResult["delay"]}ms";
|
||||
detail.delay = Convert.ToInt32(dicResult["delay"].ToString());
|
||||
detail.delayName = $"{detail.delay}ms";
|
||||
}
|
||||
else if (dicResult != null && dicResult.ContainsKey("message"))
|
||||
{
|
||||
|
@ -459,27 +459,26 @@ namespace v2rayN.ViewModels
|
|||
|
||||
public void DelayTestTask()
|
||||
{
|
||||
var autoDelayTestTime = DateTime.Now;
|
||||
var lastTime = DateTime.Now;
|
||||
|
||||
Observable.Interval(TimeSpan.FromSeconds(60))
|
||||
.Subscribe(x =>
|
||||
{
|
||||
if (!(AutoRefresh && ClashApiHandler.Instance.ShowInTaskbar))
|
||||
if (!(AutoRefresh && _config.clashUIItem.showInTaskbar))
|
||||
{
|
||||
return;
|
||||
}
|
||||
var dtNow = DateTime.Now;
|
||||
|
||||
if (_config.clashUIItem.AutoDelayTestInterval > 0)
|
||||
if (_config.clashUIItem.proxiesAutoDelayTestInterval > 0)
|
||||
{
|
||||
if ((dtNow - autoDelayTestTime).Minutes % _config.clashUIItem.AutoDelayTestInterval == 0)
|
||||
if ((dtNow - lastTime).Minutes % _config.clashUIItem.proxiesAutoDelayTestInterval == 0)
|
||||
{
|
||||
ProxiesDelayTest();
|
||||
autoDelayTestTime = dtNow;
|
||||
lastTime = dtNow;
|
||||
}
|
||||
Thread.Sleep(1000);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
#endregion task
|
||||
|
|
|
@ -243,6 +243,9 @@ namespace v2rayN.ViewModels
|
|||
[Reactive]
|
||||
public string CurrentLanguage { get; set; }
|
||||
|
||||
[Reactive]
|
||||
public bool ShowCalshUI { get; set; }
|
||||
|
||||
#endregion UI
|
||||
|
||||
#region Init
|
||||
|
@ -569,6 +572,7 @@ namespace v2rayN.ViewModels
|
|||
AutoHideStartup();
|
||||
|
||||
_showInTaskbar = true;
|
||||
_config.clashUIItem.showInTaskbar = _showInTaskbar;
|
||||
}
|
||||
|
||||
private void Init()
|
||||
|
@ -1509,7 +1513,12 @@ namespace v2rayN.ViewModels
|
|||
Application.Current?.Dispatcher.Invoke((Action)(() =>
|
||||
{
|
||||
BlReloadEnabled = true;
|
||||
ShowCalshUI = (_config.runningCoreType is ECoreType.clash or ECoreType.clash_meta or ECoreType.mihomo);
|
||||
if (ShowCalshUI) {
|
||||
Locator.Current.GetService<ClashProxiesViewModel>()?.ProxiesReload();
|
||||
}
|
||||
}));
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -1680,6 +1689,7 @@ namespace v2rayN.ViewModels
|
|||
//Utile.RegWriteValue(Global.MyRegPath, Utile.WindowHwndKey, Convert.ToString((long)windowHandle));
|
||||
}
|
||||
_showInTaskbar = bl;
|
||||
_config.clashUIItem.showInTaskbar = _showInTaskbar;
|
||||
}
|
||||
|
||||
private void RestoreUI()
|
||||
|
|
|
@ -13,19 +13,7 @@
|
|||
d:DesignWidth="800"
|
||||
x:TypeArguments="vms:ClashConnectionsViewModel"
|
||||
mc:Ignorable="d">
|
||||
<DockPanel Margin="8">
|
||||
<StackPanel
|
||||
Margin="8,0,8,8"
|
||||
HorizontalAlignment="Left"
|
||||
DockPanel.Dock="Top"
|
||||
Orientation="Horizontal">
|
||||
<TextBlock Style="{StaticResource ModuleTitle}" Text="{x:Static resx:ResUI.TbConnections}" />
|
||||
<materialDesign:Chip
|
||||
x:Name="chipCount"
|
||||
Height="20"
|
||||
IsEnabled="False"
|
||||
Style="{StaticResource ListItemChip}" />
|
||||
</StackPanel>
|
||||
<DockPanel>
|
||||
<ToolBarTray Margin="0,8,0,8" DockPanel.Dock="Top">
|
||||
<ToolBar ClipToBounds="True" Style="{StaticResource MaterialDesignToolBar}">
|
||||
<Button Width="1" Visibility="Hidden">
|
||||
|
|
|
@ -18,7 +18,6 @@ namespace v2rayN.Views
|
|||
{
|
||||
this.OneWayBind(ViewModel, vm => vm.ConnectionItems, v => v.lstConnections.ItemsSource).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource, v => v.lstConnections.SelectedItem).DisposeWith(disposables);
|
||||
this.OneWayBind(ViewModel, vm => vm.ConnectionItems.Count, v => v.chipCount.Content).DisposeWith(disposables);
|
||||
|
||||
this.BindCommand(ViewModel, vm => vm.ConnectionCloseCmd, v => v.menuConnectionClose).DisposeWith(disposables);
|
||||
this.BindCommand(ViewModel, vm => vm.ConnectionCloseAllCmd, v => v.menuConnectionCloseAll).DisposeWith(disposables);
|
||||
|
|
|
@ -20,13 +20,7 @@
|
|||
<converters:DelayColorConverter x:Key="DelayColorConverter" />
|
||||
</UserControl.Resources>
|
||||
|
||||
<DockPanel Margin="8">
|
||||
<TextBlock
|
||||
Margin="8,0,8,8"
|
||||
DockPanel.Dock="Top"
|
||||
Style="{StaticResource ModuleTitle}"
|
||||
Text="{x:Static resx:ResUI.TbProxies}" />
|
||||
|
||||
<DockPanel>
|
||||
<ToolBarTray DockPanel.Dock="Top">
|
||||
<ToolBar
|
||||
HorizontalAlignment="Center"
|
||||
|
|
|
@ -437,6 +437,14 @@
|
|||
materialDesign:HintAssist.Hint="{x:Static resx:ResUI.MsgServerTitle}"
|
||||
materialDesign:TextFieldAssist.HasClearButton="True"
|
||||
Style="{StaticResource DefTextBox}" />
|
||||
<Button
|
||||
x:Name="btnShowCalshUI"
|
||||
Width="30"
|
||||
Height="30"
|
||||
Margin="20,0"
|
||||
Style="{StaticResource MaterialDesignFloatingActionMiniLightButton}">
|
||||
<materialDesign:PackIcon VerticalAlignment="Center" Kind="EyeOutline" />
|
||||
</Button>
|
||||
</WrapPanel>
|
||||
|
||||
<materialDesign:ColorZone
|
||||
|
@ -524,237 +532,240 @@
|
|||
<RowDefinition Height="10" />
|
||||
<RowDefinition Height="1*" />
|
||||
</Grid.RowDefinitions>
|
||||
<DataGrid
|
||||
x:Name="lstProfiles"
|
||||
Grid.Row="0"
|
||||
materialDesign:DataGridAssist.CellPadding="2,2"
|
||||
AutoGenerateColumns="False"
|
||||
BorderThickness="1"
|
||||
CanUserAddRows="False"
|
||||
CanUserResizeRows="False"
|
||||
CanUserSortColumns="False"
|
||||
EnableRowVirtualization="True"
|
||||
Focusable="True"
|
||||
GridLinesVisibility="All"
|
||||
HeadersVisibility="All"
|
||||
IsReadOnly="True"
|
||||
RowHeaderWidth="40"
|
||||
Style="{StaticResource DefDataGrid}">
|
||||
<DataGrid.InputBindings>
|
||||
<KeyBinding Command="ApplicationCommands.NotACommand" Gesture="Ctrl+C" />
|
||||
<KeyBinding Command="ApplicationCommands.NotACommand" Gesture="Ctrl+V" />
|
||||
<KeyBinding Command="ApplicationCommands.NotACommand" Gesture="Delete" />
|
||||
<KeyBinding Command="ApplicationCommands.NotACommand" Gesture="Enter" />
|
||||
</DataGrid.InputBindings>
|
||||
<DataGrid.ContextMenu>
|
||||
<ContextMenu Style="{StaticResource DefContextMenu}">
|
||||
<MenuItem
|
||||
x:Name="menuEditServer"
|
||||
Height="{StaticResource MenuItemHeight}"
|
||||
Header="{x:Static resx:ResUI.menuEditServer}" />
|
||||
<MenuItem
|
||||
x:Name="menuSetDefaultServer"
|
||||
Height="{StaticResource MenuItemHeight}"
|
||||
Header="{x:Static resx:ResUI.menuSetDefaultServer}" />
|
||||
<MenuItem
|
||||
x:Name="menuRemoveServer"
|
||||
Height="{StaticResource MenuItemHeight}"
|
||||
Header="{x:Static resx:ResUI.menuRemoveServer}" />
|
||||
<MenuItem
|
||||
x:Name="menuRemoveDuplicateServer"
|
||||
Height="{StaticResource MenuItemHeight}"
|
||||
Header="{x:Static resx:ResUI.menuRemoveDuplicateServer}" />
|
||||
<MenuItem
|
||||
x:Name="menuCopyServer"
|
||||
Height="{StaticResource MenuItemHeight}"
|
||||
Header="{x:Static resx:ResUI.menuCopyServer}" />
|
||||
<MenuItem
|
||||
x:Name="menuShareServer"
|
||||
Height="{StaticResource MenuItemHeight}"
|
||||
Header="{x:Static resx:ResUI.menuShareServer}" />
|
||||
<Separator />
|
||||
<MenuItem
|
||||
x:Name="menuMixedTestServer"
|
||||
Height="{StaticResource MenuItemHeight}"
|
||||
Header="{x:Static resx:ResUI.menuMixedTestServer}" />
|
||||
<MenuItem
|
||||
x:Name="menuTcpingServer"
|
||||
Height="{StaticResource MenuItemHeight}"
|
||||
Header="{x:Static resx:ResUI.menuTcpingServer}" />
|
||||
<MenuItem
|
||||
x:Name="menuRealPingServer"
|
||||
Height="{StaticResource MenuItemHeight}"
|
||||
Header="{x:Static resx:ResUI.menuRealPingServer}" />
|
||||
<MenuItem
|
||||
x:Name="menuSpeedServer"
|
||||
Height="{StaticResource MenuItemHeight}"
|
||||
Header="{x:Static resx:ResUI.menuSpeedServer}" />
|
||||
<MenuItem
|
||||
x:Name="menuSortServerResult"
|
||||
Height="{StaticResource MenuItemHeight}"
|
||||
Header="{x:Static resx:ResUI.menuSortServerResult}" />
|
||||
<Separator />
|
||||
<MenuItem
|
||||
x:Name="menuMoveToGroup"
|
||||
Height="{StaticResource MenuItemHeight}"
|
||||
Header="{x:Static resx:ResUI.menuMoveToGroup}">
|
||||
<MenuItem Height="Auto">
|
||||
<MenuItem.Header>
|
||||
<DockPanel>
|
||||
<ComboBox
|
||||
x:Name="cmbMoveToGroup"
|
||||
Width="200"
|
||||
materialDesign:HintAssist.Hint="{x:Static resx:ResUI.menuSubscription}"
|
||||
DisplayMemberPath="remarks"
|
||||
FontSize="{DynamicResource StdFontSize}"
|
||||
Style="{StaticResource MaterialDesignFilledComboBox}" />
|
||||
</DockPanel>
|
||||
</MenuItem.Header>
|
||||
<DockPanel Grid.Row="0">
|
||||
<ContentControl x:Name="tabClashUI" DockPanel.Dock="Right" />
|
||||
<DataGrid
|
||||
x:Name="lstProfiles"
|
||||
materialDesign:DataGridAssist.CellPadding="2,2"
|
||||
AutoGenerateColumns="False"
|
||||
BorderThickness="1"
|
||||
CanUserAddRows="False"
|
||||
CanUserResizeRows="False"
|
||||
CanUserSortColumns="False"
|
||||
EnableRowVirtualization="True"
|
||||
Focusable="True"
|
||||
GridLinesVisibility="All"
|
||||
HeadersVisibility="All"
|
||||
IsReadOnly="True"
|
||||
RowHeaderWidth="40"
|
||||
Style="{StaticResource DefDataGrid}">
|
||||
<DataGrid.InputBindings>
|
||||
<KeyBinding Command="ApplicationCommands.NotACommand" Gesture="Ctrl+C" />
|
||||
<KeyBinding Command="ApplicationCommands.NotACommand" Gesture="Ctrl+V" />
|
||||
<KeyBinding Command="ApplicationCommands.NotACommand" Gesture="Delete" />
|
||||
<KeyBinding Command="ApplicationCommands.NotACommand" Gesture="Enter" />
|
||||
</DataGrid.InputBindings>
|
||||
<DataGrid.ContextMenu>
|
||||
<ContextMenu Style="{StaticResource DefContextMenu}">
|
||||
<MenuItem
|
||||
x:Name="menuEditServer"
|
||||
Height="{StaticResource MenuItemHeight}"
|
||||
Header="{x:Static resx:ResUI.menuEditServer}" />
|
||||
<MenuItem
|
||||
x:Name="menuSetDefaultServer"
|
||||
Height="{StaticResource MenuItemHeight}"
|
||||
Header="{x:Static resx:ResUI.menuSetDefaultServer}" />
|
||||
<MenuItem
|
||||
x:Name="menuRemoveServer"
|
||||
Height="{StaticResource MenuItemHeight}"
|
||||
Header="{x:Static resx:ResUI.menuRemoveServer}" />
|
||||
<MenuItem
|
||||
x:Name="menuRemoveDuplicateServer"
|
||||
Height="{StaticResource MenuItemHeight}"
|
||||
Header="{x:Static resx:ResUI.menuRemoveDuplicateServer}" />
|
||||
<MenuItem
|
||||
x:Name="menuCopyServer"
|
||||
Height="{StaticResource MenuItemHeight}"
|
||||
Header="{x:Static resx:ResUI.menuCopyServer}" />
|
||||
<MenuItem
|
||||
x:Name="menuShareServer"
|
||||
Height="{StaticResource MenuItemHeight}"
|
||||
Header="{x:Static resx:ResUI.menuShareServer}" />
|
||||
<Separator />
|
||||
<MenuItem
|
||||
x:Name="menuMixedTestServer"
|
||||
Height="{StaticResource MenuItemHeight}"
|
||||
Header="{x:Static resx:ResUI.menuMixedTestServer}" />
|
||||
<MenuItem
|
||||
x:Name="menuTcpingServer"
|
||||
Height="{StaticResource MenuItemHeight}"
|
||||
Header="{x:Static resx:ResUI.menuTcpingServer}" />
|
||||
<MenuItem
|
||||
x:Name="menuRealPingServer"
|
||||
Height="{StaticResource MenuItemHeight}"
|
||||
Header="{x:Static resx:ResUI.menuRealPingServer}" />
|
||||
<MenuItem
|
||||
x:Name="menuSpeedServer"
|
||||
Height="{StaticResource MenuItemHeight}"
|
||||
Header="{x:Static resx:ResUI.menuSpeedServer}" />
|
||||
<MenuItem
|
||||
x:Name="menuSortServerResult"
|
||||
Height="{StaticResource MenuItemHeight}"
|
||||
Header="{x:Static resx:ResUI.menuSortServerResult}" />
|
||||
<Separator />
|
||||
<MenuItem
|
||||
x:Name="menuMoveToGroup"
|
||||
Height="{StaticResource MenuItemHeight}"
|
||||
Header="{x:Static resx:ResUI.menuMoveToGroup}">
|
||||
<MenuItem Height="Auto">
|
||||
<MenuItem.Header>
|
||||
<DockPanel>
|
||||
<ComboBox
|
||||
x:Name="cmbMoveToGroup"
|
||||
Width="200"
|
||||
materialDesign:HintAssist.Hint="{x:Static resx:ResUI.menuSubscription}"
|
||||
DisplayMemberPath="remarks"
|
||||
FontSize="{DynamicResource StdFontSize}"
|
||||
Style="{StaticResource MaterialDesignFilledComboBox}" />
|
||||
</DockPanel>
|
||||
</MenuItem.Header>
|
||||
</MenuItem>
|
||||
</MenuItem>
|
||||
<MenuItem Header="{x:Static resx:ResUI.menuMoveTo}">
|
||||
<MenuItem
|
||||
x:Name="menuMoveTop"
|
||||
Height="{StaticResource MenuItemHeight}"
|
||||
Header="{x:Static resx:ResUI.menuMoveTop}" />
|
||||
<MenuItem
|
||||
x:Name="menuMoveUp"
|
||||
Height="{StaticResource MenuItemHeight}"
|
||||
Header="{x:Static resx:ResUI.menuMoveUp}" />
|
||||
<MenuItem
|
||||
x:Name="menuMoveDown"
|
||||
Height="{StaticResource MenuItemHeight}"
|
||||
Header="{x:Static resx:ResUI.menuMoveDown}" />
|
||||
<MenuItem
|
||||
x:Name="menuMoveBottom"
|
||||
Height="{StaticResource MenuItemHeight}"
|
||||
Header="{x:Static resx:ResUI.menuMoveBottom}" />
|
||||
</MenuItem>
|
||||
</MenuItem>
|
||||
<MenuItem Header="{x:Static resx:ResUI.menuMoveTo}">
|
||||
<MenuItem
|
||||
x:Name="menuMoveTop"
|
||||
x:Name="menuSelectAll"
|
||||
Height="{StaticResource MenuItemHeight}"
|
||||
Header="{x:Static resx:ResUI.menuMoveTop}" />
|
||||
Click="menuSelectAll_Click"
|
||||
Header="{x:Static resx:ResUI.menuSelectAll}" />
|
||||
<Separator />
|
||||
<MenuItem
|
||||
x:Name="menuMoveUp"
|
||||
x:Name="menuExport2ClientConfig"
|
||||
Height="{StaticResource MenuItemHeight}"
|
||||
Header="{x:Static resx:ResUI.menuMoveUp}" />
|
||||
Header="{x:Static resx:ResUI.menuExport2ClientConfig}" />
|
||||
<MenuItem
|
||||
x:Name="menuMoveDown"
|
||||
x:Name="menuExport2ShareUrl"
|
||||
Height="{StaticResource MenuItemHeight}"
|
||||
Header="{x:Static resx:ResUI.menuMoveDown}" />
|
||||
Header="{x:Static resx:ResUI.menuExport2ShareUrl}" />
|
||||
<MenuItem
|
||||
x:Name="menuMoveBottom"
|
||||
x:Name="menuExport2SubContent"
|
||||
Height="{StaticResource MenuItemHeight}"
|
||||
Header="{x:Static resx:ResUI.menuMoveBottom}" />
|
||||
</MenuItem>
|
||||
<MenuItem
|
||||
x:Name="menuSelectAll"
|
||||
Height="{StaticResource MenuItemHeight}"
|
||||
Click="menuSelectAll_Click"
|
||||
Header="{x:Static resx:ResUI.menuSelectAll}" />
|
||||
<Separator />
|
||||
<MenuItem
|
||||
x:Name="menuExport2ClientConfig"
|
||||
Height="{StaticResource MenuItemHeight}"
|
||||
Header="{x:Static resx:ResUI.menuExport2ClientConfig}" />
|
||||
<MenuItem
|
||||
x:Name="menuExport2ShareUrl"
|
||||
Height="{StaticResource MenuItemHeight}"
|
||||
Header="{x:Static resx:ResUI.menuExport2ShareUrl}" />
|
||||
<MenuItem
|
||||
x:Name="menuExport2SubContent"
|
||||
Height="{StaticResource MenuItemHeight}"
|
||||
Header="{x:Static resx:ResUI.menuExport2SubContent}" />
|
||||
</ContextMenu>
|
||||
</DataGrid.ContextMenu>
|
||||
<DataGrid.Resources>
|
||||
<Style BasedOn="{StaticResource MaterialDesignDataGridRow}" TargetType="DataGridRow">
|
||||
<EventSetter Event="MouseDoubleClick" Handler="LstProfiles_MouseDoubleClick" />
|
||||
</Style>
|
||||
<Style BasedOn="{StaticResource MaterialDesignDataGridColumnHeader}" TargetType="DataGridColumnHeader">
|
||||
<EventSetter Event="Click" Handler="LstProfiles_ColumnHeader_Click" />
|
||||
</Style>
|
||||
Header="{x:Static resx:ResUI.menuExport2SubContent}" />
|
||||
</ContextMenu>
|
||||
</DataGrid.ContextMenu>
|
||||
<DataGrid.Resources>
|
||||
<Style BasedOn="{StaticResource MaterialDesignDataGridRow}" TargetType="DataGridRow">
|
||||
<EventSetter Event="MouseDoubleClick" Handler="LstProfiles_MouseDoubleClick" />
|
||||
</Style>
|
||||
<Style BasedOn="{StaticResource MaterialDesignDataGridColumnHeader}" TargetType="DataGridColumnHeader">
|
||||
<EventSetter Event="Click" Handler="LstProfiles_ColumnHeader_Click" />
|
||||
</Style>
|
||||
|
||||
<Style BasedOn="{StaticResource MaterialDesignDataGridCell}" TargetType="DataGridCell">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding isActive}" Value="True">
|
||||
<Setter Property="Background" Value="{DynamicResource MaterialDesign.Brush.Primary.Light}" />
|
||||
<Setter Property="Foreground" Value="Black" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource MaterialDesign.Brush.Primary.Light}" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</DataGrid.Resources>
|
||||
<DataGrid.Columns>
|
||||
<Style BasedOn="{StaticResource MaterialDesignDataGridCell}" TargetType="DataGridCell">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding isActive}" Value="True">
|
||||
<Setter Property="Background" Value="{DynamicResource MaterialDesign.Brush.Primary.Light}" />
|
||||
<Setter Property="Foreground" Value="Black" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource MaterialDesign.Brush.Primary.Light}" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</DataGrid.Resources>
|
||||
<DataGrid.Columns>
|
||||
|
||||
<base:MyDGTextColumn
|
||||
Width="80"
|
||||
Binding="{Binding configType}"
|
||||
ExName="configType"
|
||||
Header="{x:Static resx:ResUI.LvServiceType}" />
|
||||
<base:MyDGTextColumn
|
||||
Width="150"
|
||||
Binding="{Binding remarks}"
|
||||
ExName="remarks"
|
||||
Header="{x:Static resx:ResUI.LvRemarks}" />
|
||||
<base:MyDGTextColumn
|
||||
Width="120"
|
||||
Binding="{Binding address}"
|
||||
ExName="address"
|
||||
Header="{x:Static resx:ResUI.LvAddress}" />
|
||||
<base:MyDGTextColumn
|
||||
Width="60"
|
||||
Binding="{Binding port}"
|
||||
ExName="port"
|
||||
Header="{x:Static resx:ResUI.LvPort}" />
|
||||
<base:MyDGTextColumn
|
||||
Width="100"
|
||||
Binding="{Binding network}"
|
||||
ExName="network"
|
||||
Header="{x:Static resx:ResUI.LvTransportProtocol}" />
|
||||
<base:MyDGTextColumn
|
||||
Width="100"
|
||||
Binding="{Binding streamSecurity}"
|
||||
ExName="streamSecurity"
|
||||
Header="{x:Static resx:ResUI.LvTLS}" />
|
||||
<base:MyDGTextColumn
|
||||
Width="100"
|
||||
Binding="{Binding subRemarks}"
|
||||
ExName="subRemarks"
|
||||
Header="{x:Static resx:ResUI.LvSubscription}" />
|
||||
<base:MyDGTextColumn
|
||||
Width="100"
|
||||
Binding="{Binding delayVal}"
|
||||
ExName="delayVal"
|
||||
Header="{x:Static resx:ResUI.LvTestDelay}">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="HorizontalAlignment" Value="Right" />
|
||||
<Setter Property="Foreground" Value="{Binding delay, Converter={StaticResource DelayColorConverter}}" />
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</base:MyDGTextColumn>
|
||||
<base:MyDGTextColumn
|
||||
Width="100"
|
||||
Binding="{Binding speedVal}"
|
||||
ExName="speedVal"
|
||||
Header="{x:Static resx:ResUI.LvTestSpeed}">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="HorizontalAlignment" Value="Right" />
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</base:MyDGTextColumn>
|
||||
<base:MyDGTextColumn
|
||||
Width="80"
|
||||
Binding="{Binding configType}"
|
||||
ExName="configType"
|
||||
Header="{x:Static resx:ResUI.LvServiceType}" />
|
||||
<base:MyDGTextColumn
|
||||
Width="150"
|
||||
Binding="{Binding remarks}"
|
||||
ExName="remarks"
|
||||
Header="{x:Static resx:ResUI.LvRemarks}" />
|
||||
<base:MyDGTextColumn
|
||||
Width="120"
|
||||
Binding="{Binding address}"
|
||||
ExName="address"
|
||||
Header="{x:Static resx:ResUI.LvAddress}" />
|
||||
<base:MyDGTextColumn
|
||||
Width="60"
|
||||
Binding="{Binding port}"
|
||||
ExName="port"
|
||||
Header="{x:Static resx:ResUI.LvPort}" />
|
||||
<base:MyDGTextColumn
|
||||
Width="100"
|
||||
Binding="{Binding network}"
|
||||
ExName="network"
|
||||
Header="{x:Static resx:ResUI.LvTransportProtocol}" />
|
||||
<base:MyDGTextColumn
|
||||
Width="100"
|
||||
Binding="{Binding streamSecurity}"
|
||||
ExName="streamSecurity"
|
||||
Header="{x:Static resx:ResUI.LvTLS}" />
|
||||
<base:MyDGTextColumn
|
||||
Width="100"
|
||||
Binding="{Binding subRemarks}"
|
||||
ExName="subRemarks"
|
||||
Header="{x:Static resx:ResUI.LvSubscription}" />
|
||||
<base:MyDGTextColumn
|
||||
Width="100"
|
||||
Binding="{Binding delayVal}"
|
||||
ExName="delayVal"
|
||||
Header="{x:Static resx:ResUI.LvTestDelay}">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="HorizontalAlignment" Value="Right" />
|
||||
<Setter Property="Foreground" Value="{Binding delay, Converter={StaticResource DelayColorConverter}}" />
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</base:MyDGTextColumn>
|
||||
<base:MyDGTextColumn
|
||||
Width="100"
|
||||
Binding="{Binding speedVal}"
|
||||
ExName="speedVal"
|
||||
Header="{x:Static resx:ResUI.LvTestSpeed}">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="HorizontalAlignment" Value="Right" />
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</base:MyDGTextColumn>
|
||||
|
||||
<base:MyDGTextColumn
|
||||
x:Name="colTodayUp"
|
||||
Width="100"
|
||||
Binding="{Binding todayUp}"
|
||||
ExName="todayUp"
|
||||
Header="{x:Static resx:ResUI.LvTodayUploadDataAmount}" />
|
||||
<base:MyDGTextColumn
|
||||
x:Name="colTodayDown"
|
||||
Width="100"
|
||||
Binding="{Binding todayDown}"
|
||||
ExName="todayDown"
|
||||
Header="{x:Static resx:ResUI.LvTodayDownloadDataAmount}" />
|
||||
<base:MyDGTextColumn
|
||||
x:Name="colTotalUp"
|
||||
Width="100"
|
||||
Binding="{Binding totalUp}"
|
||||
ExName="totalUp"
|
||||
Header="{x:Static resx:ResUI.LvTotalUploadDataAmount}" />
|
||||
<base:MyDGTextColumn
|
||||
x:Name="colTotalDown"
|
||||
Width="100"
|
||||
Binding="{Binding totalDown}"
|
||||
ExName="totalDown"
|
||||
Header="{x:Static resx:ResUI.LvTotalDownloadDataAmount}" />
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</DockPanel>
|
||||
|
||||
<base:MyDGTextColumn
|
||||
x:Name="colTodayUp"
|
||||
Width="100"
|
||||
Binding="{Binding todayUp}"
|
||||
ExName="todayUp"
|
||||
Header="{x:Static resx:ResUI.LvTodayUploadDataAmount}" />
|
||||
<base:MyDGTextColumn
|
||||
x:Name="colTodayDown"
|
||||
Width="100"
|
||||
Binding="{Binding todayDown}"
|
||||
ExName="todayDown"
|
||||
Header="{x:Static resx:ResUI.LvTodayDownloadDataAmount}" />
|
||||
<base:MyDGTextColumn
|
||||
x:Name="colTotalUp"
|
||||
Width="100"
|
||||
Binding="{Binding totalUp}"
|
||||
ExName="totalUp"
|
||||
Header="{x:Static resx:ResUI.LvTotalUploadDataAmount}" />
|
||||
<base:MyDGTextColumn
|
||||
x:Name="colTotalDown"
|
||||
Width="100"
|
||||
Binding="{Binding totalDown}"
|
||||
ExName="totalDown"
|
||||
Header="{x:Static resx:ResUI.LvTotalDownloadDataAmount}" />
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
<GridSplitter Grid.Row="1" HorizontalAlignment="Stretch" />
|
||||
<local:MsgView Grid.Row="2" />
|
||||
<materialDesign:Snackbar
|
||||
|
|
|
@ -46,6 +46,7 @@ namespace v2rayN.Views
|
|||
this.PreviewKeyDown += MainWindow_PreviewKeyDown;
|
||||
btnAutofitColumnWidth.Click += BtnAutofitColumnWidth_Click;
|
||||
txtServerFilter.PreviewKeyDown += TxtServerFilter_PreviewKeyDown;
|
||||
btnShowCalshUI.Click += BtnShowCalshUI_Click;
|
||||
lstProfiles.PreviewKeyDown += LstProfiles_PreviewKeyDown;
|
||||
lstProfiles.SelectionChanged += lstProfiles_SelectionChanged;
|
||||
lstProfiles.LoadingRow += LstProfiles_LoadingRow;
|
||||
|
@ -205,6 +206,8 @@ namespace v2rayN.Views
|
|||
this.Bind(ViewModel, vm => vm.SelectedSwatch, v => v.cmbSwatches.SelectedItem).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.CurrentFontSize, v => v.cmbCurrentFontSize.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.CurrentLanguage, v => v.cmbCurrentLanguage.Text).DisposeWith(disposables);
|
||||
this.OneWayBind(ViewModel, vm => vm.ShowCalshUI, v => v.btnShowCalshUI.Visibility).DisposeWith(disposables);
|
||||
this.OneWayBind(ViewModel, vm => vm.ShowCalshUI, v => v.tabClashUI.Visibility).DisposeWith(disposables);
|
||||
});
|
||||
|
||||
RestoreUI();
|
||||
|
@ -455,6 +458,27 @@ namespace v2rayN.Views
|
|||
}
|
||||
}
|
||||
|
||||
private bool blShowClashUI = false;
|
||||
|
||||
private void BtnShowCalshUI_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (blShowClashUI)
|
||||
{
|
||||
tabClashUI.Visibility = Visibility.Hidden;
|
||||
tabClashUI.Width = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
tabClashUI.Visibility = Visibility.Visible;
|
||||
if (tabClashUI.Content is null)
|
||||
{
|
||||
tabClashUI.Content = new ClashProxiesView();
|
||||
}
|
||||
tabClashUI.Width = this.ActualWidth * 5 / 6;
|
||||
}
|
||||
blShowClashUI = !blShowClashUI;
|
||||
}
|
||||
|
||||
#endregion Event
|
||||
|
||||
#region UI
|
||||
|
|
Loading…
Reference in New Issue