diff --git a/src/Avalonia.Base/Platform/Storage/FilePickerFileType.cs b/src/Avalonia.Base/Platform/Storage/FilePickerFileType.cs index 98848ac9f7..75076e2bb8 100644 --- a/src/Avalonia.Base/Platform/Storage/FilePickerFileType.cs +++ b/src/Avalonia.Base/Platform/Storage/FilePickerFileType.cs @@ -5,7 +5,7 @@ namespace Avalonia.Platform.Storage; /// /// Represents a name mapped to the associated file types (extensions). /// -public class FilePickerFileType +public sealed class FilePickerFileType { public FilePickerFileType(string name) { diff --git a/src/Avalonia.Base/Platform/Storage/FilePickerOpenOptions.cs b/src/Avalonia.Base/Platform/Storage/FilePickerOpenOptions.cs index 1f9202b0e7..1674ec11c8 100644 --- a/src/Avalonia.Base/Platform/Storage/FilePickerOpenOptions.cs +++ b/src/Avalonia.Base/Platform/Storage/FilePickerOpenOptions.cs @@ -5,25 +5,15 @@ namespace Avalonia.Platform.Storage; /// /// Options class for method. /// -public class FilePickerOpenOptions +public class FilePickerOpenOptions : PickerOptions { - /// - /// Gets or sets the text that appears in the title bar of a file dialog. - /// - public string? Title { get; set; } - - /// - /// Gets or sets the initial location where the file open picker looks for files to present to the user. - /// - public IStorageFolder? SuggestedStartLocation { get; set; } - /// /// Gets or sets an option indicating whether open picker allows users to select multiple files. /// public bool AllowMultiple { get; set; } - + /// /// Gets or sets the collection of file types that the file open picker displays. /// public IReadOnlyList? FileTypeFilter { get; set; } -} \ No newline at end of file +} diff --git a/src/Avalonia.Base/Platform/Storage/FilePickerSaveOptions.cs b/src/Avalonia.Base/Platform/Storage/FilePickerSaveOptions.cs index 0f4d690f7a..fa4fccd47a 100644 --- a/src/Avalonia.Base/Platform/Storage/FilePickerSaveOptions.cs +++ b/src/Avalonia.Base/Platform/Storage/FilePickerSaveOptions.cs @@ -5,13 +5,8 @@ namespace Avalonia.Platform.Storage; /// /// Options class for method. /// -public class FilePickerSaveOptions +public class FilePickerSaveOptions : PickerOptions { - /// - /// Gets or sets the text that appears in the title bar of a file dialog. - /// - public string? Title { get; set; } - /// /// Gets or sets the file name that the file save picker suggests to the user. /// @@ -22,11 +17,6 @@ public class FilePickerSaveOptions /// public string? DefaultExtension { get; set; } - /// - /// Gets or sets the initial location where the file open picker looks for files to present to the user. - /// - public IStorageFolder? SuggestedStartLocation { get; set; } - /// /// Gets or sets the collection of valid file types that the user can choose to assign to a file. /// diff --git a/src/Avalonia.Base/Platform/Storage/FolderPickerOpenOptions.cs b/src/Avalonia.Base/Platform/Storage/FolderPickerOpenOptions.cs index de90da30b2..df9fa8fd35 100644 --- a/src/Avalonia.Base/Platform/Storage/FolderPickerOpenOptions.cs +++ b/src/Avalonia.Base/Platform/Storage/FolderPickerOpenOptions.cs @@ -3,20 +3,10 @@ /// /// Options class for method. /// -public class FolderPickerOpenOptions +public class FolderPickerOpenOptions : PickerOptions { - /// - /// Gets or sets the text that appears in the title bar of a folder dialog. - /// - public string? Title { get; set; } - /// /// Gets or sets an option indicating whether open picker allows users to select multiple folders. /// public bool AllowMultiple { get; set; } - - /// - /// Gets or sets the initial location where the file open picker looks for files to present to the user. - /// - public IStorageFolder? SuggestedStartLocation { get; set; } } diff --git a/src/Avalonia.Base/Platform/Storage/IStorageBookmarkItem.cs b/src/Avalonia.Base/Platform/Storage/IStorageBookmarkItem.cs index 65811b7fbd..d21c950862 100644 --- a/src/Avalonia.Base/Platform/Storage/IStorageBookmarkItem.cs +++ b/src/Avalonia.Base/Platform/Storage/IStorageBookmarkItem.cs @@ -17,5 +17,4 @@ public interface IStorageBookmarkFile : IStorageFile, IStorageBookmarkItem [NotClientImplementable] public interface IStorageBookmarkFolder : IStorageFolder, IStorageBookmarkItem { - } diff --git a/src/Avalonia.Base/Platform/Storage/IStorageFile.cs b/src/Avalonia.Base/Platform/Storage/IStorageFile.cs index 2f12514e50..965caf8216 100644 --- a/src/Avalonia.Base/Platform/Storage/IStorageFile.cs +++ b/src/Avalonia.Base/Platform/Storage/IStorageFile.cs @@ -14,7 +14,7 @@ public interface IStorageFile : IStorageItem /// Returns true, if file is readable. /// bool CanOpenRead { get; } - + /// /// Opens a stream for read access. /// @@ -24,9 +24,9 @@ public interface IStorageFile : IStorageItem /// Returns true, if file is writeable. /// bool CanOpenWrite { get; } - + /// /// Opens stream for writing to the file. /// Task OpenWrite(); -} \ No newline at end of file +} diff --git a/src/Avalonia.Base/Platform/Storage/IStorageFolder.cs b/src/Avalonia.Base/Platform/Storage/IStorageFolder.cs index 83b316bc3b..25b9f01a92 100644 --- a/src/Avalonia.Base/Platform/Storage/IStorageFolder.cs +++ b/src/Avalonia.Base/Platform/Storage/IStorageFolder.cs @@ -8,5 +8,4 @@ namespace Avalonia.Platform.Storage; [NotClientImplementable] public interface IStorageFolder : IStorageItem { - -} \ No newline at end of file +} diff --git a/src/Avalonia.Base/Platform/Storage/IStorageItem.cs b/src/Avalonia.Base/Platform/Storage/IStorageItem.cs index 078311a286..8513ebc7d9 100644 --- a/src/Avalonia.Base/Platform/Storage/IStorageItem.cs +++ b/src/Avalonia.Base/Platform/Storage/IStorageItem.cs @@ -27,7 +27,7 @@ public interface IStorageItem : IDisposable /// Browser and iOS backends might return relative uris. /// bool TryGetUri([NotNullWhen(true)] out Uri? uri); - + /// /// Gets the basic properties of the current item. /// @@ -37,7 +37,7 @@ public interface IStorageItem : IDisposable /// Returns true is item can be bookmarked and reused later. /// bool CanBookmark { get; } - + /// /// Saves items to a bookmark. /// diff --git a/src/Avalonia.Base/Platform/Storage/IStorageProvider.cs b/src/Avalonia.Base/Platform/Storage/IStorageProvider.cs index 32fb148790..0f5cf931d9 100644 --- a/src/Avalonia.Base/Platform/Storage/IStorageProvider.cs +++ b/src/Avalonia.Base/Platform/Storage/IStorageProvider.cs @@ -11,7 +11,7 @@ public interface IStorageProvider /// Returns true if it's possible to open file picker on the current platform. /// bool CanOpen { get; } - + /// /// Opens file picker dialog. /// @@ -22,7 +22,7 @@ public interface IStorageProvider /// Returns true if it's possible to open save file picker on the current platform. /// bool CanSave { get; } - + /// /// Opens save file picker dialog. /// @@ -33,13 +33,13 @@ public interface IStorageProvider /// Returns true if it's possible to open folder picker on the current platform. /// bool CanPickFolder { get; } - + /// /// Opens folder picker dialog. /// /// Array of selected or empty collection if user canceled the dialog. Task> OpenFolderPickerAsync(FolderPickerOpenOptions options); - + /// /// Open from the bookmark ID. /// diff --git a/src/Avalonia.Base/Platform/Storage/PickerOptions.cs b/src/Avalonia.Base/Platform/Storage/PickerOptions.cs new file mode 100644 index 0000000000..6f97916a26 --- /dev/null +++ b/src/Avalonia.Base/Platform/Storage/PickerOptions.cs @@ -0,0 +1,17 @@ +namespace Avalonia.Platform.Storage; + +/// +/// Common options for , and methods. +/// +public class PickerOptions +{ + /// + /// Gets or sets the text that appears in the title bar of a folder dialog. + /// + public string? Title { get; set; } + + /// + /// Gets or sets the initial location where the file open picker looks for files to present to the user. + /// + public IStorageFolder? SuggestedStartLocation { get; set; } +} diff --git a/src/Avalonia.Base/Platform/Storage/StorageItemProperties.cs b/src/Avalonia.Base/Platform/Storage/StorageItemProperties.cs index 41b9bfa941..a63973ccf8 100644 --- a/src/Avalonia.Base/Platform/Storage/StorageItemProperties.cs +++ b/src/Avalonia.Base/Platform/Storage/StorageItemProperties.cs @@ -16,7 +16,7 @@ public class StorageItemProperties DateCreated = dateCreated; DateModified = dateModified; } - + /// /// Gets the size of the file in bytes. /// @@ -40,4 +40,4 @@ public class StorageItemProperties /// Can be null if property is not available. /// public DateTimeOffset? DateModified { get; } -} \ No newline at end of file +}