mirror of
https://github.com/2dust/v2rayN.git
synced 2025-05-02 21:28:51 +00:00
Add SaveFileDialog
This commit is contained in:
parent
c061a24948
commit
d03a86292e
2 changed files with 22 additions and 8 deletions
|
@ -35,5 +35,25 @@ namespace v2rayN
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool? SaveFileDialog(out string fileName, string filter)
|
||||
{
|
||||
fileName = string.Empty;
|
||||
|
||||
SaveFileDialog fileDialog = new()
|
||||
{
|
||||
Filter = filter,
|
||||
FilterIndex = 2,
|
||||
RestoreDirectory = true
|
||||
};
|
||||
if (fileDialog.ShowDialog() != true)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
fileName = fileDialog.FileName;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -129,17 +129,11 @@ namespace v2rayN.Views
|
|||
|
||||
case EViewAction.SaveFileDialog:
|
||||
if (obj is null) return false;
|
||||
SaveFileDialog fileDialog = new()
|
||||
{
|
||||
Filter = "Config|*.json",
|
||||
FilterIndex = 2,
|
||||
RestoreDirectory = true
|
||||
};
|
||||
if (fileDialog.ShowDialog() != true)
|
||||
if (UI.SaveFileDialog(out string fileName, "Config|*.json") != true)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
ViewModel?.Export2ClientConfigResult(fileDialog.FileName, (ProfileItem)obj);
|
||||
ViewModel?.Export2ClientConfigResult(fileName, (ProfileItem)obj);
|
||||
break;
|
||||
|
||||
case EViewAction.AddServerWindow:
|
||||
|
|
Loading…
Reference in a new issue