loot verge
loot verge

Reputation: 449

How to redirect to next view page in Xamarin Forms?

How can I redirect my user to next view after the functions are loaded? I have two pages Sync Page and Main Menu Page and four functions inside Sync Page that will be loaded upon loading of my page then after loading that four functions it should redirect my user to my main menu page.

The problem is upon loading my sync page it will initialize the four functions and my navigation function it will redirect to my Main Menu Page then it will redirect back to my Sync Page

Here is the code of my Sync Page

    public SyncPageViewModel(string host, string database, string contactID)
    {
        InsertActivityData(host, database, contactID);
        InsertCAFData(host, database, contactID);
        InsertContactsData(host, database, contactID);
        InsertActivityData(host, database, contactID);
        OnSyncComplete();
    }

Here is the code of my navigation

public void OnSyncComplete()
    {
        Application.Current.MainPage.Navigation.PopAsync();
        Application.Current.MainPage.Navigation.PushAsync(new MainMenu(), true);
    }

Upvotes: 1

Views: 4299

Answers (1)

loot verge
loot verge

Reputation: 449

Application.Current.MainPage.Navigation.PushModalAsync(new MainMenu(), true); 

instead of

Application.Current.MainPage.Navigation.PushAsync(new MainMenu(), true);

Upvotes: 1

Related Questions