Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

Activity indicator binding using forms

$
0
0

Hello forum!

I am looking for solution on how to use Activity indicator - as there are very little info in docs and forum.
What I am doing:

1) creating the form where I do collect some data and send it to the sync task via Interface;

submitPin.Clicked += (s, e) =>
{
string myPin = num1.Text + num2.Text + num3.Text + num4.Text;

                if (myPin.Length == 4)
                {
                    try
                    {
                        //make sure all entryes are digits
                        int valNum = Convert.ToInt16(myPin);
                        if (!myPin.Equals(""))
                        {
                            DependencyService.Get<ISendHttpRequest>().sendLoginPin(valNum);
                        }
                    }
                    catch (FormatException ex)
                    { //catching any error } 
                }
            };

2) data sent to server and I am waiting for result

public void sendLoginPin(int loginPin)
{

        string url = "my url"
        string responseFromServer = myRequest.syncHttpRequest(url);
    if (responseFromServer.Equals("OK"))
        {
        pinOk = true;
        }
    }

3) If result is "OK" - I open new form, if "error" - asking to reconfirm the data.

The question is - how and where do I add activity indicator and how I can "hook it up" to my myRequest.syncHttpRequest(url);

Also any links to relative documentation are appreciated.


Viewing all articles
Browse latest Browse all 58056

Trending Articles