public App() { #if DEBUG HotReloader.Current.Run(this); #endif MainPage = new NavigationPage(); AppMainPage = MainPage as NavigationPage; ContentPage = new ContentListPage(AppMainPage) { BindingContext = new ContentListPageViewModel(new DialogService()) }; AppMainPage.PushAsync(ContentPage); }
private static async Task LoadUrlImpl(string url) { Logger.Info(""); while (true) { if (AppMainPage.CurrentPage is IContentPayloadHandler handler && await handler.HandleUrl(url)) { return; } var page = await AppMainPage.PopAsync(); if (page == null) { await(new DialogService()).ShowError( "Could not find content with url: " + url + ". Returning to the main page.", "Could not find content. ", "OK", null); await AppMainPage.PushAsync(ContentPage); return; } } }
public App( string appHostBaseUrl, string appHostInitialUrl, string oneSignalIdentifier, ICollection <string> ignoreUrls) { _ignoreUrls = ignoreUrls ?? new List <string>(); _appMainPage = new AppMainPage($"{DDAppLocalUrl}{appHostInitialUrl}"); MainPage = _appMainPage; StartWebProxy(); _nativeService = DependencyService.Get <INative>(); var cacheBaseDir = _nativeService.GetCacheDir(); _cache = new ApplicationCache(appHostBaseUrl, cacheBaseDir); Task.Run(async() => { _nativeService.LoadPreCache(); await Task.Delay(1000); Device.BeginInvokeOnMainThread(() => { _appMainPage.ToWebState(); if (!string.IsNullOrWhiteSpace(oneSignalIdentifier)) { Task.Run(async() => { await Task.Delay(3000); OneSignal.Current.StartInit(oneSignalIdentifier).EndInit(); }); } }); }); }