Created
February 25, 2018 07:47
-
-
Save manicoder/3c18456c79c81abb93c867215547fb9a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using Plugin.Fingerprint; | |
using Xamarin.Forms; | |
namespace TouchIdSample | |
{ | |
public partial class MainPage : ContentPage | |
{ | |
public MainPage() | |
{ | |
InitializeComponent(); | |
} | |
void Handle_Clicked(object sender, System.EventArgs e) | |
{ | |
FingerPrintLogin(); | |
} | |
private async void FingerPrintLogin() | |
{ | |
var result = await CrossFingerprint.Current.IsAvailableAsync(); | |
if (result) | |
{ | |
var FPCancellationToken = new System.Threading.CancellationToken(); | |
var Auth = await CrossFingerprint.Current.AuthenticateAsync("Login for App", FPCancellationToken); | |
if (Auth.Authenticated) | |
{ | |
this.Navigation.PushAsync(new SuccessPage()); | |
} | |
else | |
{ | |
await Application.Current.MainPage.DisplayAlert("", "Authentication fails", "Ok"); | |
} | |
} | |
else | |
{ | |
await Application.Current.MainPage.DisplayAlert("", "Finger print feature is not available in mobile...", "Ok"); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment