protected override void OnNavigatedTo(NavigationEventArgs e) { if (e.Parameter is BeerScraper) { // Reset the token this.beerScraper = (BeerScraper)e.Parameter; } base.OnNavigatedTo(e); }
public AppRoot() { this.InitializeComponent(); this.filter = new Filter("", "", ""); localSettings.Values["multithreading_enabled"] = true; //create database handler, send this instance to all other classes. this.databaseHandler = new DatabaseHandler("SkereBiertjesV6.db"); this.databaseHandler.delete(); this.beerScraper = new BeerScraper(databaseHandler); Task T1 = new Task(() => { beerScraper.startFindingFirstBeers(false); }); T1.Start(); }
/** * This method below will be called everytime the user * navigates to the MainPage view (aka 'home') */ protected override void OnNavigatedTo(NavigationEventArgs e) { if (e.Parameter is IDictionary <string, Object> ) { IDictionary <string, Object> data = (IDictionary <string, Object>)e.Parameter; this.filter = (Filter)data["filter"]; this.beerScraper = (BeerScraper)data["beerScraper"]; // Start loading in the beers from the async method "displayBeersOnScreenAsync" // in a specific thread so UI will not be blocked uiSearchMode(); Thread t1 = new Thread(async() => { await displayBeersOnScreenAsync("", cancellationTokenSource.Token); }); t1.Start(); } base.OnNavigatedTo(e); }