mirror of
https://github.com/2dust/v2rayN.git
synced 2025-08-30 14:56:19 +00:00
server list add checkbox
This commit is contained in:
parent
05ff7341bb
commit
c957288480
10 changed files with 53 additions and 3 deletions
9
v2rayN/v2rayN/Base/MyDGBoolColumn.cs
Normal file
9
v2rayN/v2rayN/Base/MyDGBoolColumn.cs
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
using System.Windows.Controls;
|
||||||
|
|
||||||
|
namespace v2rayN.Base
|
||||||
|
{
|
||||||
|
internal class MyDGBoolColumn : DataGridCheckBoxColumn
|
||||||
|
{
|
||||||
|
public string ExName { get; set; }
|
||||||
|
}
|
||||||
|
}
|
|
@ -813,6 +813,7 @@ namespace v2rayN.Handler
|
||||||
from t33 in t3b.DefaultIfEmpty()
|
from t33 in t3b.DefaultIfEmpty()
|
||||||
select new ProfileItemModel
|
select new ProfileItemModel
|
||||||
{
|
{
|
||||||
|
autoSwitch= t.autoSwitch,
|
||||||
indexId = t.indexId,
|
indexId = t.indexId,
|
||||||
configType = t.configType,
|
configType = t.configType,
|
||||||
remarks = t.remarks,
|
remarks = t.remarks,
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
public enum EServerColName
|
public enum EServerColName
|
||||||
{
|
{
|
||||||
def = 0,
|
def = 0,
|
||||||
|
autoSwitch,
|
||||||
configType,
|
configType,
|
||||||
remarks,
|
remarks,
|
||||||
address,
|
address,
|
||||||
|
|
|
@ -8,6 +8,7 @@ namespace v2rayN.Mode
|
||||||
public ProfileItem()
|
public ProfileItem()
|
||||||
{
|
{
|
||||||
indexId = string.Empty;
|
indexId = string.Empty;
|
||||||
|
autoSwitch = false;
|
||||||
configType = EConfigType.VMess;
|
configType = EConfigType.VMess;
|
||||||
configVersion = 2;
|
configVersion = 2;
|
||||||
address = string.Empty;
|
address = string.Empty;
|
||||||
|
@ -89,6 +90,7 @@ namespace v2rayN.Mode
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public EConfigType configType { get; set; }
|
public EConfigType configType { get; set; }
|
||||||
|
|
||||||
|
public bool autoSwitch { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 版本(现在=2)
|
/// 版本(现在=2)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
9
v2rayN/v2rayN/Resx/ResUI.Designer.cs
generated
9
v2rayN/v2rayN/Resx/ResUI.Designer.cs
generated
|
@ -366,6 +366,15 @@ namespace v2rayN.Resx {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 Automatic update interval(minutes) 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
public static string LvAutoSwitch {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("LvAutoSwitch", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找类似 Automatic update interval(minutes) 的本地化字符串。
|
/// 查找类似 Automatic update interval(minutes) 的本地化字符串。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -204,6 +204,9 @@
|
||||||
<data name="LvServiceType" xml:space="preserve">
|
<data name="LvServiceType" xml:space="preserve">
|
||||||
<value>Type</value>
|
<value>Type</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="LvAutoSwitch" xml:space="preserve">
|
||||||
|
<value>AutoSwitch</value>
|
||||||
|
</data>
|
||||||
<data name="LvSubscription" xml:space="preserve">
|
<data name="LvSubscription" xml:space="preserve">
|
||||||
<value>Subs group</value>
|
<value>Subs group</value>
|
||||||
</data>
|
</data>
|
||||||
|
|
|
@ -204,6 +204,9 @@
|
||||||
<data name="LvServiceType" xml:space="preserve">
|
<data name="LvServiceType" xml:space="preserve">
|
||||||
<value>类型</value>
|
<value>类型</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="LvAutoSwitch" xml:space="preserve">
|
||||||
|
<value>切换</value>
|
||||||
|
</data>
|
||||||
<data name="LvSubscription" xml:space="preserve">
|
<data name="LvSubscription" xml:space="preserve">
|
||||||
<value>订阅分组</value>
|
<value>订阅分组</value>
|
||||||
</data>
|
</data>
|
||||||
|
|
|
@ -818,6 +818,7 @@ namespace v2rayN.ViewModels
|
||||||
select new ProfileItemModel
|
select new ProfileItemModel
|
||||||
{
|
{
|
||||||
indexId = t.indexId,
|
indexId = t.indexId,
|
||||||
|
autoSwitch=t.autoSwitch,
|
||||||
configType = t.configType,
|
configType = t.configType,
|
||||||
remarks = t.remarks,
|
remarks = t.remarks,
|
||||||
address = t.address,
|
address = t.address,
|
||||||
|
|
|
@ -667,7 +667,22 @@
|
||||||
</Style>
|
</Style>
|
||||||
</DataGrid.Resources>
|
</DataGrid.Resources>
|
||||||
<DataGrid.Columns>
|
<DataGrid.Columns>
|
||||||
|
<base:MyDGBoolColumn
|
||||||
|
Width="Auto"
|
||||||
|
Binding="{Binding autoSwitch, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||||
|
ExName="autoSwitch"
|
||||||
|
Header="{x:Static resx:ResUI.LvAutoSwitch}">
|
||||||
|
<DataGridCheckBoxColumn.ElementStyle>
|
||||||
|
<Style TargetType="CheckBox">
|
||||||
|
<Setter Property= "HorizontalAlignment" Value= "Center" />
|
||||||
|
</Style>
|
||||||
|
</DataGridCheckBoxColumn.ElementStyle>
|
||||||
|
<DataGridCheckBoxColumn.CellStyle>
|
||||||
|
<Style>
|
||||||
|
<EventSetter Event="CheckBox.Click" Handler="AutoSwitch_Click"/>
|
||||||
|
</Style>
|
||||||
|
</DataGridCheckBoxColumn.CellStyle>
|
||||||
|
</base:MyDGBoolColumn>
|
||||||
<base:MyDGTextColumn
|
<base:MyDGTextColumn
|
||||||
Width="80"
|
Width="80"
|
||||||
Binding="{Binding configType}"
|
Binding="{Binding configType}"
|
||||||
|
|
|
@ -563,7 +563,13 @@ namespace v2rayN.Views
|
||||||
Utils.ProcessStart(item.Tag.ToString());
|
Utils.ProcessStart(item.Tag.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private void AutoSwitch_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
//CheckBox cb = sender as CheckBox;
|
||||||
|
var item = LazyConfig.Instance.GetProfileItem(ViewModel.SelectedProfile.indexId);
|
||||||
|
item.autoSwitch = ViewModel.SelectedProfile.autoSwitch;
|
||||||
|
SqliteHelper.Instance.Update(item);
|
||||||
|
}
|
||||||
#endregion UI
|
#endregion UI
|
||||||
|
|
||||||
#region Drag and Drop
|
#region Drag and Drop
|
||||||
|
|
Loading…
Reference in a new issue