コード例 #1
0
        /// <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());
        }
コード例 #2
0
 public WikipediaService()
 {
     wikipediaAccessor = DependencyService.Resolve <IWikipediaAccessor>();
 }