Exemplo n.º 1
0
    public override async Task <IStorageFile?> SaveFilePickerAsync(FilePickerSaveOptions options)
    {
        var model   = new ManagedFileChooserViewModel(options, _managedOptions);
        var results = await Show(model, _parent);

        return(results.FirstOrDefault() is { } result
            ? new BclStorageFile(new FileInfo(result))
            : null);
    }
Exemplo n.º 2
0
        public override async Task <IStorageFile?> SaveFilePickerAsync(FilePickerSaveOptions options)
        {
            var files = await ShowFilePicker(
                false, false,
                false, options.ShowOverwritePrompt,
                options.Title, options.SuggestedFileName, options.SuggestedStartLocation,
                options.DefaultExtension, options.FileTypeChoices);

            return(files.Select(f => new BclStorageFile(new FileInfo(f))).FirstOrDefault());
        }
 public override async Task <IStorageFile?> SaveFilePickerAsync(FilePickerSaveOptions options)
 {
     return(await await RunOnGlibThread(async() =>
     {
         var res = await ShowDialog(options.Title, _window, GtkFileChooserAction.Save,
                                    false, options.SuggestedStartLocation, options.SuggestedFileName, options.FileTypeChoices, options.DefaultExtension, options.ShowOverwritePrompt ?? false)
                   .ConfigureAwait(false);
         return res?.FirstOrDefault() is { } file
             ? new BclStorageFile(new FileInfo(file))
             : null;
     }));
 }
Exemplo n.º 4
0
        public async Task <IStorageFile?> SaveFilePickerAsync(FilePickerSaveOptions options)
        {
            try
            {
                var startIn = (options.SuggestedStartLocation as JSStorageItem)?.FileHandle;

                var(types, exludeAll) = ConvertFileTypes(options.FileTypeChoices);
                var item = await InvokeAsync <IJSInProcessObjectReference>("StorageProvider.saveFileDialog", startIn, options.SuggestedFileName, types, exludeAll);

                return(item is not null ? new JSStorageFile(item) : null);
            }
            catch (JSException ex) when(ex.Message.Contains(PickerCancelMessage, StringComparison.Ordinal))
            {
                return(null);
            }
        }
Exemplo n.º 5
0
        public override async Task <IStorageFile?> SaveFilePickerAsync(FilePickerSaveOptions options)
        {
            using var events = new SystemDialogEvents();

            var suggestedDirectory = options.SuggestedStartLocation?.TryGetUri(out var suggestedDirectoryTmp) == true
                ? suggestedDirectoryTmp.LocalPath : string.Empty;

            _native.SaveFileDialog((IAvnWindow)_window.Native,
                                   events,
                                   options.Title ?? string.Empty,
                                   suggestedDirectory,
                                   options.SuggestedFileName ?? string.Empty,
                                   PrepareFilterParameter(options.FileTypeChoices));

            var result = await events.Task.ConfigureAwait(false);

            return(result.FirstOrDefault() is string file
                ? new BclStorageFile(new FileInfo(file))
                : null);
        }
Exemplo n.º 6
0
 public override Task <IStorageFile> SaveFilePickerAsync(FilePickerSaveOptions options)
 {
     return(Task.FromResult <IStorageFile>(null));
 }
Exemplo n.º 7
0
 public abstract Task <IStorageFile?> SaveFilePickerAsync(FilePickerSaveOptions options);
    public async Task <IStorageFile?> SaveFilePickerAsync(FilePickerSaveOptions options)
    {
        var provider = await EnsureStorageProvider().ConfigureAwait(false);

        return(await provider.SaveFilePickerAsync(options).ConfigureAwait(false));
    }
Exemplo n.º 9
0
 public Task <IStorageFile?> SaveFilePickerAsync(FilePickerSaveOptions options)
 {
     return(Task.FromException <IStorageFile?>(
                new PlatformNotSupportedException("Save file picker is not supported by iOS")));
 }