Esempio n. 1
0
        /// <inheritdoc />
        public async Task <string[]?> ShowOpenMultipleFilesDialogAsync(IEnumerable <FileDialogFilter> filters, string title)
        {
            var dlgSaveFile = new OpenFileDialog();

            foreach (var actFilter in filters)
            {
                var actAvaloniaFilter = new global::Avalonia.Controls.FileDialogFilter();
                actAvaloniaFilter.Name       = actFilter.Name;
                actAvaloniaFilter.Extensions = actFilter.Extensions;
                dlgSaveFile.Filters.Add(actAvaloniaFilter);
            }
            dlgSaveFile.AllowMultiple = true;

            var selectedFiles = await dlgSaveFile.ShowAsync(_parent);

            if ((selectedFiles == null) ||
                (selectedFiles.Length == 0))
            {
                return(null);
            }
            else
            {
                return(selectedFiles);
            }
        }
Esempio n. 2
0
        /// <inheritdoc />
        public Task <string?> ShowSaveFileDialogAsync(IEnumerable <FileDialogFilter> filters, string defaultExtension)
        {
            var dlgSaveFile = new SaveFileDialog();

            foreach (var actFilter in filters)
            {
                var actAvaloniaFilter = new global::Avalonia.Controls.FileDialogFilter();
                actAvaloniaFilter.Name       = actFilter.Name;
                actAvaloniaFilter.Extensions = actFilter.Extensions;
                dlgSaveFile.Filters.Add(actAvaloniaFilter);
            }
            dlgSaveFile.DefaultExtension = defaultExtension;

            return(dlgSaveFile.ShowAsync(_parent));
        }