mirror of
https://github.com/2dust/v2rayN.git
synced 2025-10-13 11:59:13 +00:00
Add cycle check for AddGroupServerViewModel
This commit is contained in:
parent
7a750a127e
commit
0a1d6db9d1
1 changed files with 13 additions and 0 deletions
|
@ -26,6 +26,7 @@ public class AddGroupServerViewModel : MyReactiveObject
|
||||||
|
|
||||||
//public ReactiveCommand<Unit, Unit> AddCmd { get; }
|
//public ReactiveCommand<Unit, Unit> AddCmd { get; }
|
||||||
public ReactiveCommand<Unit, Unit> RemoveCmd { get; }
|
public ReactiveCommand<Unit, Unit> RemoveCmd { get; }
|
||||||
|
|
||||||
public ReactiveCommand<Unit, Unit> MoveTopCmd { get; }
|
public ReactiveCommand<Unit, Unit> MoveTopCmd { get; }
|
||||||
public ReactiveCommand<Unit, Unit> MoveUpCmd { get; }
|
public ReactiveCommand<Unit, Unit> MoveUpCmd { get; }
|
||||||
public ReactiveCommand<Unit, Unit> MoveDownCmd { get; }
|
public ReactiveCommand<Unit, Unit> MoveDownCmd { get; }
|
||||||
|
@ -143,6 +144,7 @@ public class AddGroupServerViewModel : MyReactiveObject
|
||||||
ChildItemsObs.RemoveAt(index);
|
ChildItemsObs.RemoveAt(index);
|
||||||
ChildItemsObs.Insert(0, selectedChild);
|
ChildItemsObs.Insert(0, selectedChild);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EMove.Up:
|
case EMove.Up:
|
||||||
if (index == 0)
|
if (index == 0)
|
||||||
{
|
{
|
||||||
|
@ -151,6 +153,7 @@ public class AddGroupServerViewModel : MyReactiveObject
|
||||||
ChildItemsObs.RemoveAt(index);
|
ChildItemsObs.RemoveAt(index);
|
||||||
ChildItemsObs.Insert(index - 1, selectedChild);
|
ChildItemsObs.Insert(index - 1, selectedChild);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EMove.Down:
|
case EMove.Down:
|
||||||
if (index == ChildItemsObs.Count - 1)
|
if (index == ChildItemsObs.Count - 1)
|
||||||
{
|
{
|
||||||
|
@ -159,6 +162,7 @@ public class AddGroupServerViewModel : MyReactiveObject
|
||||||
ChildItemsObs.RemoveAt(index);
|
ChildItemsObs.RemoveAt(index);
|
||||||
ChildItemsObs.Insert(index + 1, selectedChild);
|
ChildItemsObs.Insert(index + 1, selectedChild);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EMove.Bottom:
|
case EMove.Bottom:
|
||||||
if (index == ChildItemsObs.Count - 1)
|
if (index == ChildItemsObs.Count - 1)
|
||||||
{
|
{
|
||||||
|
@ -167,6 +171,7 @@ public class AddGroupServerViewModel : MyReactiveObject
|
||||||
ChildItemsObs.RemoveAt(index);
|
ChildItemsObs.RemoveAt(index);
|
||||||
ChildItemsObs.Add(selectedChild);
|
ChildItemsObs.Add(selectedChild);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -212,6 +217,14 @@ public class AddGroupServerViewModel : MyReactiveObject
|
||||||
var s when s == ResUI.TbLeastLoad => EMultipleLoad.LeastLoad,
|
var s when s == ResUI.TbLeastLoad => EMultipleLoad.LeastLoad,
|
||||||
_ => EMultipleLoad.LeastPing,
|
_ => EMultipleLoad.LeastPing,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var hasCycle = ProfileGroupItemManager.HasCycle(profileGroup.ParentIndexId);
|
||||||
|
if (hasCycle)
|
||||||
|
{
|
||||||
|
NoticeManager.Instance.Enqueue(string.Format(ResUI.GroupSelfReference, remarks));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (await ConfigHandler.AddGroupServerCommon(_config, SelectedSource, profileGroup, true) == 0)
|
if (await ConfigHandler.AddGroupServerCommon(_config, SelectedSource, profileGroup, true) == 0)
|
||||||
{
|
{
|
||||||
NoticeManager.Instance.Enqueue(ResUI.OperationSuccess);
|
NoticeManager.Instance.Enqueue(ResUI.OperationSuccess);
|
||||||
|
|
Loading…
Reference in a new issue