Exemple #1
0
        private void Button_Clicked(object sender, EventArgs e)
        {
            Debug.WriteLine("btn clicked");

            if (Connectivity.NetworkAccess == NetworkAccess.Internet)
            {
                if (this.IsValid())
                {
                    if (twitterService.Authenticate(this.user))
                    {
                        this.error.Hide();
                        this.navigation.PushAsync(new TweetsPage());
                    }
                    else
                    {
                        this.error.Error = "Utilisateur non trouvé";
                        this.error.Display();
                    }
                }
                else
                {
                    this.error.Display();
                }
            }
            else
            {
                this.error.Error = "Aucune connexion internet";
                this.error.Display();
            }
        }
Exemple #2
0
        public Boolean AllowConnection()
        {
            Boolean result = false;

            Debug.WriteLine("btn clicked");

            if (Connectivity.NetworkAccess == NetworkAccess.Internet)
            {
                if (this.IsValid())
                {
                    if (twitterService.Authenticate(this.user))
                    {
                        this.error.Hide();
                        result = true;
                    }
                    else
                    {
                        this.error.Error = "Utilisateur non trouvé";
                        this.error.Display();
                    }
                }
                else
                {
                    this.error.Display();
                }
            }
            else
            {
                this.error.Error = "Aucune connexion internet";
                this.error.Display();
            }
            return(result);
        }
Exemple #3
0
 private void ButtonClicked(Object sender, EventArgs eventArgs)
 {
     Debug.WriteLine("Button clicked");
     if (Connectivity.NetworkAccess == NetworkAccess.Internet)
     {
         if (this.IsValid())
         {
             if (twitterService.Authenticate(this.user))
             {
                 this.ErrorForm.ErrorLabel.IsVisible = false;
                 this.Navigation.PushAsync(new TweetsListView());
             }
             else
             {
                 this.ErrorForm.Error = "utilisateur inconnu";
                 this.ErrorForm.Show();
             }
         }
     }
     else
     {
         ErrorForm.Error = "Veuillez vous connecter à internet";
         ErrorForm.Show();
     }
 }
Exemple #4
0
        private void ConnectionBtn_Clicked(object sender, EventArgs e)
        {
            var connection = Connectivity.NetworkAccess;

            if (connection == NetworkAccess.Internet)
            {
                bool          testLogin    = true;
                bool          testPassword = true;
                StringBuilder sb           = new StringBuilder();

                if (this.IdEntry.Text == null || this.IdEntry.Text.ToString().Length < 3)
                {
                    testLogin = false;
                    sb.Append(LOGIN_ERROR);
                }
                if (this.PasswordEntry.Text == null || this.PasswordEntry.Text.ToString().Length < 6)
                {
                    testPassword = false;
                    if (!testLogin)
                    {
                        sb.Append("\n");
                    }
                    sb.Append(PASSWORD_ERROR);
                }

                if (testLogin && testPassword)
                {
                    Debug.WriteLine("Boutoonnn !!!!!!!!!!!");
                    Debug.WriteLine("Login : "******"Password : "******"Se souvenir : " + this.RememberMeSwitch.IsToggled.ToString());

                    if (ts.Authenticate(this.IdEntry.Text, this.PasswordEntry.Text))
                    {
                        this.ErrorDisplay.IsVisible = false;
                        Navigation.PushAsync(new TweetsPage());
                    }
                    else
                    {
                        this.ErrorDisplay.Text      = INCORRECT_LOGIN_PASSWORD;
                        this.ErrorDisplay.IsVisible = true;
                    }
                }
                else
                {
                    this.ErrorDisplay.Text      = sb.ToString();
                    this.ErrorDisplay.IsVisible = true;
                }
            }
            else
            {
                this.ErrorDisplay.Text      = NO_INTERNET;
                this.ErrorDisplay.IsVisible = true;
            }
        }
