server list add checkbox

This commit is contained in:
lazycat75246 2023-12-15 10:26:53 +08:00
parent 05ff7341bb
commit c957288480
10 changed files with 53 additions and 3 deletions

View file

@ -0,0 +1,9 @@
using System.Windows.Controls;
namespace v2rayN.Base
{
internal class MyDGBoolColumn : DataGridCheckBoxColumn
{
public string ExName { get; set; }
}
}

View file

@ -813,6 +813,7 @@ namespace v2rayN.Handler
from t33 in t3b.DefaultIfEmpty()
select new ProfileItemModel
{
autoSwitch= t.autoSwitch,
indexId = t.indexId,
configType = t.configType,
remarks = t.remarks,

View file

@ -3,6 +3,7 @@
public enum EServerColName
{
def = 0,
autoSwitch,
configType,
remarks,
address,

View file

@ -8,6 +8,7 @@ namespace v2rayN.Mode
public ProfileItem()
{
indexId = string.Empty;
autoSwitch = false;
configType = EConfigType.VMess;
configVersion = 2;
address = string.Empty;
@ -89,6 +90,7 @@ namespace v2rayN.Mode
/// </summary>
public EConfigType configType { get; set; }
public bool autoSwitch { get; set; }
/// <summary>
/// 版本(现在=2)
/// </summary>

View file

@ -366,6 +366,15 @@ namespace v2rayN.Resx {
}
}
/// <summary>
/// 查找类似 Automatic update interval(minutes) 的本地化字符串。
/// </summary>
public static string LvAutoSwitch {
get {
return ResourceManager.GetString("LvAutoSwitch", resourceCulture);
}
}
/// <summary>
/// 查找类似 Automatic update interval(minutes) 的本地化字符串。
/// </summary>

View file

@ -204,6 +204,9 @@
<data name="LvServiceType" xml:space="preserve">
<value>Type</value>
</data>
<data name="LvAutoSwitch" xml:space="preserve">
<value>AutoSwitch</value>
</data>
<data name="LvSubscription" xml:space="preserve">
<value>Subs group</value>
</data>

View file

@ -204,6 +204,9 @@
<data name="LvServiceType" xml:space="preserve">
<value>类型</value>
</data>
<data name="LvAutoSwitch" xml:space="preserve">
<value>切换</value>
</data>
<data name="LvSubscription" xml:space="preserve">
<value>订阅分组</value>
</data>

View file

@ -818,6 +818,7 @@ namespace v2rayN.ViewModels
select new ProfileItemModel
{
indexId = t.indexId,
autoSwitch=t.autoSwitch,
configType = t.configType,
remarks = t.remarks,
address = t.address,

View file

@ -667,8 +667,23 @@
</Style>
</DataGrid.Resources>
<DataGrid.Columns>
<base:MyDGTextColumn
<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
Width="80"
Binding="{Binding configType}"
ExName="configType"

View file

@ -563,7 +563,13 @@ namespace v2rayN.Views
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
#region Drag and Drop