Vapolia.PicturePicker 1.0.1-ci7654527991

Prefix Reserved
This is a prerelease version of Vapolia.PicturePicker.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package Vapolia.PicturePicker --version 1.0.1-ci7654527991                
NuGet\Install-Package Vapolia.PicturePicker -Version 1.0.1-ci7654527991                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Vapolia.PicturePicker" Version="1.0.1-ci7654527991" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Vapolia.PicturePicker --version 1.0.1-ci7654527991                
#r "nuget: Vapolia.PicturePicker, 1.0.1-ci7654527991"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Vapolia.PicturePicker as a Cake Addin
#addin nuget:?package=Vapolia.PicturePicker&version=1.0.1-ci7654527991&prerelease

// Install Vapolia.PicturePicker as a Cake Tool
#tool nuget:?package=Vapolia.PicturePicker&version=1.0.1-ci7654527991&prerelease                

PicturePicker

Platforms:

  • Android (5 to 10)
  • iOS (11 to 14)

Usage options:

  • static methods on the AdvancedMediaPicker static class
  • Interface IPicturePicker with a PicturePicker class on each platform

Standard usage

OpenPictureLibraryCommand = new Command(async () =>
{
    bool ok = false;
    var pictureCacheFolder = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
    var targetFile = Path.Combine(pictureCacheFolder, $"profilePic-{Guid.NewGuid()}.jpg");

    var hasPermission = await Permissions.CheckStatusAsync<Permissions.Photos>();
    if(hasPermission != PermissionStatus.Granted && hasPermission != PermissionStatus.Restricted)
        hasPermission = await Permissions.RequestAsync<Permissions.Photos>();
    if (hasPermission != PermissionStatus.Granted && hasPermission != PermissionStatus.Restricted)
    {
        if(await page.DisplayAlert("Denied", "You denied access to your photo library.", "Open Settings", "OK"))
            AppInfo.ShowSettingsUI();
    }
    else
        ok = await AdvancedMediaPicker.ChoosePictureFromLibrary(targetFile, maxPixelWidth: 500, maxPixelHeight: 500);

    if (ok)
        ImagePath = targetFile;
});

Reference

Use AdvancedMediaPicker.[MethodName] where MethodName is the same as the one on the interface.

    public interface IPicturePicker
    {
        Task<bool> ChoosePictureFromLibrary(string filePath, Action<Task<bool>>? saving = null, int maxPixelWidth=0, int maxPixelHeight=0, int percentQuality=80);

        /// <summary>
        /// Returns false if cancelled
        /// Note that saveToGallery can fails silently
        /// </summary>
        Task<bool> TakePicture(string filePath, Action<Task<bool>>? saving = null, int maxPixelWidth=0, int maxPixelHeight=0, int percentQuality=0, bool useFrontCamera=false, bool saveToGallery=false, CancellationToken cancel = default);

        bool HasCamera { get; }
    }
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-android34.0 is compatible.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-ios17.2 is compatible.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
5.0.0-ci8286235118 614 3/14/2024
5.0.0-ci8023628170 75 2/23/2024
5.0.0-ci7655685404 68 1/25/2024
1.0.1-ci7654527991 61 1/25/2024

1.0.0: Maui version