Browse Source

Update BrowserStorageProvider.cs

pull/9889/head
Simon Cropp 4 years ago
parent
commit
d53ce9a0e9
  1. 12
      src/Browser/Avalonia.Browser/Storage/BrowserStorageProvider.cs

12
src/Browser/Avalonia.Browser/Storage/BrowserStorageProvider.cs

@ -29,11 +29,11 @@ internal class BrowserStorageProvider : IStorageProvider
await _lazyModule.Value; await _lazyModule.Value;
var startIn = (options.SuggestedStartLocation as JSStorageItem)?.FileHandle; var startIn = (options.SuggestedStartLocation as JSStorageItem)?.FileHandle;
var (types, exludeAll) = ConvertFileTypes(options.FileTypeFilter); var (types, excludeAll) = ConvertFileTypes(options.FileTypeFilter);
try try
{ {
using var items = await StorageHelper.OpenFileDialog(startIn, options.AllowMultiple, types, exludeAll); using var items = await StorageHelper.OpenFileDialog(startIn, options.AllowMultiple, types, excludeAll);
if (items is null) if (items is null)
{ {
return Array.Empty<IStorageFile>(); return Array.Empty<IStorageFile>();
@ -63,11 +63,11 @@ internal class BrowserStorageProvider : IStorageProvider
await _lazyModule.Value; await _lazyModule.Value;
var startIn = (options.SuggestedStartLocation as JSStorageItem)?.FileHandle; var startIn = (options.SuggestedStartLocation as JSStorageItem)?.FileHandle;
var (types, exludeAll) = ConvertFileTypes(options.FileTypeChoices); var (types, excludeAll) = ConvertFileTypes(options.FileTypeChoices);
try try
{ {
var item = await StorageHelper.SaveFileDialog(startIn, options.SuggestedFileName, types, exludeAll); var item = await StorageHelper.SaveFileDialog(startIn, options.SuggestedFileName, types, excludeAll);
return item is not null ? new JSStorageFile(item) : null; return item is not null ? new JSStorageFile(item) : null;
} }
catch (JSException ex) when (ex.Message.Contains(PickerCancelMessage, StringComparison.Ordinal)) catch (JSException ex) when (ex.Message.Contains(PickerCancelMessage, StringComparison.Ordinal))
@ -127,9 +127,9 @@ internal class BrowserStorageProvider : IStorageProvider
types = null; types = null;
} }
var inlcudeAll = input?.Contains(FilePickerFileTypes.All) == true || types is null; var includeAll = input?.Contains(FilePickerFileTypes.All) == true || types is null;
return (types, !inlcudeAll); return (types, !includeAll);
} }
} }

Loading…
Cancel
Save