Created
January 14, 2021 16:28
-
-
Save sjehutch/ebf6af8dec76d44b4b3caefa12633acc to your computer and use it in GitHub Desktop.
Page Navigation Xamarin Forms
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Threading.Tasks; | |
using Xamarin.Forms; | |
namespace NewYoutube.Services | |
{ | |
public class PageService : IPageService | |
{ | |
public async Task<bool> DisplayAlert(string title, string message, string ok, string cancel) | |
{ | |
return await MainPage.DisplayAlert(title, message, ok, cancel); | |
} | |
public async Task DisplayAlert(string title, string message, string ok) | |
{ | |
await MainPage.DisplayAlert(title, message, ok); | |
} | |
public async Task<Page> PopAsync() | |
{ | |
return await MainPage.Navigation.PopAsync(); | |
} | |
public async Task PushAsync(Page page) | |
{ | |
await MainPage.Navigation.PushAsync(page); | |
} | |
public async Task PushModalAsync(Page page) | |
{ | |
await MainPage.Navigation.PushModalAsync(page); | |
} | |
private Page MainPage | |
{ | |
get { return Application.Current.MainPage; } | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment