https://github.com/2dust/v2rayN/issues/9936
This commit is contained in:
2dust
2026-08-14 12:08:43 +08:00
parent e7cc4c832e
commit 230a2f6773
6 changed files with 52 additions and 21 deletions
@@ -9,6 +9,11 @@ public partial class SubEditViewModel : MyReactiveObject, ICloseable
[Reactive]
public partial string CustomCoreType { get; set; }
[Reactive]
public partial string PrevProfile { get; set; }
[Reactive]
public partial string NextProfile { get; set; }
public ReactiveCommand<RxVoid, RxVoid> SelectPrevProfileCmd { get; }
public ReactiveCommand<RxVoid, RxVoid> SelectNextProfileCmd { get; }
@@ -23,8 +28,7 @@ public partial class SubEditViewModel : MyReactiveObject, ICloseable
var profileItem = await SelectProfileAsync();
if (profileItem != null)
{
SelectedSource?.PrevProfile = profileItem.Remarks;
SelectedSource = JsonUtils.DeepCopy(SelectedSource);
PrevProfile = profileItem.Remarks;
}
});
SelectNextProfileCmd = ReactiveCommand.CreateFromTask(async () =>
@@ -32,8 +36,7 @@ public partial class SubEditViewModel : MyReactiveObject, ICloseable
var profileItem = await SelectProfileAsync();
if (profileItem != null)
{
SelectedSource?.NextProfile = profileItem.Remarks;
SelectedSource = JsonUtils.DeepCopy(SelectedSource);
NextProfile = profileItem.Remarks;
}
});
SaveCmd = ReactiveCommand.CreateFromTask(async () =>
@@ -43,6 +46,8 @@ public partial class SubEditViewModel : MyReactiveObject, ICloseable
SelectedSource = subItem.Id.IsNullOrEmpty() ? subItem : JsonUtils.DeepCopy(subItem);
CustomCoreType = SelectedSource.CustomCoreType?.ToString() ?? string.Empty;
PrevProfile = SelectedSource.PrevProfile;
NextProfile = SelectedSource.NextProfile;
}
private async Task SaveSubAsync()
@@ -72,6 +77,8 @@ public partial class SubEditViewModel : MyReactiveObject, ICloseable
}
SelectedSource.CustomCoreType = Enum.TryParse<ECoreType>(CustomCoreType, out var coreType) ? coreType : null;
SelectedSource.PrevProfile = PrevProfile;
SelectedSource.NextProfile = NextProfile;
if (await ConfigHandler.AddSubItem(_config, SelectedSource) == 0)
{