Gans
Gans

Reputation: 129

Show page for few seconds and navigate to another page

Is there any way to show page A for 5 seconds and navigate to page B ? I am building a POS application. It has to show approved transaction screen for few seconds and navigate to print receipt screen automatically after 5 seconds. Thanks in advance.

Upvotes: 2

Views: 2604

Answers (2)

Gary Holland
Gary Holland

Reputation: 2645

Just put a delay in your code prior to calling the routine to open the new page:

await Task.Delay(5000);

or if if you want the screen to lock up whilst the delay is happening, just use the sleep command:

Thread.Sleep(5000);

Upvotes: 0

Jason
Jason

Reputation: 89102

use a timer:

Device.StartTimer(TimeSpan.FromMilliseconds(5000), () =>
        {
           Navigation.PushAsync(new PageB());
           return false;
        });

Upvotes: 4

Related Questions