Coder Social home page Coder Social logo

xamarinium / prism.plugin.popups Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dansiegel/prism.plugin.popups

0.0 0.0 0.0 870 KB

This provides extensibility for Prism.Forms INavigationService to handle Popup Views

License: MIT License

PowerShell 2.73% C# 97.27%

prism.plugin.popups's Introduction

Prism.Plugin.Popups

The Popups plugin provides an extremely lightweight framework for implementing Popup Pages using the Rg.Plugin.Popup package with Prism.Forms. To do this we simply provide you with some friendly extensions for the INavigationService so that you can navigate in a Prism friendly manner. Note that this does not currently support deep linking.

Platform Build Status
VSTS Build Build Status
AppCenter Android Build status
AppCenter iOS Build status
Package Version MyGet
Prism.Plugin.Popups PluginNuGetShield PluginMyGetShield
Prism.Plugin.Popups.Autofac(DEPRECATED) AutofacNuGetShield AutofacMyGetShield
Prism.Plugin.Popups.DryIoc(DEPRECATED) DryIocNuGetShield DryIocMyGetShield
Prism.Plugin.Popups.Unity(DEPRECATED) UnityNuGetShield UnityMyGetShield

Symbols

Builds are now generated with a symbols package. This will allow users to better debug code when using our symbol server feed. Packages published to NuGet prior to (and including) 2.0.0-pre2 do not have symbols available. You can add the following Symbol Server for all Prism Plugins.

https://www.myget.org/F/prism-plugins/symbols/

Support

If this project helped you reduce time to develop and made your app better, please help support this project.

paypal

Usage

Version 2.X

Version 2.X deprecates the use of all but the ClearPopupStackAsync extension method. You can now register a PopupNavigationService which uses the base Prism PageNavigationService and adds support for Pushing and Popping PopupPage's. To use the PopupNavigationService see the registration example below for the DI container of your choice.

Because 2.X simply uses INavigationService one of the benefits you will get is support for Deep Linking like shown here:

NavigationService.NavigateAsync("MainPage/PopupPageA/PopupPageB");

NOTE All Container Specific packages have been deprecated due to Prism 7 offering an IOC Abstraction. You only need to install Prism.Plugin.Popups.

Getting Started

This plugin does not remove any platform initialization requirements that Rg.Plugins.Popup has. Be sure that you have followed all of the Rg.Plugins.Popup guidelines for initializing each Platform (iOS/Android,etc).

To use the plugin you will need to update the Registration for INavigationService. To do this you simply need to add the following:

protected override void RegisterTypes(IContainerRegistry containerRegistry)
{
    // This updates INavigationService and registers PopupNavigation.Instance
    containerRegistry.RegisterPopupNavigationService();
}

It's worth noting that there is a generic overload for the registration method that accepts any type that inherits from PopupPageNavigationService in the event that you have custom logic you need to execute in the NavigationService. The RegisterPopupNavigationService method will also register IPopupNavigation from PopupNavigation.Instance for you.

Prism's underlying Page Navigation Service has a dependency on IPageBehaviorFactory. In order to handle navigation events from tapping outside of (and closing) the PopupPage, this plugin relies on the PopupPageBehaviorFactory which is also registered by the registration method shown above. If you are registering your own custom implementation, be sure to either add the BackgroundPopupDismissalBehavior to PopupPages, or simply inherit from the PopupPageBehaviorFactory.

NOTE: All initializations for Rg.Plugins.Popup should be done in Platform code, the Registrations for the NavigationService should be done in your PrismApplication. No additional initialization is required inside of Prism Modules.

Version 1.X

NOTE This version is DEPRECATED, please use the 2.0 preview. This is not compatible with Prism 7.

There are three primary extensions added for working with Navigation.

  • ClearPopupStackAsync
  • PopupGoBackAsync (Obsolete in v2.X)
  • PushPopupPageAsync (Obsolete in v2.X)

All three of these contain overloads so that you can pass in a NavigationParameters object, or if you have a single key value pair you can pass it in as shown below for the NavigateCommand.

public class MyPageViewModel : BindableBase
{
    INavigationService _navigationService { get; }

    public MyPageViewModel( INavigationService navigationService )
    {
        _navigationService = navigationService;
        NavigateCommand = new DelegateCommand( OnNavigateCommandExecuted );
        GoBackCommand = new DelegateCommand( OnGoBackCommandExecuted );
    }

    public DelegateCommand NavigateCommand { get; }

    public DelegateCommand GoBackCommand { get; }

    private async void OnNavigateCommandExecuted()
    {
        await _navigationService.PushPopupPageAsync( "SomePopupPage", "message", "hello from MyPage" );
    }

    private async void OnGoBackCommandExecuted()
    {
        await _navigationService.PopupGoBackAsync();
    }
}

prism.plugin.popups's People

Contributors

dansiegel avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.