Skip to content

Commit

Permalink
feat: Extension to allow for FileSavePicker implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinZikmund committed Mar 18, 2021
1 parent a8dfcae commit acaa7b6
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#pragma warning disable 114 // new keyword hiding
namespace Windows.Storage.Pickers
{
#if false || __IOS__ || NET461 || false || false || __NETSTD_REFERENCE__ || false
#if false || false || NET461 || false || false || __NETSTD_REFERENCE__ || false
[global::Uno.NotImplemented]
#endif
public partial class FileSavePicker
Expand Down Expand Up @@ -140,7 +140,7 @@ public string EnterpriseId
}
#endif

#if false || __IOS__ || NET461 || false || false || __NETSTD_REFERENCE__ || false
#if false || false || NET461 || false || false || __NETSTD_REFERENCE__ || false
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public FileSavePicker()
{
Expand Down Expand Up @@ -173,7 +173,7 @@ public void PickSaveFileAndContinue()
// Forced skipping of method Windows.Storage.Pickers.FileSavePicker.SuggestedFileName.get
// Forced skipping of method Windows.Storage.Pickers.FileSavePicker.SuggestedFileName.set

#if false || __IOS__ || NET461 || false || false || __NETSTD_REFERENCE__ || false
#if false || false || NET461 || false || false || __NETSTD_REFERENCE__ || false
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public global::Windows.Foundation.IAsyncOperation<global::Windows.Storage.StorageFile> PickSaveFileAsync()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Uno.UWP/Storage/Pickers/FileSavePicker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public string CommitButtonText
set => _commitButtonText = value ?? throw new ArgumentNullException(nameof(value));
}

#if __SKIA__ || __MACOS__ || __WASM__ || __ANDROID__
#if __SKIA__ || __MACOS__ || __WASM__ || __ANDROID__ || __IOS__
public FileSavePicker()
{
InitializePlatform();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#nullable enable
#if __IOS__ || __SKIA__
#nullable enable

using System;
using System.Threading;
Expand All @@ -18,10 +19,11 @@ public partial class FileSavePicker
{
if (_fileSavePickerExtension == null)
{
throw new NotSupportedException("FileOpenPicker is not supported on this target.");
throw new NotSupportedException("FileSavePicker extension is not registered.");
}

return await _fileSavePickerExtension.PickSaveFileAsync(token);
}
}
}
#endif
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
#nullable enable
#if __SKIA__ || __IOS__
#nullable enable

using System.Threading.Tasks;
using System.Threading;
using Windows.Storage;

namespace Uno.Extensions.Storage.Pickers
{
internal interface IFileSavePickerExtension
public interface IFileSavePickerExtension
{
Task<StorageFile?> PickSaveFileAsync(CancellationToken token);
}
}
#endif

0 comments on commit acaa7b6

Please sign in to comment.