Exemple #5
0
        private void Connecter_Clicked(object sender, EventArgs e)
        {
            System.Diagnostics.Debug.WriteLine("Connection is clicked");
            var     id           = this.Identifiant.Text;
            var     mdp          = this.Password.Text;
            var     remember     = this.RememberMe.IsToggled;
            var     testLogin    = true;
            var     testPassword = true;
            Boolean isConnected  = false;

            StringBuilder builder = new StringBuilder();

            if (String.IsNullOrEmpty(id) || id.Length < 3)
            {
                testLogin = false;
                builder.Append(LOGIN_ERROR);
            }
            if (String.IsNullOrEmpty(mdp) || mdp.Length < 6)
            {
                testPassword = false;
                if (!testLogin)
                {
                    builder.Append("\n");
                }
                builder.Append(PASSWORD_ERROR);
            }

            if (testPassword && testLogin)
            {
                isConnected = tService.Authenticate(id, mdp);
                if (!isConnected)
                {
                    builder.Append(INCORRECT_ERROR);
                }
            }

            if (isConnected)
            {
                Navigation.PushAsync(new TweetPage());
            }
            else
            {
                this.error.Text      = builder.ToString();
                this.error.IsVisible = true;
            }
        }
Exemple #6
0
        private void Button_Clicked(object sender, EventArgs e)
        {
            Debug.WriteLine("btn clicked");

            if (this.IsValid())
            {
                if (twitterService.Authenticate(this.user))
                {
                    this.error.Hide();
                    this.visibilitySwitch.Switch();
                }
                else
                {
                    this.error.Error = "Utilisateur non trouvé";
                    this.error.Display();
                }
            }
            else
            {
                this.error.Display();
            }
        }
Exemple #7
0
        public async void Connection_Clicked(object sender, EventArgs e)
        {
            ErrorDisplay(false);

            if (login.Text == null || string.IsNullOrEmpty(login.Text.ToString()))
            {
                ErrorDisplay(true, "Identifiant obligatoire");
                return;
            }
            if (login.Text.Length < 3)
            {
                ErrorDisplay(true, "L'identifiant doit faire au moins 3 caractères");
                return;
            }
            if (password.Text == null || string.IsNullOrEmpty(password.Text.ToString()))
            {
                ErrorDisplay(true, "Mot de passe obligatoire");
                return;
            }
            if (password.Text.Length < 6)
            {
                ErrorDisplay(true, "Le mot de passe doit faire au moins 6 caractères");
                return;
            }

            NetworkAccess networkAccess = Connectivity.NetworkAccess;

            if (networkAccess != NetworkAccess.Internet)
            {
                ErrorDisplay(true, "Veuillez vous connecter à internet");
                return;
            }
            if (!twitterService.Authenticate(login.Text, password.Text))
            {
                ErrorDisplay(true, "L'identifiant et/ou le mot de passe sont incorrects");
                return;
            }
            await Navigation.PushAsync(new TweetsPage());
        }
        private void Button_Clicked(object sender, EventArgs e)
        {
            Debug.WriteLine("btn clicked");

            var ori = DeviceDisplay.MainDisplayInfo.Orientation;

            Debug.WriteLine("orientation" + ori);

            var current = Connectivity.NetworkAccess;

            Debug.WriteLine("Internet : " + current);

            this.error.Hide();
            if (current != NetworkAccess.Internet)
            {
                if (this.IsValid())
                {
                    if (twitterService.Authenticate(this.user))
                    {
                        this.error.Hide();
                        this.visibilitySwitch.Switch();
                    }
                    else
                    {
                        this.error.Error = "Utilisateur non trouvé";
                        this.error.Display();
                    }
                }
                else
                {
                    this.error.Display();
                }
            }
            else
            {
                this.error.Error = "Vous devez être connecté à internet pour vous identifier";
                this.error.Display();
            }
        }
        private bool controlsAreOk()
        {
            Boolean result = true;

            Debug.WriteLine("btn clicked");

            if (Connectivity.NetworkAccess == NetworkAccess.Internet)
            {
                if (this.IsValid())
                {
                    if (twitterService.Authenticate(this.User))
                    {
                        this.Error.Hide();
                    }
                    else
                    {
                        result          = false;
                        this.Error.Data = "Utilisateur non trouvé";
                        this.Error.Display();
                    }
                }
                else
                {
                    result = false;
                    this.Error.Display();
                }
            }
            else
            {
                result          = false;
                this.Error.Data = "Aucune connexion internet";
                this.Error.Display();
            }

            return(result);
        }