I have an app with two pages. One of them is the MainPage, which is opened first when the app is opened. The second page is there to update values (user input), sent them to a server and returning to the MainPage (all in one click under one button). For loading the new values on the MainPage, I'm using an ACR UserDialog and here comes the problem.
The ACR UserDialog must be created at two location:
- One in the OnAppearing of the MainPage, so that when the app is opened a nice dialog is shown while loading the data.
- One in the second page because of the values being sent to the server.
Both work, but when I press the button to upload the values to the server, the first dialog pops up loading and then the app returns to the MainPage while quickly switching from the first dialog to the second dialog from the OnAppearing. I would like this transition to be smooth: both texts are different and I want to keep the loading going while only updating the text (so that the loading dialog does not switch quickly).
Is this possible?
EDIT: code snippits I have created a demo, but I cannot send files here.
MainPage:
protected async override void OnAppearing()
{
base.OnAppearing();
UserDialogs.Instance.ShowLoading("Getting Information");
await Task.Delay(2000);
// Do stuff
UserDialogs.Instance.HideLoading();
}
SecondPage:
private async void Button_Clicked(object sender, EventArgs e)
{
UserDialogs.Instance.ShowLoading("Saving Information");
await Task.Delay(2000);
// Do stuff
await Navigation.PopAsync();
}