Browse Source
Merge pull request #8187 from AvaloniaUI/fixes/save-file-dialog-filters-nullable
OSX: fix file dialog filter nullable annotation, and osx platform.
pull/8206/head
Dan Walmsley
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with
6 additions and
6 deletions
-
samples/ControlCatalog/ControlCatalog.csproj
-
samples/ControlCatalog/Pages/DialogsPage.xaml.cs
-
src/Avalonia.Controls/SystemDialog.cs
-
src/Avalonia.Native/SystemDialogs.cs
|
|
|
@ -1,7 +1,8 @@ |
|
|
|
<Project Sdk="Microsoft.NET.Sdk"> |
|
|
|
<PropertyGroup> |
|
|
|
<TargetFramework>netstandard2.0</TargetFramework> |
|
|
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> |
|
|
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> |
|
|
|
<Nullable>enable</Nullable> |
|
|
|
</PropertyGroup> |
|
|
|
<ItemGroup> |
|
|
|
<Compile Update="**\*.xaml.cs"> |
|
|
|
|
|
|
|
@ -8,7 +8,6 @@ using Avalonia.Dialogs; |
|
|
|
using Avalonia.Layout; |
|
|
|
using Avalonia.Markup.Xaml; |
|
|
|
#pragma warning disable 4014
|
|
|
|
|
|
|
|
namespace ControlCatalog.Pages |
|
|
|
{ |
|
|
|
public class DialogsPage : UserControl |
|
|
|
@ -22,7 +21,7 @@ namespace ControlCatalog.Pages |
|
|
|
|
|
|
|
string lastSelectedDirectory = null; |
|
|
|
|
|
|
|
List<FileDialogFilter> GetFilters() |
|
|
|
List<FileDialogFilter>? GetFilters() |
|
|
|
{ |
|
|
|
if (this.FindControl<CheckBox>("UseFilters").IsChecked != true) |
|
|
|
return null; |
|
|
|
|
|
|
|
@ -15,7 +15,7 @@ namespace Avalonia.Controls |
|
|
|
/// Gets or sets a collection of filters which determine the types of files displayed in an
|
|
|
|
/// <see cref="OpenFileDialog"/> or an <see cref="SaveFileDialog"/>.
|
|
|
|
/// </summary>
|
|
|
|
public List<FileDialogFilter> Filters { get; set; } = new List<FileDialogFilter>(); |
|
|
|
public List<FileDialogFilter>? Filters { get; set; } = new List<FileDialogFilter>(); |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Gets or sets initial file name that is displayed when the dialog is opened.
|
|
|
|
|
|
|
|
@ -30,7 +30,7 @@ namespace Avalonia.Native |
|
|
|
ofd.Title ?? "", |
|
|
|
ofd.Directory ?? "", |
|
|
|
ofd.InitialFileName ?? "", |
|
|
|
string.Join(";", dialog.Filters.SelectMany(f => f.Extensions))); |
|
|
|
string.Join(";", dialog.Filters?.SelectMany(f => f.Extensions) ?? Array.Empty<string>())); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
@ -39,7 +39,7 @@ namespace Avalonia.Native |
|
|
|
dialog.Title ?? "", |
|
|
|
dialog.Directory ?? "", |
|
|
|
dialog.InitialFileName ?? "", |
|
|
|
string.Join(";", dialog.Filters.SelectMany(f => f.Extensions))); |
|
|
|
string.Join(";", dialog.Filters?.SelectMany(f => f.Extensions) ?? Array.Empty<string>())); |
|
|
|
} |
|
|
|
|
|
|
|
return events.Task.ContinueWith(t => { events.Dispose(); return t.Result; }); |
|
|
|
|