public ViewArticlePage(WebViewSource webViewSource, string actionText, Command actionCommand) { InitializeComponent(); webView.Source = webViewSource; GoBackCommand = new Command(GoBack); backButton.GestureRecognizers.Add(new TapGestureRecognizer { Command = GoBackCommand }); ActionCommand = actionCommand; actionButton.Text = actionText; actionButton.GestureRecognizers.Add(new TapGestureRecognizer { Command = actionCommand }); randomButton.IsVisible = false; localArticlesService = DependencyService.Resolve <ILocalArticlesService>(); hTMLService = DependencyService.Resolve <IHTMLService>(); }
/// <summary> /// Function to start the service. This will prime all the used services and start the download queue consumer function. /// It will also load any cached un-downloaded articles. /// </summary> public static void Start() { wikipediaAccessor = DependencyService.Resolve <IWikipediaAccessor>(); hTMLService = DependencyService.Resolve <IHTMLService>(); localArticlesService = DependencyService.Resolve <ILocalArticlesService>(); DownloadQueue = new List <string>(); subscribedBadgeCallbacks = new List <Action <int> >(); subscribedStatusCallbacks = new List <Action <DownloadsStatusUpdate> >(); // Load any articles that failed to download last time the app was open and add them back to the queue List <string> settingsDownloadQueue = Settings.DownloadQueue; if (settingsDownloadQueue.Count > 0) { DownloadQueue = settingsDownloadQueue; TotalNumArticles = Settings.TotalNumberOfArticlesToDownload; } // Start Consumer Function Task.Run(() => DownloadQueueConsumer()); }