Giter Site home page Giter Site logo

danielbahe / xamarin.popups Goto Github PK

View Code? Open in Web Editor NEW
9.0 2.0 6.0 27 KB

Xamarin plugin to show alerts, loadings, custom widgets and custom popups from the viewmodel! 0 LINES OF CODE ON VIEWS

License: MIT License

C# 100.00%
xamarin popup notifications alerts mvvm mvvmcross mvvmcross-plugin

xamarin.popups's Introduction

Xamarin.Popups

Show alerts, widgets and popups from the viewmodel! 0 LINES OF CODE ON VIEWS

Tested Platforms:

  • Android
  • UWP
  • iOS

Complatible With:

  • Xamarin Forms
  • MVVMCross framework (5.6.3)

How to

Xamarin normal

ALERT! Remember to set the base class on initial tag and set all your content on the page layout.

<poppable:PoppablePage xmlns="http://xamarin.com/schemas/2014/forms"
                    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
                    x:Class="SampleProject.Views.SampleView"
                    xmlns:poppable="clr-namespace:Xamarin.Popups.Pages;assembly=Xamarin.Popups"
                    xmlns:views="clr-namespace:SampleProject.Views;assembly=SampleProject"
                    Title="Title">
		<poppable:PoppablePage.PageLayout> <!-- All the view elements inside or you will have errors-->
        <StackLayout>
            <Button Text="Miau" Command="{Binding ClickCommand}"/>
        </StackLayout>
		</poppable:PoppablePage.PageLayout>
</poppable:PoppablePage>
    public partial class SampleView : PoppablePage
      {
          public SampleView()
          {
              InitializeComponent();
          } 
      }

The ViewModel just inherit from PoppableViewModel, nothing special

public class SampleViewModel : PoppableViewModel
    {
        public IMvxCommand ClickCommand { get; set; }
        public SampleViewModel()
        {
            ClickCommand = new MvxCommand(ExecuteClickCommand);
        }

        private void ExecuteClickCommand()
        {
            this.PoppableService.ShowLoading();
        }
    }

MVVMCROSS

ALERT! Remember to set the base class on initial tag and set all your content on the page layout.

  <poppable:MvxPoppablePage xmlns="http://xamarin.com/schemas/2014/forms"
                    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
                    x:Class="SampleProject.Views.SampleView"
                    xmlns:mvx="clr-namespace:MvvmCross.Forms.Views;assembly=MvvmCross.Forms"
                    xmlns:poppable="clr-namespace:Xamarin.Popups.Pages;assembly=Xamarin.Popups"
                    xmlns:views="clr-namespace:SampleProject.Views;assembly=SampleProject"
                    Title="Title">

    		<poppable:MvxPoppablePage.PageLayout><!-- All the view elements inside or you will have errors-->
        		<StackLayout>
            		<Button Text="Miau" Command="{Binding ClickCommand}"/>
        		</StackLayout>
        </poppable:MvxPoppablePage.PageLayout>
    </poppable:MvxPoppablePage>
    public partial class SampleView : MvxPoppablePage
      {
          public SampleView()
          {
              InitializeComponent();
          } 
      }
			

The ViewModel just inherit from MvxPoppableViewModel, nothing special

 public class SampleViewModel : MvxPoppableViewModel
    {
        public IMvxCommand ClickCommand { get; set; }
        public SampleViewModel()
        {
            ClickCommand = new MvxCommand(ExecuteClickCommand);
        }

        private void ExecuteClickCommand()
        {
            this.PoppableService.ShowLoading();
        }
    }

Unit Testing? Yes!

In the new 2.0.0 "PoppableService" is a public property of the Viewmodel, this way you can mock it on your unit testing.

xamarin.popups's People

Contributors

0xflotus avatar danielbahe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

xamarin.popups's Issues

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.