Avalonia UI 的 OpenFileDialog 和 SaveFileDialog - 如何检测被单击的取消按钮
Avalonia UI's OpenFileDialog and SaveFileDialog - How to detect a cancel button being clicked
使用此处打开 SaveFileDialog 的代码,我如何检测用户是否按下取消?
SaveFileDialog SaveFileBox = new SaveFileDialog();
SaveFileBox.Title = "Save Document As...";
SaveFileBox.InitialFileName = Path.GetFullPath(DocumentFileName);
SaveFileBox.Directory = workdir;
List<FileDialogFilter> Filters = new List<FileDialogFilter>();
FileDialogFilter filter = new FileDialogFilter();
List<string> extension = new List<string>();
extension.Add("doc");
filter.Extensions = extension;
filter.Name = "Document Files";
Filters.Add(filter);
SaveFileBox.Filters = Filters;
SaveFileBox.DefaultExtension = "doc";
SettingsFileName = await SaveFileBox.ShowAsync(this);
提前致谢!!
ShowAsync 的 return 值将为 null 或空数组。
使用此处打开 SaveFileDialog 的代码,我如何检测用户是否按下取消?
SaveFileDialog SaveFileBox = new SaveFileDialog();
SaveFileBox.Title = "Save Document As...";
SaveFileBox.InitialFileName = Path.GetFullPath(DocumentFileName);
SaveFileBox.Directory = workdir;
List<FileDialogFilter> Filters = new List<FileDialogFilter>();
FileDialogFilter filter = new FileDialogFilter();
List<string> extension = new List<string>();
extension.Add("doc");
filter.Extensions = extension;
filter.Name = "Document Files";
Filters.Add(filter);
SaveFileBox.Filters = Filters;
SaveFileBox.DefaultExtension = "doc";
SettingsFileName = await SaveFileBox.ShowAsync(this);
提前致谢!!
ShowAsync 的 return 值将为 null 或空数组。