コード例 #1
0
        private async Task AttemptUnlock(string password)
        {
            RunOnUiThread(delegate { _progressIndicator.Visibility = ViewStates.Visible; });

            try
            {
                await BaseApplication.Unlock(password);
            }
            catch
            {
                RunOnUiThread(delegate
                {
                    _progressIndicator.Visibility = ViewStates.Invisible;
                    _passwordLayout.Error         = GetString(Resource.String.passwordIncorrect);
                });

                if (_failedAttempts > MaxAttempts)
                {
                    Toast.MakeText(this, Resource.String.tooManyAttempts, ToastLength.Short).Show();
                    Finish();
                    return;
                }

                _failedAttempts++;
                return;
            }

            SetResult(Result.Ok);
            Finish();
        }
コード例 #2
0
        private async Task AttemptUnlock(string password)
        {
            try
            {
                await BaseApplication.Unlock(password);
            }
            catch
            {
                _passwordLayout.Error = GetString(Resource.String.passwordIncorrect);

                if (_failedAttempts > MaxAttempts)
                {
                    Toast.MakeText(this, Resource.String.tooManyAttempts, ToastLength.Short).Show();
                    Finish();
                    return;
                }

                _failedAttempts++;
                return;
            }

            SetResult(Result.Ok);
            Finish();
        }