((App)Application.Context).PasscodeManager.Show(this); System.InvalidCastException

HotanyaRagtahHotanyaRagtah USMember
edited September 2017 in Xamarin.Forms

Hi I am trying to add a lockscreen to my Xamarin Forms application but I can't seem to get it to work. I have tried using the Lock-Screen component but that didn't work, I have had limited success using the Passcode Manager component. I have been following the sample code from https://github.com/kevinskrei/XamarinPasscode/ and have managed to get the hello button to show up, however when I click it, instead of showing the lockscreen, I get a System.InvalidCastException at this line:

((LockLogic)Application.Context).PasscodeManager.Show(this);

Note: LockLogic is the equivalent of the file named App.cs in the sample, I already have an App.cs in my PCL project, if I add another App.cs in the Droid project, i was getting funny errors. I have asked this question on SO as well and have followed this suggestion https://stackoverflow.com/a/46357699/4657045

Thanks in advance

Sign In or Register to comment.