mirror of https://github.com/2dust/v2rayN
Optimize custom configuration
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
|
||||
|
|
|
@ -43,9 +43,16 @@ namespace v2rayN.Views
|
|||
txtRemarks.Focus();
|
||||
}
|
||||
private void btnCancel_Click(object sender, System.Windows.RoutedEventArgs e)
|
||||
{
|
||||
if (ViewModel?.IsModified == true)
|
||||
{
|
||||
this.DialogResult = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue