Optimize custom configuration

pull/3165/head
2dust 2 years ago
parent c0c0961b2b
commit 917dc1803c

@ -26,6 +26,7 @@ namespace v2rayN.ViewModels
public ReactiveCommand<Unit, Unit> BrowseServerCmd { get; }
public ReactiveCommand<Unit, Unit> EditServerCmd { get; }
public ReactiveCommand<Unit, Unit> SaveServerCmd { get; }
public bool IsModified { get; set; }
public AddServer2ViewModel(ProfileItem profileItem, Window view)
{
@ -128,7 +129,11 @@ namespace v2rayN.ViewModels
if (ConfigHandler.AddCustomServer(ref _config, item, false) == 0)
{
_noticeHandler?.Enqueue(ResUI.SuccessfullyImportedCustomServer);
_view.DialogResult = true;
if (!Utils.IsNullOrEmpty(item.indexId))
{
SelectedSource = Utils.DeepCopy(item);
}
IsModified = true;
}
else
{

@ -800,6 +800,7 @@ namespace v2rayN.ViewModels
{
subid = _subId,
configType = eConfigType,
displayLog = false
};
}
else

@ -44,7 +44,14 @@ namespace v2rayN.Views
}
private void btnCancel_Click(object sender, System.Windows.RoutedEventArgs e)
{
this.Close();
if (ViewModel?.IsModified == true)
{
this.DialogResult = true;
}
else
{
this.Close();
}
}
}

Loading…
Cancel
Save