mirror of
https://github.com/2dust/v2rayN.git
synced 2026-05-02 20:35:50 +00:00
Compare commits
6 commits
9157de02be
...
9caa2229af
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9caa2229af | ||
|
|
ef5fee9975 | ||
|
|
df800a60c2 | ||
|
|
679bd8afcc | ||
|
|
66e1aeae1f | ||
|
|
4f93a83f9f |
26 changed files with 395 additions and 80 deletions
|
|
@ -660,5 +660,14 @@ public class Global
|
||||||
""
|
""
|
||||||
];
|
];
|
||||||
|
|
||||||
|
public static readonly List<string> TunIcmpRoutingPolicies =
|
||||||
|
[
|
||||||
|
"rule",
|
||||||
|
"direct",
|
||||||
|
"unreachable",
|
||||||
|
"drop",
|
||||||
|
"reply",
|
||||||
|
];
|
||||||
|
|
||||||
#endregion const
|
#endregion const
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -268,7 +268,8 @@ public class CoreConfigContextBuilder
|
||||||
{
|
{
|
||||||
IndexId = $"inner-{Utils.GetGuid(false)}",
|
IndexId = $"inner-{Utils.GetGuid(false)}",
|
||||||
ConfigType = EConfigType.ProxyChain,
|
ConfigType = EConfigType.ProxyChain,
|
||||||
CoreType = node.CoreType ?? ECoreType.Xray,
|
CoreType = AppManager.Instance.GetCoreType(node, node.ConfigType),
|
||||||
|
Remarks = node.Remarks,
|
||||||
};
|
};
|
||||||
List<string?> childItems = [prevNode?.IndexId, node.IndexId, nextNode?.IndexId];
|
List<string?> childItems = [prevNode?.IndexId, node.IndexId, nextNode?.IndexId];
|
||||||
var chainExtraItem = chainNode.GetProtocolExtra() with
|
var chainExtraItem = chainNode.GetProtocolExtra() with
|
||||||
|
|
|
||||||
|
|
@ -91,6 +91,7 @@ public static class ConfigHandler
|
||||||
{
|
{
|
||||||
EnableTun = false,
|
EnableTun = false,
|
||||||
Mtu = 9000,
|
Mtu = 9000,
|
||||||
|
IcmpRouting = Global.TunIcmpRoutingPolicies.First(),
|
||||||
};
|
};
|
||||||
config.GuiItem ??= new();
|
config.GuiItem ??= new();
|
||||||
config.MsgUIItem ??= new();
|
config.MsgUIItem ??= new();
|
||||||
|
|
@ -154,6 +155,7 @@ public static class ConfigHandler
|
||||||
DownMbps = 100
|
DownMbps = 100
|
||||||
};
|
};
|
||||||
config.ClashUIItem ??= new();
|
config.ClashUIItem ??= new();
|
||||||
|
config.ClashUIItem.ConnectionsColumnItem ??= new();
|
||||||
config.SystemProxyItem ??= new();
|
config.SystemProxyItem ??= new();
|
||||||
config.WebDavItem ??= new();
|
config.WebDavItem ??= new();
|
||||||
config.CheckUpdateItem ??= new();
|
config.CheckUpdateItem ??= new();
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ public static class CoreConfigHandler
|
||||||
_ => await GenerateClientCustomConfig(node, fileName)
|
_ => await GenerateClientCustomConfig(node, fileName)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
else if (AppManager.Instance.GetCoreType(node, node.ConfigType) == ECoreType.sing_box)
|
else if (context.RunCoreType == ECoreType.sing_box)
|
||||||
{
|
{
|
||||||
result = new CoreConfigSingboxService(context).GenerateClientConfigContent();
|
result = new CoreConfigSingboxService(context).GenerateClientConfigContent();
|
||||||
}
|
}
|
||||||
|
|
@ -128,12 +128,11 @@ public static class CoreConfigHandler
|
||||||
public static async Task<RetResult> GenerateClientSpeedtestConfig(Config config, CoreConfigContext context, ServerTestItem testItem, string fileName)
|
public static async Task<RetResult> GenerateClientSpeedtestConfig(Config config, CoreConfigContext context, ServerTestItem testItem, string fileName)
|
||||||
{
|
{
|
||||||
var result = new RetResult();
|
var result = new RetResult();
|
||||||
var node = context.Node;
|
|
||||||
var initPort = AppManager.Instance.GetLocalPort(EInboundProtocol.speedtest);
|
var initPort = AppManager.Instance.GetLocalPort(EInboundProtocol.speedtest);
|
||||||
var port = Utils.GetFreePort(initPort + testItem.QueueNum);
|
var port = Utils.GetFreePort(initPort + testItem.QueueNum);
|
||||||
testItem.Port = port;
|
testItem.Port = port;
|
||||||
|
|
||||||
if (AppManager.Instance.GetCoreType(node, node.ConfigType) == ECoreType.sing_box)
|
if (context.RunCoreType == ECoreType.sing_box)
|
||||||
{
|
{
|
||||||
result = new CoreConfigSingboxService(context).GenerateClientSpeedtestConfig(port);
|
result = new CoreConfigSingboxService(context).GenerateClientSpeedtestConfig(port);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -132,7 +132,7 @@ public class CoreManager
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
var coreType = AppManager.Instance.GetCoreType(node, node.ConfigType);
|
var coreType = context.RunCoreType;
|
||||||
var coreInfo = CoreInfoManager.Instance.GetCoreInfo(coreType);
|
var coreInfo = CoreInfoManager.Instance.GetCoreInfo(coreType);
|
||||||
return await RunProcess(coreInfo, fileName, true, false);
|
return await RunProcess(coreInfo, fileName, true, false);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -145,6 +145,7 @@ public class TunModeItem
|
||||||
public string Stack { get; set; }
|
public string Stack { get; set; }
|
||||||
public int Mtu { get; set; }
|
public int Mtu { get; set; }
|
||||||
public bool EnableIPv6Address { get; set; }
|
public bool EnableIPv6Address { get; set; }
|
||||||
|
public string IcmpRouting { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
[Serializable]
|
[Serializable]
|
||||||
|
|
@ -208,6 +209,7 @@ public class ClashUIItem
|
||||||
public int ProxiesAutoDelayTestInterval { get; set; } = 10;
|
public int ProxiesAutoDelayTestInterval { get; set; } = 10;
|
||||||
public bool ConnectionsAutoRefresh { get; set; }
|
public bool ConnectionsAutoRefresh { get; set; }
|
||||||
public int ConnectionsRefreshInterval { get; set; } = 2;
|
public int ConnectionsRefreshInterval { get; set; } = 2;
|
||||||
|
public List<ColumnItem> ConnectionsColumnItem { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
[Serializable]
|
[Serializable]
|
||||||
|
|
|
||||||
9
v2rayN/ServiceLib/Resx/ResUI.Designer.cs
generated
9
v2rayN/ServiceLib/Resx/ResUI.Designer.cs
generated
|
|
@ -3033,6 +3033,15 @@ namespace ServiceLib.Resx {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 ICMP routing policy 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
public static string TbIcmpRoutingPolicy {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("TbIcmpRoutingPolicy", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找类似 UUID(id) 的本地化字符串。
|
/// 查找类似 UUID(id) 的本地化字符串。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
|
|
@ -1671,4 +1671,7 @@ The "Get Certificate" action may fail if a self-signed certificate is used or if
|
||||||
<data name="menuGenRegionGroup" xml:space="preserve">
|
<data name="menuGenRegionGroup" xml:space="preserve">
|
||||||
<value>Group by Region</value>
|
<value>Group by Region</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="TbIcmpRoutingPolicy" xml:space="preserve">
|
||||||
|
<value>ICMP routing policy</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
|
|
@ -1668,4 +1668,7 @@ The "Get Certificate" action may fail if a self-signed certificate is used or if
|
||||||
<data name="menuGenRegionGroup" xml:space="preserve">
|
<data name="menuGenRegionGroup" xml:space="preserve">
|
||||||
<value>Group by Region</value>
|
<value>Group by Region</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="TbIcmpRoutingPolicy" xml:space="preserve">
|
||||||
|
<value>ICMP routing policy</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
|
|
@ -1671,4 +1671,7 @@ The "Get Certificate" action may fail if a self-signed certificate is used or if
|
||||||
<data name="menuGenRegionGroup" xml:space="preserve">
|
<data name="menuGenRegionGroup" xml:space="preserve">
|
||||||
<value>Group by Region</value>
|
<value>Group by Region</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="TbIcmpRoutingPolicy" xml:space="preserve">
|
||||||
|
<value>ICMP routing policy</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
|
|
@ -1671,4 +1671,7 @@ The "Get Certificate" action may fail if a self-signed certificate is used or if
|
||||||
<data name="menuGenRegionGroup" xml:space="preserve">
|
<data name="menuGenRegionGroup" xml:space="preserve">
|
||||||
<value>Group by Region</value>
|
<value>Group by Region</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="TbIcmpRoutingPolicy" xml:space="preserve">
|
||||||
|
<value>ICMP routing policy</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
|
|
@ -1671,4 +1671,7 @@ The "Get Certificate" action may fail if a self-signed certificate is used or if
|
||||||
<data name="menuGenRegionGroup" xml:space="preserve">
|
<data name="menuGenRegionGroup" xml:space="preserve">
|
||||||
<value>Group by Region</value>
|
<value>Group by Region</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="TbIcmpRoutingPolicy" xml:space="preserve">
|
||||||
|
<value>ICMP routing policy</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
|
|
@ -1668,4 +1668,7 @@
|
||||||
<data name="menuGenRegionGroup" xml:space="preserve">
|
<data name="menuGenRegionGroup" xml:space="preserve">
|
||||||
<value>按地区分组</value>
|
<value>按地区分组</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="TbIcmpRoutingPolicy" xml:space="preserve">
|
||||||
|
<value>ICMP 路由策略</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
|
|
@ -1668,4 +1668,7 @@
|
||||||
<data name="menuGenRegionGroup" xml:space="preserve">
|
<data name="menuGenRegionGroup" xml:space="preserve">
|
||||||
<value>按區域分組</value>
|
<value>按區域分組</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="TbIcmpRoutingPolicy" xml:space="preserve">
|
||||||
|
<value>ICMP routing policy</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
|
|
@ -47,6 +47,36 @@ public partial class CoreConfigSingboxService
|
||||||
outbound = Global.DirectTag,
|
outbound = Global.DirectTag,
|
||||||
process_name = lstDirectExe
|
process_name = lstDirectExe
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// ICMP Routing
|
||||||
|
var icmpRouting = _config.TunModeItem.IcmpRouting ?? "";
|
||||||
|
if (!Global.TunIcmpRoutingPolicies.Contains(icmpRouting))
|
||||||
|
{
|
||||||
|
icmpRouting = Global.TunIcmpRoutingPolicies.First();
|
||||||
|
}
|
||||||
|
if (icmpRouting == "direct")
|
||||||
|
{
|
||||||
|
_coreConfig.route.rules.Add(new()
|
||||||
|
{
|
||||||
|
network = ["icmp"],
|
||||||
|
outbound = Global.DirectTag,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else if (icmpRouting != "rule")
|
||||||
|
{
|
||||||
|
var rejectMethod = icmpRouting switch
|
||||||
|
{
|
||||||
|
"unreachable" => "default",
|
||||||
|
"drop" => "drop",
|
||||||
|
_ => "reply",
|
||||||
|
};
|
||||||
|
_coreConfig.route.rules.Add(new()
|
||||||
|
{
|
||||||
|
network = ["icmp"],
|
||||||
|
action = "reject",
|
||||||
|
method = rejectMethod,
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_config.Inbound.First().SniffingEnabled)
|
if (_config.Inbound.First().SniffingEnabled)
|
||||||
|
|
|
||||||
|
|
@ -96,6 +96,7 @@ public class OptionSettingViewModel : MyReactiveObject
|
||||||
[Reactive] public string TunStack { get; set; }
|
[Reactive] public string TunStack { get; set; }
|
||||||
[Reactive] public int TunMtu { get; set; }
|
[Reactive] public int TunMtu { get; set; }
|
||||||
[Reactive] public bool TunEnableIPv6Address { get; set; }
|
[Reactive] public bool TunEnableIPv6Address { get; set; }
|
||||||
|
[Reactive] public string TunIcmpRouting { get; set; }
|
||||||
|
|
||||||
#endregion Tun mode
|
#endregion Tun mode
|
||||||
|
|
||||||
|
|
@ -220,6 +221,7 @@ public class OptionSettingViewModel : MyReactiveObject
|
||||||
TunStack = _config.TunModeItem.Stack;
|
TunStack = _config.TunModeItem.Stack;
|
||||||
TunMtu = _config.TunModeItem.Mtu;
|
TunMtu = _config.TunModeItem.Mtu;
|
||||||
TunEnableIPv6Address = _config.TunModeItem.EnableIPv6Address;
|
TunEnableIPv6Address = _config.TunModeItem.EnableIPv6Address;
|
||||||
|
TunIcmpRouting = _config.TunModeItem.IcmpRouting;
|
||||||
|
|
||||||
#endregion Tun mode
|
#endregion Tun mode
|
||||||
|
|
||||||
|
|
@ -379,6 +381,7 @@ public class OptionSettingViewModel : MyReactiveObject
|
||||||
_config.TunModeItem.Stack = TunStack;
|
_config.TunModeItem.Stack = TunStack;
|
||||||
_config.TunModeItem.Mtu = TunMtu;
|
_config.TunModeItem.Mtu = TunMtu;
|
||||||
_config.TunModeItem.EnableIPv6Address = TunEnableIPv6Address;
|
_config.TunModeItem.EnableIPv6Address = TunEnableIPv6Address;
|
||||||
|
_config.TunModeItem.IcmpRouting = TunIcmpRouting;
|
||||||
|
|
||||||
//coreType
|
//coreType
|
||||||
await SaveCoreType();
|
await SaveCoreType();
|
||||||
|
|
|
||||||
|
|
@ -74,23 +74,28 @@
|
||||||
<DataGridTextColumn
|
<DataGridTextColumn
|
||||||
Width="300"
|
Width="300"
|
||||||
Binding="{Binding Host}"
|
Binding="{Binding Host}"
|
||||||
Header="{x:Static resx:ResUI.TbSortingHost}" />
|
Header="{x:Static resx:ResUI.TbSortingHost}"
|
||||||
|
Tag="Host" />
|
||||||
<DataGridTextColumn
|
<DataGridTextColumn
|
||||||
Width="500"
|
Width="500"
|
||||||
Binding="{Binding Chain}"
|
Binding="{Binding Chain}"
|
||||||
Header="{x:Static resx:ResUI.TbSortingChain}" />
|
Header="{x:Static resx:ResUI.TbSortingChain}"
|
||||||
|
Tag="Chain" />
|
||||||
<DataGridTextColumn
|
<DataGridTextColumn
|
||||||
Width="80"
|
Width="80"
|
||||||
Binding="{Binding Network}"
|
Binding="{Binding Network}"
|
||||||
Header="{x:Static resx:ResUI.TbSortingNetwork}" />
|
Header="{x:Static resx:ResUI.TbSortingNetwork}"
|
||||||
|
Tag="Network" />
|
||||||
<DataGridTextColumn
|
<DataGridTextColumn
|
||||||
Width="160"
|
Width="160"
|
||||||
Binding="{Binding Type}"
|
Binding="{Binding Type}"
|
||||||
Header="{x:Static resx:ResUI.TbSortingType}" />
|
Header="{x:Static resx:ResUI.TbSortingType}"
|
||||||
|
Tag="Type" />
|
||||||
<DataGridTextColumn
|
<DataGridTextColumn
|
||||||
Width="100"
|
Width="100"
|
||||||
Binding="{Binding Elapsed}"
|
Binding="{Binding Elapsed}"
|
||||||
Header="{x:Static resx:ResUI.TbSortingTime}" />
|
Header="{x:Static resx:ResUI.TbSortingTime}"
|
||||||
|
Tag="Elapsed" />
|
||||||
</DataGrid.Columns>
|
</DataGrid.Columns>
|
||||||
</DataGrid>
|
</DataGrid>
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,15 @@ namespace v2rayN.Desktop.Views;
|
||||||
|
|
||||||
public partial class ClashConnectionsView : ReactiveUserControl<ClashConnectionsViewModel>
|
public partial class ClashConnectionsView : ReactiveUserControl<ClashConnectionsViewModel>
|
||||||
{
|
{
|
||||||
|
private static Config _config;
|
||||||
|
private static readonly string _tag = "ClashConnectionsView";
|
||||||
|
|
||||||
public ClashConnectionsView()
|
public ClashConnectionsView()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
|
_config = AppManager.Instance.Config;
|
||||||
|
|
||||||
ViewModel = new ClashConnectionsViewModel(UpdateViewHandler);
|
ViewModel = new ClashConnectionsViewModel(UpdateViewHandler);
|
||||||
btnAutofitColumnWidth.Click += BtnAutofitColumnWidth_Click;
|
btnAutofitColumnWidth.Click += BtnAutofitColumnWidth_Click;
|
||||||
|
|
||||||
|
|
@ -19,7 +25,15 @@ public partial class ClashConnectionsView : ReactiveUserControl<ClashConnections
|
||||||
this.Bind(ViewModel, vm => vm.HostFilter, v => v.txtHostFilter.Text).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.HostFilter, v => v.txtHostFilter.Text).DisposeWith(disposables);
|
||||||
this.BindCommand(ViewModel, vm => vm.ConnectionCloseAllCmd, v => v.btnConnectionCloseAll).DisposeWith(disposables);
|
this.BindCommand(ViewModel, vm => vm.ConnectionCloseAllCmd, v => v.btnConnectionCloseAll).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.AutoRefresh, v => v.togAutoRefresh.IsChecked).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.AutoRefresh, v => v.togAutoRefresh.IsChecked).DisposeWith(disposables);
|
||||||
|
|
||||||
|
AppEvents.AppExitRequested
|
||||||
|
.AsObservable()
|
||||||
|
.ObserveOn(RxApp.MainThreadScheduler)
|
||||||
|
.Subscribe(_ => StorageUI())
|
||||||
|
.DisposeWith(disposables);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
RestoreUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<bool> UpdateViewHandler(EViewAction action, object? obj)
|
private async Task<bool> UpdateViewHandler(EViewAction action, object? obj)
|
||||||
|
|
@ -51,4 +65,74 @@ public partial class ClashConnectionsView : ReactiveUserControl<ClashConnections
|
||||||
{
|
{
|
||||||
ViewModel?.ClashConnectionClose(false);
|
ViewModel?.ClashConnectionClose(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region UI
|
||||||
|
|
||||||
|
private void RestoreUI()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var lvColumnItem = _config.ClashUIItem?.ConnectionsColumnItem?.OrderBy(t => t.Index).ToList();
|
||||||
|
if (lvColumnItem == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var displayIndex = 0;
|
||||||
|
foreach (var item in lvColumnItem)
|
||||||
|
{
|
||||||
|
foreach (var item2 in lstConnections.Columns)
|
||||||
|
{
|
||||||
|
if (item2.Tag == null)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (item2.Tag.Equals(item.Name))
|
||||||
|
{
|
||||||
|
if (item.Width < 0)
|
||||||
|
{
|
||||||
|
item2.IsVisible = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
item2.Width = new DataGridLength(item.Width, DataGridLengthUnitType.Pixel);
|
||||||
|
item2.DisplayIndex = displayIndex++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Logging.SaveLog(_tag, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void StorageUI()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
List<ColumnItem> lvColumnItem = new();
|
||||||
|
foreach (var item2 in lstConnections.Columns)
|
||||||
|
{
|
||||||
|
if (item2.Tag == null)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
lvColumnItem.Add(new()
|
||||||
|
{
|
||||||
|
Name = (string)item2.Tag,
|
||||||
|
Width = (int)(item2.IsVisible == true ? item2.ActualWidth : -1),
|
||||||
|
Index = item2.DisplayIndex
|
||||||
|
});
|
||||||
|
}
|
||||||
|
_config.ClashUIItem.ConnectionsColumnItem = lvColumnItem;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Logging.SaveLog(_tag, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion UI
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -837,6 +837,20 @@
|
||||||
Margin="{StaticResource Margin4}"
|
Margin="{StaticResource Margin4}"
|
||||||
HorizontalAlignment="Left" />
|
HorizontalAlignment="Left" />
|
||||||
|
|
||||||
|
<TextBlock
|
||||||
|
Grid.Row="6"
|
||||||
|
Grid.Column="0"
|
||||||
|
Margin="{StaticResource Margin4}"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Text="{x:Static resx:ResUI.TbIcmpRoutingPolicy}" />
|
||||||
|
<ComboBox
|
||||||
|
x:Name="cmbIcmpRoutingPolicy"
|
||||||
|
Grid.Row="6"
|
||||||
|
Grid.Column="1"
|
||||||
|
Width="200"
|
||||||
|
Margin="{StaticResource Margin4}"
|
||||||
|
HorizontalAlignment="Left" />
|
||||||
|
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Grid.Row="7"
|
Grid.Row="7"
|
||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@ public partial class OptionSettingWindow : WindowBase<OptionSettingViewModel>
|
||||||
cmbmux4SboxProtocol.ItemsSource = Global.SingboxMuxs;
|
cmbmux4SboxProtocol.ItemsSource = Global.SingboxMuxs;
|
||||||
cmbMtu.ItemsSource = Global.TunMtus;
|
cmbMtu.ItemsSource = Global.TunMtus;
|
||||||
cmbStack.ItemsSource = Global.TunStacks;
|
cmbStack.ItemsSource = Global.TunStacks;
|
||||||
|
cmbIcmpRoutingPolicy.ItemsSource = Global.TunIcmpRoutingPolicies;
|
||||||
|
|
||||||
cmbCoreType1.ItemsSource = Global.CoreTypes;
|
cmbCoreType1.ItemsSource = Global.CoreTypes;
|
||||||
cmbCoreType2.ItemsSource = Global.CoreTypes;
|
cmbCoreType2.ItemsSource = Global.CoreTypes;
|
||||||
|
|
@ -115,6 +116,7 @@ public partial class OptionSettingWindow : WindowBase<OptionSettingViewModel>
|
||||||
this.Bind(ViewModel, vm => vm.TunStack, v => v.cmbStack.SelectedValue).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.TunStack, v => v.cmbStack.SelectedValue).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.TunMtu, v => v.cmbMtu.SelectedValue).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.TunMtu, v => v.cmbMtu.SelectedValue).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.TunEnableIPv6Address, v => v.togEnableIPv6Address.IsChecked).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.TunEnableIPv6Address, v => v.togEnableIPv6Address.IsChecked).DisposeWith(disposables);
|
||||||
|
this.Bind(ViewModel, vm => vm.TunIcmpRouting, v => v.cmbIcmpRoutingPolicy.SelectedValue).DisposeWith(disposables);
|
||||||
|
|
||||||
this.Bind(ViewModel, vm => vm.CoreType1, v => v.cmbCoreType1.SelectedValue).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.CoreType1, v => v.cmbCoreType1.SelectedValue).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.CoreType2, v => v.cmbCoreType2.SelectedValue).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.CoreType2, v => v.cmbCoreType2.SelectedValue).DisposeWith(disposables);
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ public partial class ProfilesView : ReactiveUserControl<ProfilesViewModel>
|
||||||
{
|
{
|
||||||
private static Config _config;
|
private static Config _config;
|
||||||
private Window? _window;
|
private Window? _window;
|
||||||
|
private static readonly string _tag = "ProfilesView";
|
||||||
|
|
||||||
public ProfilesView()
|
public ProfilesView()
|
||||||
{
|
{
|
||||||
|
|
@ -381,7 +382,7 @@ public partial class ProfilesView : ReactiveUserControl<ProfilesViewModel>
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Logging.SaveLog("ProfilesView", ex);
|
Logging.SaveLog(_tag, ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -399,53 +400,67 @@ public partial class ProfilesView : ReactiveUserControl<ProfilesViewModel>
|
||||||
|
|
||||||
private void RestoreUI()
|
private void RestoreUI()
|
||||||
{
|
{
|
||||||
var lvColumnItem = _config.UiItem.MainColumnItem.OrderBy(t => t.Index).ToList();
|
try
|
||||||
var displayIndex = 0;
|
|
||||||
foreach (var item in lvColumnItem)
|
|
||||||
{
|
{
|
||||||
|
var lvColumnItem = _config.UiItem.MainColumnItem.OrderBy(t => t.Index).ToList();
|
||||||
|
var displayIndex = 0;
|
||||||
|
foreach (var item in lvColumnItem)
|
||||||
|
{
|
||||||
|
foreach (var item2 in lstProfiles.Columns)
|
||||||
|
{
|
||||||
|
if (item2.Tag == null)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (item2.Tag.Equals(item.Name))
|
||||||
|
{
|
||||||
|
if (item.Width < 0)
|
||||||
|
{
|
||||||
|
item2.IsVisible = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
item2.Width = new DataGridLength(item.Width, DataGridLengthUnitType.Pixel);
|
||||||
|
item2.DisplayIndex = displayIndex++;
|
||||||
|
}
|
||||||
|
if (item.Name.ToLower().StartsWith("to"))
|
||||||
|
{
|
||||||
|
item2.IsVisible = _config.GuiItem.EnableStatistics;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Logging.SaveLog(_tag, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void StorageUI()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
List<ColumnItem> lvColumnItem = new();
|
||||||
foreach (var item2 in lstProfiles.Columns)
|
foreach (var item2 in lstProfiles.Columns)
|
||||||
{
|
{
|
||||||
if (item2.Tag == null)
|
if (item2.Tag == null)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (item2.Tag.Equals(item.Name))
|
lvColumnItem.Add(new()
|
||||||
{
|
{
|
||||||
if (item.Width < 0)
|
Name = (string)item2.Tag,
|
||||||
{
|
Width = (int)(item2.IsVisible == true ? item2.ActualWidth : -1),
|
||||||
item2.IsVisible = false;
|
Index = item2.DisplayIndex
|
||||||
}
|
});
|
||||||
else
|
|
||||||
{
|
|
||||||
item2.Width = new DataGridLength(item.Width, DataGridLengthUnitType.Pixel);
|
|
||||||
item2.DisplayIndex = displayIndex++;
|
|
||||||
}
|
|
||||||
if (item.Name.ToLower().StartsWith("to"))
|
|
||||||
{
|
|
||||||
item2.IsVisible = _config.GuiItem.EnableStatistics;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
_config.UiItem.MainColumnItem = lvColumnItem;
|
||||||
}
|
}
|
||||||
}
|
catch (Exception ex)
|
||||||
|
|
||||||
private void StorageUI()
|
|
||||||
{
|
|
||||||
List<ColumnItem> lvColumnItem = new();
|
|
||||||
foreach (var item2 in lstProfiles.Columns)
|
|
||||||
{
|
{
|
||||||
if (item2.Tag == null)
|
Logging.SaveLog(_tag, ex);
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
lvColumnItem.Add(new()
|
|
||||||
{
|
|
||||||
Name = (string)item2.Tag,
|
|
||||||
Width = (int)(item2.IsVisible == true ? item2.ActualWidth : -1),
|
|
||||||
Index = item2.DisplayIndex
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
_config.UiItem.MainColumnItem = lvColumnItem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion UI
|
#endregion UI
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
x:Class="v2rayN.Views.ClashConnectionsView"
|
x:Class="v2rayN.Views.ClashConnectionsView"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:base="clr-namespace:v2rayN.Base"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
|
@ -78,25 +79,30 @@
|
||||||
</ContextMenu>
|
</ContextMenu>
|
||||||
</DataGrid.ContextMenu>
|
</DataGrid.ContextMenu>
|
||||||
<DataGrid.Columns>
|
<DataGrid.Columns>
|
||||||
<DataGridTextColumn
|
<base:MyDGTextColumn
|
||||||
Width="300"
|
Width="300"
|
||||||
Binding="{Binding Host}"
|
Binding="{Binding Host}"
|
||||||
|
ExName="Host"
|
||||||
Header="{x:Static resx:ResUI.TbSortingHost}" />
|
Header="{x:Static resx:ResUI.TbSortingHost}" />
|
||||||
<DataGridTextColumn
|
<base:MyDGTextColumn
|
||||||
Width="500"
|
Width="500"
|
||||||
Binding="{Binding Chain}"
|
Binding="{Binding Chain}"
|
||||||
|
ExName="Chain"
|
||||||
Header="{x:Static resx:ResUI.TbSortingChain}" />
|
Header="{x:Static resx:ResUI.TbSortingChain}" />
|
||||||
<DataGridTextColumn
|
<base:MyDGTextColumn
|
||||||
Width="80"
|
Width="80"
|
||||||
Binding="{Binding Network}"
|
Binding="{Binding Network}"
|
||||||
|
ExName="Network"
|
||||||
Header="{x:Static resx:ResUI.TbSortingNetwork}" />
|
Header="{x:Static resx:ResUI.TbSortingNetwork}" />
|
||||||
<DataGridTextColumn
|
<base:MyDGTextColumn
|
||||||
Width="160"
|
Width="160"
|
||||||
Binding="{Binding Type}"
|
Binding="{Binding Type}"
|
||||||
|
ExName="Type"
|
||||||
Header="{x:Static resx:ResUI.TbSortingType}" />
|
Header="{x:Static resx:ResUI.TbSortingType}" />
|
||||||
<DataGridTextColumn
|
<base:MyDGTextColumn
|
||||||
Width="100"
|
Width="100"
|
||||||
Binding="{Binding Elapsed}"
|
Binding="{Binding Elapsed}"
|
||||||
|
ExName="Elapsed"
|
||||||
Header="{x:Static resx:ResUI.TbSortingTime}" />
|
Header="{x:Static resx:ResUI.TbSortingTime}" />
|
||||||
</DataGrid.Columns>
|
</DataGrid.Columns>
|
||||||
</DataGrid>
|
</DataGrid>
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
|
using v2rayN.Base;
|
||||||
|
|
||||||
namespace v2rayN.Views;
|
namespace v2rayN.Views;
|
||||||
|
|
||||||
|
|
@ -7,9 +8,14 @@ namespace v2rayN.Views;
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class ClashConnectionsView
|
public partial class ClashConnectionsView
|
||||||
{
|
{
|
||||||
|
private static Config _config;
|
||||||
|
private static readonly string _tag = "ClashConnectionsView";
|
||||||
|
|
||||||
public ClashConnectionsView()
|
public ClashConnectionsView()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
_config = AppManager.Instance.Config;
|
||||||
|
|
||||||
ViewModel = new ClashConnectionsViewModel(UpdateViewHandler);
|
ViewModel = new ClashConnectionsViewModel(UpdateViewHandler);
|
||||||
btnAutofitColumnWidth.Click += BtnAutofitColumnWidth_Click;
|
btnAutofitColumnWidth.Click += BtnAutofitColumnWidth_Click;
|
||||||
|
|
||||||
|
|
@ -24,7 +30,15 @@ public partial class ClashConnectionsView
|
||||||
this.Bind(ViewModel, vm => vm.HostFilter, v => v.txtHostFilter.Text).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.HostFilter, v => v.txtHostFilter.Text).DisposeWith(disposables);
|
||||||
this.BindCommand(ViewModel, vm => vm.ConnectionCloseAllCmd, v => v.btnConnectionCloseAll).DisposeWith(disposables);
|
this.BindCommand(ViewModel, vm => vm.ConnectionCloseAllCmd, v => v.btnConnectionCloseAll).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.AutoRefresh, v => v.togAutoRefresh.IsChecked).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.AutoRefresh, v => v.togAutoRefresh.IsChecked).DisposeWith(disposables);
|
||||||
|
|
||||||
|
AppEvents.AppExitRequested
|
||||||
|
.AsObservable()
|
||||||
|
.ObserveOn(RxApp.MainThreadScheduler)
|
||||||
|
.Subscribe(_ => StorageUI())
|
||||||
|
.DisposeWith(disposables);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
RestoreUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<bool> UpdateViewHandler(EViewAction action, object? obj)
|
private async Task<bool> UpdateViewHandler(EViewAction action, object? obj)
|
||||||
|
|
@ -48,7 +62,7 @@ public partial class ClashConnectionsView
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Logging.SaveLog("ClashConnectionsView", ex);
|
Logging.SaveLog(_tag, ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -56,4 +70,71 @@ public partial class ClashConnectionsView
|
||||||
{
|
{
|
||||||
ViewModel?.ClashConnectionClose(false);
|
ViewModel?.ClashConnectionClose(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region UI
|
||||||
|
|
||||||
|
private void RestoreUI()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var lvColumnItem = _config.ClashUIItem?.ConnectionsColumnItem?.OrderBy(t => t.Index).ToList();
|
||||||
|
if (lvColumnItem == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var displayIndex = 0;
|
||||||
|
foreach (var item in lvColumnItem)
|
||||||
|
{
|
||||||
|
foreach (var col in lstConnections.Columns.Cast<MyDGTextColumn>())
|
||||||
|
{
|
||||||
|
if (col.ExName == item.Name)
|
||||||
|
{
|
||||||
|
if (item.Width > 0)
|
||||||
|
{
|
||||||
|
col.Width = item.Width;
|
||||||
|
}
|
||||||
|
|
||||||
|
col.DisplayIndex = displayIndex++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Logging.SaveLog(_tag, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void StorageUI()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
List<ColumnItem> lvColumnItem = new();
|
||||||
|
foreach (var col in lstConnections.Columns.Cast<MyDGTextColumn>())
|
||||||
|
{
|
||||||
|
var name = col.ExName;
|
||||||
|
if (string.IsNullOrWhiteSpace(name))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
lvColumnItem.Add(new()
|
||||||
|
{
|
||||||
|
Name = name,
|
||||||
|
Width = (int)col.ActualWidth,
|
||||||
|
Index = col.DisplayIndex
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
_config.ClashUIItem.ConnectionsColumnItem = lvColumnItem;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Logging.SaveLog(_tag, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion UI
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1090,6 +1090,22 @@
|
||||||
HorizontalAlignment="Left"
|
HorizontalAlignment="Left"
|
||||||
Style="{StaticResource DefComboBox}" />
|
Style="{StaticResource DefComboBox}" />
|
||||||
|
|
||||||
|
<TextBlock
|
||||||
|
Grid.Row="6"
|
||||||
|
Grid.Column="0"
|
||||||
|
Margin="{StaticResource Margin8}"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Style="{StaticResource ToolbarTextBlock}"
|
||||||
|
Text="{x:Static resx:ResUI.TbIcmpRoutingPolicy}" />
|
||||||
|
<ComboBox
|
||||||
|
x:Name="cmbIcmpRoutingPolicy"
|
||||||
|
Grid.Row="6"
|
||||||
|
Grid.Column="1"
|
||||||
|
Width="200"
|
||||||
|
Margin="{StaticResource Margin8}"
|
||||||
|
HorizontalAlignment="Left"
|
||||||
|
Style="{StaticResource DefComboBox}" />
|
||||||
|
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Grid.Row="7"
|
Grid.Row="7"
|
||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@ public partial class OptionSettingWindow
|
||||||
cmbmux4SboxProtocol.ItemsSource = Global.SingboxMuxs;
|
cmbmux4SboxProtocol.ItemsSource = Global.SingboxMuxs;
|
||||||
cmbMtu.ItemsSource = Global.TunMtus;
|
cmbMtu.ItemsSource = Global.TunMtus;
|
||||||
cmbStack.ItemsSource = Global.TunStacks;
|
cmbStack.ItemsSource = Global.TunStacks;
|
||||||
|
cmbIcmpRoutingPolicy.ItemsSource = Global.TunIcmpRoutingPolicies;
|
||||||
|
|
||||||
cmbCoreType1.ItemsSource = Global.CoreTypes;
|
cmbCoreType1.ItemsSource = Global.CoreTypes;
|
||||||
cmbCoreType2.ItemsSource = Global.CoreTypes;
|
cmbCoreType2.ItemsSource = Global.CoreTypes;
|
||||||
|
|
@ -120,6 +121,7 @@ public partial class OptionSettingWindow
|
||||||
this.Bind(ViewModel, vm => vm.TunStack, v => v.cmbStack.Text).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.TunStack, v => v.cmbStack.Text).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.TunMtu, v => v.cmbMtu.Text).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.TunMtu, v => v.cmbMtu.Text).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.TunEnableIPv6Address, v => v.togEnableIPv6Address.IsChecked).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.TunEnableIPv6Address, v => v.togEnableIPv6Address.IsChecked).DisposeWith(disposables);
|
||||||
|
this.Bind(ViewModel, vm => vm.TunIcmpRouting, v => v.cmbIcmpRoutingPolicy.Text).DisposeWith(disposables);
|
||||||
|
|
||||||
this.Bind(ViewModel, vm => vm.CoreType1, v => v.cmbCoreType1.Text).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.CoreType1, v => v.cmbCoreType1.Text).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.CoreType2, v => v.cmbCoreType2.Text).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.CoreType2, v => v.cmbCoreType2.Text).DisposeWith(disposables);
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ namespace v2rayN.Views;
|
||||||
public partial class ProfilesView
|
public partial class ProfilesView
|
||||||
{
|
{
|
||||||
private static Config _config;
|
private static Config _config;
|
||||||
|
private static readonly string _tag = "ProfilesView";
|
||||||
|
|
||||||
public ProfilesView()
|
public ProfilesView()
|
||||||
{
|
{
|
||||||
|
|
@ -339,7 +340,7 @@ public partial class ProfilesView
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Logging.SaveLog("ProfilesView", ex);
|
Logging.SaveLog(_tag, ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -357,46 +358,59 @@ public partial class ProfilesView
|
||||||
|
|
||||||
private void RestoreUI()
|
private void RestoreUI()
|
||||||
{
|
{
|
||||||
var lvColumnItem = _config.UiItem.MainColumnItem.OrderBy(t => t.Index).ToList();
|
try
|
||||||
var displayIndex = 0;
|
|
||||||
foreach (var item in lvColumnItem)
|
|
||||||
{
|
{
|
||||||
foreach (MyDGTextColumn item2 in lstProfiles.Columns)
|
var lvColumnItem = _config.UiItem.MainColumnItem.OrderBy(t => t.Index).ToList();
|
||||||
|
var displayIndex = 0;
|
||||||
|
foreach (var item in lvColumnItem)
|
||||||
{
|
{
|
||||||
if (item2.ExName == item.Name)
|
foreach (var item2 in lstProfiles.Columns.Cast<MyDGTextColumn>())
|
||||||
{
|
{
|
||||||
if (item.Width < 0)
|
if (item2.ExName == item.Name)
|
||||||
{
|
{
|
||||||
item2.Visibility = Visibility.Hidden;
|
if (item.Width < 0)
|
||||||
}
|
{
|
||||||
else
|
item2.Visibility = Visibility.Hidden;
|
||||||
{
|
}
|
||||||
item2.Width = item.Width;
|
else
|
||||||
item2.DisplayIndex = displayIndex++;
|
{
|
||||||
}
|
item2.Width = item.Width;
|
||||||
if (item.Name.ToLower().StartsWith("to"))
|
item2.DisplayIndex = displayIndex++;
|
||||||
{
|
}
|
||||||
item2.Visibility = _config.GuiItem.EnableStatistics ? Visibility.Visible : Visibility.Hidden;
|
if (item.Name.ToLower().StartsWith("to"))
|
||||||
|
{
|
||||||
|
item2.Visibility = _config.GuiItem.EnableStatistics ? Visibility.Visible : Visibility.Hidden;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Logging.SaveLog(_tag, ex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void StorageUI()
|
private void StorageUI()
|
||||||
{
|
{
|
||||||
List<ColumnItem> lvColumnItem = new();
|
try
|
||||||
foreach (var t in lstProfiles.Columns)
|
|
||||||
{
|
{
|
||||||
var item2 = (MyDGTextColumn)t;
|
List<ColumnItem> lvColumnItem = new();
|
||||||
lvColumnItem.Add(new()
|
foreach (var item2 in lstProfiles.Columns.Cast<MyDGTextColumn>())
|
||||||
{
|
{
|
||||||
Name = item2.ExName,
|
lvColumnItem.Add(new()
|
||||||
Width = (int)(item2.Visibility == Visibility.Visible ? item2.ActualWidth : -1),
|
{
|
||||||
Index = item2.DisplayIndex
|
Name = item2.ExName,
|
||||||
});
|
Width = (int)(item2.Visibility == Visibility.Visible ? item2.ActualWidth : -1),
|
||||||
|
Index = item2.DisplayIndex
|
||||||
|
});
|
||||||
|
}
|
||||||
|
_config.UiItem.MainColumnItem = lvColumnItem;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Logging.SaveLog(_tag, ex);
|
||||||
}
|
}
|
||||||
_config.UiItem.MainColumnItem = lvColumnItem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion UI
|
#endregion UI
|
||||||
|
|
@ -405,7 +419,7 @@ public partial class ProfilesView
|
||||||
|
|
||||||
private Point startPoint = new();
|
private Point startPoint = new();
|
||||||
private int startIndex = -1;
|
private int startIndex = -1;
|
||||||
private string formatData = "ProfileItemModel";
|
private readonly string formatData = "ProfileItemModel";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Helper to search up the VisualTree
|
/// Helper to search up the VisualTree
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue