private async void CWebView_Navigated(object sender, WebNavigatedEventArgs e) { // This regex checks if the url is a book and gets the id Match regex = new Regex(@"(\d+)[-b]*.epub").Match(e.Url); if (regex.Success) { string id = regex.Groups[1].Value; CBook book = CApi.SearchBooks(id, "id", "exact").Books[0]; ChitankaBookModel cBook = new ChitankaBookModel() { Book = book, DownloadURL = e.Url }; await Navigation.PushModalAsync(new NavigationPage(new BookDetailView(cBook))); } else { bool regexFb = new Regex(@"(\d+)[-b]*.fb2.zip").Match(e.Url).Success; bool regexTxt = new Regex(@"(\d+)[-b]*.txt.zip").Match(e.Url).Success; bool regexSfb = new Regex(@"(\d+)[-b]*.sfb.zip").Match(e.Url).Success; if (!(regexFb || regexTxt || regexSfb)) { vm.LastPage = e.Url; } } }
public BookDetailView(ChitankaBookModel book) { InitializeComponent(); BindingContext = new BookDetailViewModel(book); }