fix: simplify storage extraction.

This commit is contained in:
rabbitism 2023-02-01 21:40:46 +08:00
parent a56a0ee18b
commit 7536b8b2a3

View File

@ -52,15 +52,9 @@ public partial class ManagedFileChooserDemo : UserControl
private IStorageProvider? GetStorageProvider()
{
if (this.VisualRoot is Window w)
{
return w.StorageProvider;
var topLevel = TopLevel.GetTopLevel(this);
return topLevel?.StorageProvider;
}
return null;
}
Window GetWindow() => this.VisualRoot as Window ?? throw new NullReferenceException("Invalid Owner");
TopLevel GetTopLevel() => this.VisualRoot as TopLevel ?? throw new NullReferenceException("Invalid Owner");
List<FilePickerFileType>? GetFileTypes()
{