AwaitablePopups 1.1.3

There is a newer version of this package available.
See the version list below for details.
dotnet add package AwaitablePopups --version 1.1.3                
NuGet\Install-Package AwaitablePopups -Version 1.1.3                
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="AwaitablePopups" Version="1.1.3" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add AwaitablePopups --version 1.1.3                
#r "nuget: AwaitablePopups, 1.1.3"                
#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 AwaitablePopups as a Cake Addin
#addin nuget:?package=AwaitablePopups&version=1.1.3

// Install AwaitablePopups as a Cake Tool
#tool nuget:?package=AwaitablePopups&version=1.1.3                

<br /> <p align="center"> <h1 align="center">Awaitable Popups</h3> <p align="center"> Customisable Popups for Xamarin Forms <br /> </p> </p>

Table of Contents

Codacy Codacy Badge NuGet nuget CodeFactor CodeFactor Fuget AwaitablePopups on fuget.org (Use Fuget to see API differences between each package.)

https://www.fuget.org/packages/AwaitablePopups/badges

About The Project

Awaitable Popups is a neat blend of the Rg.Plugins.Popup and AsyncAwaitBestPractices plugins to bring you a quick way to add popups into your Xamarin Forms App using familiar concepts

Built With

Getting Started

First, you must follow the initialisation guide set out by Rg.Plugins.Popup, once you have that, have a look at usage down below

Installation

You can install the nuget by looking up 'AwaitablePopups' in your nuget package manager, or by getting it here

Usage

here is an example of what this plugin makes easy (Looks slow due to giphy)

Gif Example

New Example

To Use the plugin for its inbuilt popup pages in a basic setting (Dual/Single Response, Login, TextInput EntryInput,and loader.) All you need are these one liners

SingleResponse Popup Page

return await SingleResponseViewModel.AutoGenerateBasicPopup(Color.HotPink, Color.Black, "I Accept", Color.Gray, "Good Job, enjoy this single response example", "thumbsup.png");

DualResponse Popup Page

return await DualResponseViewModel.AutoGenerateBasicPopup(Color.WhiteSmoke, Color.Red, "Okay", Color.WhiteSmoke, Color.Green, "Looks Good!", Color.DimGray, "This is an example of a dual response popup page", "thumbsup.png");

Loader Popup Page

  await PopupService.WrapTaskInLoader(Task.Delay(10000), Color.Blue, Color.White, LoadingReasons(), Color.Black);

Text Input PopupPage

await TextInputViewModel.AutoGenerateBasicPopup(Color.WhiteSmoke, Color.Red, "Cancel", Color.WhiteSmoke, Color.Green, "Submit", Color.DimGray, "Text input Example", string.Empty);

Entry Input PopupPage

await EntryInputViewModel.AutoGenerateBasicPopup(Color.WhiteSmoke, Color.Red, "Cancel", Color.WhiteSmoke, Color.Green, "Submit", Color.DimGray, "Text input Example", string.Empty);

LoginPage PopupPage

var (username, password) = await LoginViewModel.AutoGenerateBasicPopup(Color.WhiteSmoke, Color.Red, "Cancel", Color.WhiteSmoke, Color.Green, "Submit", Color.DimGray, string.Empty, "Username Here", string.Empty, "Password here", "thumbsup.png", 0, 0);

or, to return from the loader a value

await PopupService.WrapReturnableTaskInLoader<bool>(IndepthCheckAgainstDatabase(), Color.Blue, Color.White, LoadingReasons(), Color.Black);

you can also add in synchronous functions, however they are wrapped in a task


private bool LongRunningFunction(int millisecondDelay)
{
    Thread.Sleep(millisecondDelay);
    return true;
}
await PopupService.WrapReturnableFuncInLoader(LongRunningFunction, 6000, Color.Blue, Color.White, LoadingReasons(), Color.Black);

That's it! for advanced usage read on

In Version 1.1.0, AwaitablePopups will be starting on a new set of API's

This set of API's will be used for when the basic API wont cut it, without relying on me making another overload for every situation under the sun.

This API introduces

GeneratePopup<TPopupPage> Which allows you to supply your own popuppage xaml which will then be attached to whatever VM you called it from.

GeneratePopup(Dictionary<string, object> propertyDictionary) Which allows you have a dictionary of values that a popup uses, pass and automatically attach to the appropriate properties on the VM side

These are both non-static. and require you to have an instance of the ViewModel to work with. Hence

<ViewModelClassNameHere>.GenerateVM() Which provides you with a new instance of that VM

