Example #1
0
        private async void loginButton_Clicked(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(userEmail_Login.Text) && !string.IsNullOrEmpty(userPassword_Login.Text))
            {
                try
                {
                    await Task.Run(() => LogInPoster());

                    //await Navigation.PushAsync(new Dashboard());
                }
                catch (Exception LoginException)
                {
                    await DisplayAlert("LoginException", LoginException.ToString(), "ok");

                    //Console.WriteLine("NextException : " + NextException);
                    throw;
                }

                // After loggin in, we will fetch the account details of the user.

                try
                {
                    await Task.Run(() => UserInfoFetcher());
                }
                catch (Exception UserInfoFetchException)
                {
                    //await DisplayAlert("UserInfoFetchException", UserInfoFetchException.ToString(), "ok");
                    //throw;
                    await DisplayAlert("Server Sleeping", "Seems like our servers are sleeping. We will open a link and you should see when the server is up (generally takes 2-3 minutes. Try after that.", "Ok");

                    Device.OpenUri(new Uri("http://auth.fillip72.hasura-app.io/ui"));
                }

                // If cluster is sleeping and we get an WebException, we gotta wake the cluster up.
                if (ClusterSleeping)
                {
                    await DisplayAlert("Server Sleeping", "Seems like our servers are sleeping. We will open a link and you should see when the server is up (generally takes 2-3 minutes. Try after that.", "Ok");

                    //Device.OpenUri(new Uri("http://auth.fillip72.hasura-app.io/ui"));
                    await Task.Run(() => { Device.OpenUri(new Uri("http://auth.fillip72.hasura-app.io/ui")); });

                    return;
                }

                if (SignInStatus)
                {
                    await Navigation.PushAsync(new Dashboard());
                }
                else
                {
                    await DisplayAlert("Failure!", message, "ok");
                }
            }
            else
            {
                await DisplayAlert("Empty Fields", "Make Sure The Fields Are Filled.", "Ok");
            }
        }