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> BrowseServerCmd { get; }
|
||||||
public ReactiveCommand<Unit, Unit> EditServerCmd { get; }
|
public ReactiveCommand<Unit, Unit> EditServerCmd { get; }
|
||||||
public ReactiveCommand<Unit, Unit> SaveServerCmd { get; }
|
public ReactiveCommand<Unit, Unit> SaveServerCmd { get; }
|
||||||
|
public bool IsModified { get; set; }
|
||||||
|
|
||||||
public AddServer2ViewModel(ProfileItem profileItem, Window view)
|
public AddServer2ViewModel(ProfileItem profileItem, Window view)
|
||||||
{
|
{
|
||||||
|
@ -128,7 +129,11 @@ namespace v2rayN.ViewModels
|
||||||
if (ConfigHandler.AddCustomServer(ref _config, item, false) == 0)
|
if (ConfigHandler.AddCustomServer(ref _config, item, false) == 0)
|
||||||
{
|
{
|
||||||
_noticeHandler?.Enqueue(ResUI.SuccessfullyImportedCustomServer);
|
_noticeHandler?.Enqueue(ResUI.SuccessfullyImportedCustomServer);
|
||||||
_view.DialogResult = true;
|
if (!Utils.IsNullOrEmpty(item.indexId))
|
||||||
|
{
|
||||||
|
SelectedSource = Utils.DeepCopy(item);
|
||||||
|
}
|
||||||
|
IsModified = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -800,6 +800,7 @@ namespace v2rayN.ViewModels
|
||||||
{
|
{
|
||||||
subid = _subId,
|
subid = _subId,
|
||||||
configType = eConfigType,
|
configType = eConfigType,
|
||||||
|
displayLog = false
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -43,9 +43,16 @@ namespace v2rayN.Views
|
||||||
txtRemarks.Focus();
|
txtRemarks.Focus();
|
||||||
}
|
}
|
||||||
private void btnCancel_Click(object sender, System.Windows.RoutedEventArgs e)
|
private void btnCancel_Click(object sender, System.Windows.RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (ViewModel?.IsModified == true)
|
||||||
|
{
|
||||||
|
this.DialogResult = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
this.Close();
|
this.Close();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue