Coder Social home page Coder Social logo

hamzeh-alchami / mvvmcross-userinteraction Goto Github PK

View Code? Open in Web Editor NEW

This project forked from brianchance/mvvmcross-userinteraction

0.0 2.0 0.0 1.26 MB

MvvmCross plugin for interacting with the user from a view model

License: MIT License

C# 98.22% Pascal 1.41% Batchfile 0.37%

mvvmcross-userinteraction's Introduction

MvvmCross-UserInteraction Plugin

MvvmCross plugin for interacting with the user from a view model. ##Features

  1. Alert - simple alert to the user, async or optional callback when done
  2. Confirm - dialog with ok/cancel, async or callback with button clicked or just when ok clicked
  3. Input - asks user for input with ok/cancel, async or callback with button clicked and data or just data when ok clicked

##Usage ####Alert Async

public ICommand SubmitCommand
{
		get
		{
			return new MvxCommand(async () =>
					                      {
					                        if (string.IsNullOrEmpty(FirstName)) 
					                        {
					                          await Mvx.Resolve<IUserInteraction>().AlertAsync("First Name is Required");
					                          return;
					                        }
					                        //do work
					                      });
		}
}

####Alert callback

public ICommand SubmitCommand
{
		get
		{
			return new MvxCommand(() =>
					                      {
					                        if (string.IsNullOrEmpty(FirstName)) 
					                        {
					                          Mvx.Resolve<IUserInteraction>().Alert("First Name is Required");
					                          return;
					                        }
					                        //do work
					                      });
		}
}

####Confirm/Input Async

public ICommand SubmitCommand
{
		get
		{
			return new MvxCommand(async () =>
					                      {
					                        if (await Mvx.Resolve<IUserInteraction>().ConfirmAsync("Are you sure?"))
					                        {
					                        	//do work
					                        }
					                       });
		}
}

####Confirm/Input callback

public ICommand SubmitCommand
{
		get
		{
			return new MvxCommand(() =>
					                      {
					                        Mvx.Resolve<IUserInteraction>().Confirm("Are you sure?", async () => 
					                          {
					                            //Do work
					                          });
					                      });
		}
}

##Adding to your project

  1. Follow stuarts directions (step 3) - http://slodge.blogspot.com/2012/10/build-new-plugin-for-mvvmcrosss.html
  2. Grab the UserInteractionPluginBootstrap file from appropriate Droid/Touch folder. Drop into your project in the Bootstrap folder, change the namespace.

I will be working on a nuget package as time permits.

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.