Image TapGestureRecognizer takes time to fire event

Hello,

I have one Image TapGestureRecognizer Event After click on image need to dispaly loader after event fire dismiss loader. ihave apply to many solution but not able to find any perfact solution

need loader instant after click on image.


<Image.GestureRecognizers>

</Image.GestureRecognizers>

private async void OnSettingButtonClicked(object sender, EventArgs e)
{
DependencyService.Get().Show();
try
{
await Navigation.PushAsync(new CustomerInfoTabbedPage());
DependencyService.Get().Hide();
}
}
catch (Exception ex)
{
DependencyService.Get().Hide();;
}
}

Thank you in advance Hope any one help me.

Answers

  • chetanrawatchetanrawat USMember ✭✭✭

    Hi, @Krishna_Dash

    Try this

    private async void OnSettingButtonClicked(object sender, EventArgs e)
    {
    await Task.Delay(1000);
    DependencyService.Get().Show();
    try
    {
    await Navigation.PushAsync(new CustomerInfoTabbedPage());
    DependencyService.Get().Hide();
    }
    }
    catch (Exception ex)
    {
    DependencyService.Get().Hide();;
    }
    }

  • Krishna_DashKrishna_Dash Member ✭✭

    @chetanrawat said:
    Hi, @Krishna_Dash

    Try this

    private async void OnSettingButtonClicked(object sender, EventArgs e)
    {
    await Task.Delay(1000);
    DependencyService.Get().Show();
    try
    {
    await Navigation.PushAsync(new CustomerInfoTabbedPage());
    DependencyService.Get().Hide();
    }
    }
    catch (Exception ex)
    {
    DependencyService.Get().Hide();;
    }
    }

    Hi Thank you for this response but i want when user click on image instant loader display currently user click on image and after two three second loader display

    Hope you understand what i am trying to say

  • chetanrawatchetanrawat USMember ✭✭✭

    Hi, @Krishna_Dash

    if you are loading loader using dependencyservice, then don't , please use ActivityIndicator

  • Krishna_DashKrishna_Dash Member ✭✭

    @chetanrawat said:
    Hi, @Krishna_Dash

    if you are loading loader using dependencyservice, then don't , please use ActivityIndicator

    also trying use Activity Indicator but issue like when i click on image immediate need loader
    Thank you for you response

  • JohnHardmanJohnHardman GBUniversity mod
    edited April 12

    @Krishna_Dash

    You are showing the ProgressLoader, then creating and pushing CustomerInfoTabbedPage, then hiding the ProgressLoader, all on the UI thread. The issue is that your ProgressLoader will be unable to update the display as the UI thread is busy creating and pushing the page. Your ProgressLoader probably needs the UI thread to be idle in order to display.

    To demonstrate if this is what is happening, add await Task.Delay(5000); as the first line inside the try block. If you then see the ProgressLoader, this confirms that this is the issue.

Sign In or Register to comment.