<ViewModelClassNameHere>.PullViewModelProperties() Which collects all the properties of a VM, and provides them to you in a dictionary, so you can reuse and also while debugging, check what exists/whats been changed Returns this Dictionary<string, (object property, Type propertyType)>

However, for initialisation, i internally (and you can use) the following function <ViewModelClassNameHere>.InitialiseOptionalProperties(Dictionary<string, object> optionalProperties) Which will attempt to set each of the viewmodel properties with the corrosponding value in the dictionary

So, to fix that, i provide <ViewModelClassNameHere>.FinalisePreparedProperties(Dictionary<string, (object property, Type propertyType)> viewModelProperties) Which takes in the Dictionary<string, (object property, Type propertyType)> and creates Dictionary<string, object> optionalProperties

Hopefully i will add on to make this easier in the future

If you want to make your own Popup Page

This is the real power of this Plugin (Thanks in no small amount to Rotorgames amazing plugin). If you look at the source for DualResponsePopupPage, or the SingleResponse version you'll notice that they are just simple Xaml Pages. Nothing fancy. (except for the rg popup spice).

You can create the full thing yourself

  1. Create Xaml Page with codebehind
  2. Create your ViewModel that is associated with the popup, lets call ours InformationPopupPage
  3. Ensure your ViewModel inherits from PopupViewModel<TReturnable> where TReturnable is what you want the popuppage to return to its caller
  4. Ensure that your xaml page codebehind inherits from PopupPage (requirement to use rg plugins popup) and IGenericViewModel<TViewModel> where TViewModel is your Viewmodel, in our case it will be IGenericViewModel<InformationPopupPage>
  5. You're ready to start using it the same as DualResponsePopupPage

New API Usage (1.1.0) or you can provide your own Xaml Page, with a codebehind that inherits from PopupPage and IGenericViewModel<TViewModel> where TViewModel is the plugin provided VM you wish to use.

to use this version, just call TViewModel.GeneratePopup<YourXamlPopupPage>()

License

This project uses the MIT License

Contact

My Github, or reach me on the Xamarin Slack, or on my E-mail

Project Link: AwaitablePopups

Acknowledgements

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos 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
1.1.5 2,218 1/13/2021
1.1.4 842 8/26/2020
1.1.3 458 8/24/2020
1.1.2 480 8/20/2020
1.1.1-rc 407 8/18/2020
1.1.0 473 8/7/2020
1.0.2 541 7/21/2020
1.0.1 506 7/3/2020
1.0.0 600 7/1/2020 1.0.0 is deprecated because it is no longer maintained.
0.3.8 620 6/8/2020 0.3.8 is deprecated because it is no longer maintained.
0.3.5 650 5/4/2020 0.3.5 is deprecated because it is no longer maintained.
0.3.4 611 4/20/2020 0.3.4 is deprecated because it is no longer maintained.
0.3.3 789 4/20/2020 0.3.3 is deprecated because it is no longer maintained.
0.3.1 791 4/20/2020 0.3.1 is deprecated because it is no longer maintained.
0.3.1-Alpha 652 4/17/2020 0.3.1-Alpha is deprecated because it is no longer maintained.
0.3.0 742 3/24/2020 0.3.0 is deprecated because it is no longer maintained.
0.2.5 1,077 3/23/2020 0.2.5 is deprecated because it is no longer maintained.
0.2.4 1,115 3/23/2020 0.2.4 is deprecated because it is no longer maintained.
0.2.3 1,125 3/23/2020 0.2.3 is deprecated because it is no longer maintained.
0.2.1 1,123 3/23/2020 0.2.1 is deprecated because it is no longer maintained.
0.2.0 1,020 3/20/2020 0.2.0 is deprecated because it is no longer maintained.
0.1.9 1,239 3/20/2020 0.1.9 is deprecated because it is no longer maintained.
0.1.8 954 3/11/2020 0.1.8 is deprecated because it is no longer maintained.
0.1.7 949 3/9/2020 0.1.7 is deprecated because it is no longer maintained.
0.1.6 1,068 2/24/2020 0.1.6 is deprecated because it is no longer maintained.
0.1.5 1,083 2/10/2020 0.1.5 is deprecated because it is no longer maintained.
0.1.3 1,661 1/31/2020 0.1.3 is deprecated because it is no longer maintained.
0.1.2 1,416 1/31/2020 0.1.2 is deprecated because it is no longer maintained.

Added in a fix so the Loaders are presented correctly.