mirror of
https://github.com/2dust/v2rayN.git
synced 2025-08-30 06:46: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()
|
||||
select new ProfileItemModel
|
||||
{
|
||||
autoSwitch= t.autoSwitch,
|
||||
indexId = t.indexId,
|
||||
configType = t.configType,
|
||||
remarks = t.remarks,
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
public enum EServerColName
|
||||
{
|
||||
def = 0,
|
||||
autoSwitch,
|
||||
configType,
|
||||
remarks,
|
||||
address,
|
||||
|
|
|
@ -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>
|
||||
|
|
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>
|
||||
/// 查找类似 Automatic update interval(minutes) 的本地化字符串。
|
||||
/// </summary>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue