Home

Awesome

Nuget Nuget

Icon

Xam.Plugin.Once

Just a nice and library that allows you to do something once for your Xamarin Forms project.

!!This was inspired by the Once library for Android made by jonfinerty!! https://github.com/jonfinerty/Once


Some things should happen once.

Once provides a simple API to track whether or not your app has already performed an action within a given scope.

Setup

!!Install into your .net standard Forms project. !!

Usage

Here are some examples on how to use Once for Xamarin Forms:

            Once.Instance.RunWhen(SHOW_APP_INTRO, new Command(() => UserDialogs.Instance.Toast("Show app intro")));
 
            if(Once.Instance.LastRunAt(SHOW_SURVEY) == null)
                Once.Instance.RunWhen(SHOW_SURVEY, new Command(() => UserDialogs.Instance.Toast("Show app survey")), false, new After() {RunAfter = 30, Type = After.AfterType.Days });
            else
                Once.Instance.RunWhen(SHOW_SURVEY, new Command(() => UserDialogs.Instance.Toast("Show app survey")), false, new After() {RunAfter = 90, Type = After.AfterType.Days });
 
            _ = Once.Instance.NeedsToRun(SHOW_APP_INTRO);
 
            Once.Instance.MarkRunAsDone(SHOW_APP_CHANGELOG);
 

(see sample project for more info)

Donation

If you like to say thanks, you could always buy me a cup of coffee (/beer)!
(Thanks!)
PayPal donate button