mirror of https://github.com/2dust/v2rayN
Improve UI
parent
70ea21fca2
commit
5c070e2ca8
|
@ -65,7 +65,7 @@ namespace v2rayN.Handler.Statistics
|
|||
await Task.Delay(1000);
|
||||
try
|
||||
{
|
||||
if (!(_config.runningCoreType is ECoreType.sing_box or ECoreType.clash or ECoreType.clash_meta or ECoreType.mihomo))
|
||||
if (!(_config.IsRunningCore(ECoreType.clash)))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ namespace v2rayN.Handler.Statistics
|
|||
await Task.Delay(1000);
|
||||
try
|
||||
{
|
||||
if (!(_config.runningCoreType is ECoreType.Xray or ECoreType.v2fly or ECoreType.v2fly_v5 or ECoreType.SagerNet))
|
||||
if (!(_config.IsRunningCore(ECoreType.Xray)))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -18,6 +18,19 @@ namespace v2rayN.Models
|
|||
|
||||
public ECoreType runningCoreType { get; set; }
|
||||
|
||||
public bool IsRunningCore(ECoreType type)
|
||||
{
|
||||
if (type == ECoreType.Xray && runningCoreType is ECoreType.Xray or ECoreType.v2fly or ECoreType.v2fly_v5 or ECoreType.SagerNet)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (type == ECoreType.clash && runningCoreType is ECoreType.sing_box or ECoreType.clash or ECoreType.clash_meta or ECoreType.mihomo)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
#endregion property
|
||||
|
||||
#region other entities
|
||||
|
|
|
@ -130,6 +130,7 @@ namespace v2rayN.Models
|
|||
public bool autoHideStartup { get; set; }
|
||||
public string mainMsgFilter { get; set; }
|
||||
public List<ColumnItem> mainColumnItem { get; set; }
|
||||
public bool showInTaskbar { get; set; }
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
|
@ -216,7 +217,6 @@ namespace v2rayN.Models
|
|||
public class ClashUIItem
|
||||
{
|
||||
public ERuleMode ruleMode { get; set; }
|
||||
public bool showInTaskbar { get; set; }
|
||||
public bool enableIPv6 { get; set; }
|
||||
public bool enableMixinContent { get; set; }
|
||||
public int proxiesSorting { get; set; }
|
||||
|
|
|
@ -5,6 +5,7 @@ using ReactiveUI.Fody.Helpers;
|
|||
using System.Reactive;
|
||||
using System.Reactive.Linq;
|
||||
using System.Windows;
|
||||
using v2rayN.Enums;
|
||||
using v2rayN.Handler;
|
||||
using v2rayN.Models;
|
||||
|
||||
|
@ -84,7 +85,7 @@ namespace v2rayN.ViewModels
|
|||
Observable.Interval(TimeSpan.FromSeconds(10))
|
||||
.Subscribe(x =>
|
||||
{
|
||||
if (!(AutoRefresh && _config.clashUIItem.showInTaskbar))
|
||||
if (!(AutoRefresh && _config.uiItem.showInTaskbar && _config.IsRunningCore(ECoreType.clash)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -465,7 +465,7 @@ namespace v2rayN.ViewModels
|
|||
Observable.Interval(TimeSpan.FromSeconds(60))
|
||||
.Subscribe(x =>
|
||||
{
|
||||
if (!(AutoRefresh && _config.clashUIItem.showInTaskbar))
|
||||
if (!(AutoRefresh && _config.uiItem.showInTaskbar && _config.IsRunningCore(ECoreType.clash)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -186,6 +186,9 @@ namespace v2rayN.ViewModels
|
|||
[Reactive]
|
||||
public bool ShowClashUI { get; set; }
|
||||
|
||||
[Reactive]
|
||||
public int TabMainSelectedIndex { get; set; }
|
||||
|
||||
#endregion UI
|
||||
|
||||
#region Init
|
||||
|
@ -404,7 +407,7 @@ namespace v2rayN.ViewModels
|
|||
AutoHideStartup();
|
||||
|
||||
_showInTaskbar = true;
|
||||
_config.clashUIItem.showInTaskbar = _showInTaskbar;
|
||||
_config.uiItem.showInTaskbar = _showInTaskbar;
|
||||
}
|
||||
|
||||
private void Init()
|
||||
|
@ -914,11 +917,12 @@ namespace v2rayN.ViewModels
|
|||
Application.Current?.Dispatcher.Invoke((Action)(() =>
|
||||
{
|
||||
BlReloadEnabled = true;
|
||||
ShowClashUI = (_config.runningCoreType is ECoreType.sing_box or ECoreType.clash or ECoreType.clash_meta or ECoreType.mihomo);
|
||||
ShowClashUI = _config.IsRunningCore(ECoreType.clash);
|
||||
if (ShowClashUI)
|
||||
{
|
||||
Locator.Current.GetService<ClashProxiesViewModel>()?.ProxiesReload();
|
||||
}
|
||||
else { TabMainSelectedIndex = 0; }
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
@ -1091,7 +1095,7 @@ namespace v2rayN.ViewModels
|
|||
//Utile.RegWriteValue(Global.MyRegPath, Utile.WindowHwndKey, Convert.ToString((long)windowHandle));
|
||||
}
|
||||
_showInTaskbar = bl;
|
||||
_config.clashUIItem.showInTaskbar = _showInTaskbar;
|
||||
_config.uiItem.showInTaskbar = _showInTaskbar;
|
||||
}
|
||||
|
||||
private void RestoreUI()
|
||||
|
|
|
@ -222,7 +222,6 @@ namespace v2rayN.ViewModels
|
|||
}, canEditRemove);
|
||||
|
||||
//Subscription
|
||||
|
||||
AddSubCmd = ReactiveCommand.Create(() =>
|
||||
{
|
||||
EditSub(true);
|
||||
|
|
|
@ -13,52 +13,52 @@
|
|||
d:DesignWidth="800"
|
||||
x:TypeArguments="vms:ClashConnectionsViewModel"
|
||||
mc:Ignorable="d">
|
||||
<DockPanel>
|
||||
<ToolBarTray Margin="0,8,0,8" DockPanel.Dock="Top">
|
||||
<ToolBar ClipToBounds="True" Style="{StaticResource MaterialDesignToolBar}">
|
||||
<Button Width="1" Visibility="Hidden">
|
||||
<materialDesign:PackIcon
|
||||
Margin="0,0,8,0"
|
||||
VerticalAlignment="Center"
|
||||
Kind="ContentSave" />
|
||||
</Button>
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
Style="{StaticResource ToolbarTextBlock}"
|
||||
Text="{x:Static resx:ResUI.TbSorting}" />
|
||||
<ComboBox
|
||||
x:Name="cmbSorting"
|
||||
Width="100"
|
||||
Margin="8"
|
||||
Style="{StaticResource DefComboBox}">
|
||||
<ComboBoxItem Content="{x:Static resx:ResUI.TbSortingUpSpeed}" />
|
||||
<ComboBoxItem Content="{x:Static resx:ResUI.TbSortingDownSpeed}" />
|
||||
<ComboBoxItem Content="{x:Static resx:ResUI.TbSortingUpTraffic}" />
|
||||
<ComboBoxItem Content="{x:Static resx:ResUI.TbSortingDownTraffic}" />
|
||||
<ComboBoxItem Content="{x:Static resx:ResUI.TbSortingTime}" />
|
||||
<ComboBoxItem Content="{x:Static resx:ResUI.TbSortingHost}" />
|
||||
</ComboBox>
|
||||
<Separator />
|
||||
<Button x:Name="btnConnectionCloseAll" ToolTip="{x:Static resx:ResUI.menuConnectionCloseAll}">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<materialDesign:PackIcon
|
||||
Margin="0,0,8,0"
|
||||
VerticalAlignment="Center"
|
||||
Kind="Close" />
|
||||
<TextBlock Style="{StaticResource ToolbarTextBlock}" Text="{x:Static resx:ResUI.menuConnectionCloseAll}" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
<Separator />
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
Style="{StaticResource ToolbarTextBlock}"
|
||||
Text="{x:Static resx:ResUI.TbAutoRefresh}" />
|
||||
<ToggleButton
|
||||
x:Name="togAutoRefresh"
|
||||
Margin="8"
|
||||
HorizontalAlignment="Left" />
|
||||
</ToolBar>
|
||||
</ToolBarTray>
|
||||
|
||||
<DockPanel Margin="2">
|
||||
<WrapPanel
|
||||
Margin="8"
|
||||
VerticalAlignment="Center"
|
||||
DockPanel.Dock="Top"
|
||||
Orientation="Horizontal">
|
||||
|
||||
<TextBlock
|
||||
Margin="8,0"
|
||||
VerticalAlignment="Center"
|
||||
Style="{StaticResource ToolbarTextBlock}"
|
||||
Text="{x:Static resx:ResUI.TbSorting}" />
|
||||
<ComboBox
|
||||
x:Name="cmbSorting"
|
||||
Width="100"
|
||||
Margin="8"
|
||||
Style="{StaticResource DefComboBox}">
|
||||
<ComboBoxItem Content="{x:Static resx:ResUI.TbSortingUpSpeed}" />
|
||||
<ComboBoxItem Content="{x:Static resx:ResUI.TbSortingDownSpeed}" />
|
||||
<ComboBoxItem Content="{x:Static resx:ResUI.TbSortingUpTraffic}" />
|
||||
<ComboBoxItem Content="{x:Static resx:ResUI.TbSortingDownTraffic}" />
|
||||
<ComboBoxItem Content="{x:Static resx:ResUI.TbSortingTime}" />
|
||||
<ComboBoxItem Content="{x:Static resx:ResUI.TbSortingHost}" />
|
||||
</ComboBox>
|
||||
|
||||
<Button
|
||||
x:Name="btnConnectionCloseAll"
|
||||
Width="30"
|
||||
Height="30"
|
||||
Margin="8,0"
|
||||
Style="{StaticResource MaterialDesignFloatingActionMiniLightButton}">
|
||||
<materialDesign:PackIcon VerticalAlignment="Center" Kind="Close" />
|
||||
</Button>
|
||||
|
||||
<TextBlock
|
||||
Margin="8,0"
|
||||
VerticalAlignment="Center"
|
||||
Style="{StaticResource ToolbarTextBlock}"
|
||||
Text="{x:Static resx:ResUI.TbAutoRefresh}" />
|
||||
<ToggleButton
|
||||
x:Name="togAutoRefresh"
|
||||
Margin="8"
|
||||
HorizontalAlignment="Left" />
|
||||
</WrapPanel>
|
||||
|
||||
<DataGrid
|
||||
x:Name="lstConnections"
|
||||
AutoGenerateColumns="False"
|
||||
|
@ -79,21 +79,21 @@
|
|||
</DataGrid.ContextMenu>
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn
|
||||
Width="300"
|
||||
Width="240"
|
||||
Binding="{Binding host}"
|
||||
Header="{x:Static resx:ResUI.TbSortingHost}" />
|
||||
<DataGridTextColumn
|
||||
Width="100"
|
||||
Width="160"
|
||||
Binding="{Binding chain}"
|
||||
Header="{x:Static resx:ResUI.TbSortingChain}" />
|
||||
<DataGridTextColumn
|
||||
Width="80"
|
||||
Binding="{Binding network}"
|
||||
Header="{x:Static resx:ResUI.TbSortingNetwork}" />
|
||||
<DataGridTextColumn
|
||||
Width="100"
|
||||
Binding="{Binding type}"
|
||||
Header="{x:Static resx:ResUI.TbSortingType}" />
|
||||
<DataGridTextColumn
|
||||
Width="200"
|
||||
Binding="{Binding chain}"
|
||||
Header="{x:Static resx:ResUI.TbSortingChain}" />
|
||||
<DataGridTextColumn
|
||||
Width="100"
|
||||
Binding="{Binding uploadTraffic}"
|
||||
|
|
|
@ -25,6 +25,37 @@
|
|||
VerticalAlignment="Center"
|
||||
DockPanel.Dock="Top"
|
||||
Orientation="Horizontal">
|
||||
|
||||
<TextBlock
|
||||
Margin="8,0"
|
||||
VerticalAlignment="Center"
|
||||
Style="{StaticResource ToolbarTextBlock}"
|
||||
Text="{x:Static resx:ResUI.menuRulemode}" />
|
||||
<ComboBox
|
||||
x:Name="cmbRulemode"
|
||||
Width="80"
|
||||
Margin="8"
|
||||
Style="{StaticResource DefComboBox}">
|
||||
<ComboBoxItem Content="{x:Static resx:ResUI.menuModeRule}" />
|
||||
<ComboBoxItem Content="{x:Static resx:ResUI.menuModeGlobal}" />
|
||||
<ComboBoxItem Content="{x:Static resx:ResUI.menuModeDirect}" />
|
||||
</ComboBox>
|
||||
|
||||
<TextBlock
|
||||
Margin="8,0"
|
||||
VerticalAlignment="Center"
|
||||
Style="{StaticResource ToolbarTextBlock}"
|
||||
Text="{x:Static resx:ResUI.TbSorting}" />
|
||||
<ComboBox
|
||||
x:Name="cmbSorting"
|
||||
Width="60"
|
||||
Margin="8"
|
||||
Style="{StaticResource DefComboBox}">
|
||||
<ComboBoxItem Content="{x:Static resx:ResUI.TbSortingDelay}" />
|
||||
<ComboBoxItem Content="{x:Static resx:ResUI.TbSortingName}" />
|
||||
<ComboBoxItem Content="{x:Static resx:ResUI.TbSortingDefault}" />
|
||||
</ComboBox>
|
||||
|
||||
<Button
|
||||
x:Name="menuProxiesReload"
|
||||
Width="30"
|
||||
|
@ -43,37 +74,6 @@
|
|||
<materialDesign:PackIcon VerticalAlignment="Center" Kind="LightningBolt" />
|
||||
</Button>
|
||||
|
||||
<TextBlock
|
||||
Margin="8,0"
|
||||
VerticalAlignment="Center"
|
||||
Style="{StaticResource ToolbarTextBlock}"
|
||||
Text="{x:Static resx:ResUI.menuRulemode}" />
|
||||
<ComboBox
|
||||
x:Name="cmbRulemode"
|
||||
Width="80"
|
||||
Margin="8"
|
||||
Style="{StaticResource DefComboBox}">
|
||||
<ComboBoxItem Content="{x:Static resx:ResUI.menuModeRule}" />
|
||||
<ComboBoxItem Content="{x:Static resx:ResUI.menuModeGlobal}" />
|
||||
<ComboBoxItem Content="{x:Static resx:ResUI.menuModeDirect}" />
|
||||
<ComboBoxItem Content="{x:Static resx:ResUI.menuModeNothing}" />
|
||||
</ComboBox>
|
||||
|
||||
<TextBlock
|
||||
Margin="8,0"
|
||||
VerticalAlignment="Center"
|
||||
Style="{StaticResource ToolbarTextBlock}"
|
||||
Text="{x:Static resx:ResUI.TbSorting}" />
|
||||
<ComboBox
|
||||
x:Name="cmbSorting"
|
||||
Width="60"
|
||||
Margin="8"
|
||||
Style="{StaticResource DefComboBox}">
|
||||
<ComboBoxItem Content="{x:Static resx:ResUI.TbSortingDelay}" />
|
||||
<ComboBoxItem Content="{x:Static resx:ResUI.TbSortingName}" />
|
||||
<ComboBoxItem Content="{x:Static resx:ResUI.TbSortingDefault}" />
|
||||
</ComboBox>
|
||||
|
||||
<TextBlock
|
||||
Margin="8,0"
|
||||
VerticalAlignment="Center"
|
||||
|
|
|
@ -2,10 +2,8 @@
|
|||
x:Class="v2rayN.Views.MainWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:base="clr-namespace:v2rayN.Base"
|
||||
xmlns:conv="clr-namespace:v2rayN.Converters"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:v2rayN.Views"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:reactiveui="http://reactiveui.net"
|
||||
|
@ -476,9 +474,13 @@
|
|||
</Grid.ColumnDefinitions>
|
||||
<ContentControl x:Name="tabProfiles" Grid.Column="0" />
|
||||
<GridSplitter Grid.Column="1" HorizontalAlignment="Stretch" />
|
||||
<TabControl Grid.Column="2" HorizontalContentAlignment="Left">
|
||||
<TabControl
|
||||
x:Name="tabMain"
|
||||
Grid.Column="2"
|
||||
HorizontalContentAlignment="Left">
|
||||
<TabItem x:Name="tabMsgView" Header="{x:Static resx:ResUI.MsgInformationTitle}" />
|
||||
<TabItem x:Name="tabClashUI" Header="{x:Static resx:ResUI.TbProxies}" />
|
||||
<TabItem x:Name="tabClashProxies" Header="{x:Static resx:ResUI.TbProxies}" />
|
||||
<TabItem x:Name="tabClashConnections" Header="{x:Static resx:ResUI.TbConnections}" />
|
||||
</TabControl>
|
||||
|
||||
<materialDesign:Snackbar
|
||||
|
|
|
@ -137,7 +137,9 @@ 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.ShowClashUI, v => v.tabClashUI.Visibility).DisposeWith(disposables);
|
||||
this.OneWayBind(ViewModel, vm => vm.ShowClashUI, v => v.tabClashProxies.Visibility).DisposeWith(disposables);
|
||||
this.OneWayBind(ViewModel, vm => vm.ShowClashUI, v => v.tabClashConnections.Visibility).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.TabMainSelectedIndex, v => v.tabMain.SelectedIndex).DisposeWith(disposables);
|
||||
});
|
||||
|
||||
var IsAdministrator = Utils.IsAdministrator();
|
||||
|
@ -152,7 +154,8 @@ namespace v2rayN.Views
|
|||
|
||||
tabProfiles.Content ??= new ProfilesView();
|
||||
tabMsgView.Content ??= new MsgView();
|
||||
tabClashUI.Content ??= new ClashProxiesView();
|
||||
tabClashProxies.Content ??= new ClashProxiesView();
|
||||
tabClashConnections.Content ??= new ClashConnectionsView();
|
||||
|
||||
RestoreUI();
|
||||
AddHelpMenuItem();
|
||||
|
|
Loading…
Reference in New Issue