mirror of https://github.com/2dust/v2rayN
Add SaveFileDialog
parent
c061a24948
commit
d03a86292e
|
@ -35,5 +35,25 @@ namespace v2rayN
|
||||||
|
|
||||||
return true;
|
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:
|
case EViewAction.SaveFileDialog:
|
||||||
if (obj is null) return false;
|
if (obj is null) return false;
|
||||||
SaveFileDialog fileDialog = new()
|
if (UI.SaveFileDialog(out string fileName, "Config|*.json") != true)
|
||||||
{
|
|
||||||
Filter = "Config|*.json",
|
|
||||||
FilterIndex = 2,
|
|
||||||
RestoreDirectory = true
|
|
||||||
};
|
|
||||||
if (fileDialog.ShowDialog() != true)
|
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
ViewModel?.Export2ClientConfigResult(fileDialog.FileName, (ProfileItem)obj);
|
ViewModel?.Export2ClientConfigResult(fileName, (ProfileItem)obj);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EViewAction.AddServerWindow:
|
case EViewAction.AddServerWindow:
|
||||||
|
|
Loading…
Reference in New Issue