private static IAsyncAction handle(Uri uri) { return(AsyncInfo.Run(async token => { try { var r = await UriLauncher.HandleAsync(uri); switch (r) { case GalleryLaunchResult g: { var page = RootControl.RootController.Frame.Content; var vm = await GalleryVM.GetVMAsync(g.GalleryInfo); if (!(page is GalleryPage gPage && gPage.ViewModel.Gallery.ID == g.GalleryInfo.ID)) { await RootControl.RootController.Navigator.NavigateAsync(typeof(GalleryPage), g.GalleryInfo.ID); await Task.Delay(500); } switch (g.Status) { case GalleryLaunchStatus.Image: vm.View.MoveCurrentToPosition(g.CurrentIndex); await RootControl.RootController.Navigator.NavigateAsync(typeof(ImagePage), g.GalleryInfo.ID); break; case GalleryLaunchStatus.Torrent: (RootControl.RootController.Frame.Content as GalleryPage)?.ChangePivotSelection(2); break; default: (RootControl.RootController.Frame.Content as GalleryPage)?.ChangePivotSelection(0); break; } return; } case SearchLaunchResult sr: switch (sr.Data) { case CategorySearchResult ksr: var vm = SearchVM.GetVM(ksr); await RootControl.RootController.Navigator.NavigateAsync(typeof(SearchPage), vm.SearchQuery); return; case FavoritesSearchResult fsr: var fvm = FavoritesVM.GetVM(fsr); await RootControl.RootController.Navigator.NavigateAsync(typeof(FavoritesPage), fvm.SearchQuery); return; } throw new InvalidOperationException(); } } catch (Exception e) { RootControl.RootController.SendToast(e, null); } })); }
public static bool CanHandleInApp(Uri uri) { if (isPrivateProtocal(uri)) { return(true); } return(UriLauncher.CanHandle(reform(uri))); }
void OpenUrl(Uri targetUrl) { // ask for confirmation or if WhatIf is specified if (ShouldProcess(targetUrl.OriginalString, "Open")) { LogCore(MessageLevel.Info, string.Format("Url: '{0}'", targetUrl.AbsoluteUri)); UriLauncher.OpenExternalLink(targetUrl); } }
public static bool CanHandleInApp(Uri uri) { return UriLauncher.CanHandle(uri); }