Exemplo n.º 1
0
        /// <summary>
        /// Loads data while starting the application.
        /// </summary>
        public new static async Task DownloadAsync(bool forceDownload = false, int timeout = 5000)
        {
            Downloaded = false;

            // Offline mode.

            if (OfflineMode)
            {
                if ((!System.IO.Directory.Exists("data") || !System.IO.Directory.Exists("basic") || forceDownload || (IsUpdateNeeded && IsConnected)))
                {
                    try
                    {
                        Preprocessor.DataFeed.GetAndTransformDataFeed <GtfsDataFeed>(FullDataSource);
                    }
                    catch
                    {
                        throw new ArgumentException("Fatal error. Cannot process the data.");
                    }
                }
            }

            // Online mode.

            else
            {
                await DataFeedClient.DownloadAsync(forceDownload, timeout);
            }

            Downloaded = true;

            Load();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Updates data feed.
        /// </summary>
        public new static void Load()
        {
            if (OfflineMode)
            {
                fullData = new Interop.DataFeedManaged();
            }

            DataFeedClient.Load();
        }