コード例 #1
0
        async void SelectLoginMethodAuto()
        {
            Security.Credit Credit = await DependencyService.Get <Security.ISecurity> ().GetItemAsync();

            if (Credit != null)
            {
                if (!await TryConnect(Credit))
                {
                    await DependencyService.Get <Security.ISecurity> ().DeleteItemAsync();
                }
            }
            else
            {
                DisplayContent(string.Empty);
            }
        }
コード例 #2
0
        async Task <bool> TryConnect(Security.Credit credit)
        {
            try {
                if (await InitIntra(credit.Login, credit.Password))
                {
                    await DependencyService.Get <Security.ISecurity> ().AddItemAsync(credit);

                    await Navigation.PopModalAsync(true);

                    ((MasterDetailPage)Application.Current.MainPage).IsPresented = true;
                    return(true);
                }
                await DisplayAlert("Connexion", "Verifier vos identifiants", "Ok");

                DisplayContent(credit.Login);
                return(false);
            } catch (Exception ex) {
                await DisplayAlert("Connexion", ex.Message, "Ok");

                DisplayContent(credit.Login);
                return(false);
            }
        }