Exemple #1
0
 /// <summary>
 /// Returns true if everything is OK.
 /// </summary>
 public static async Task <bool> CheckBasicDataValidity()
 {
     try
     {
         await DataFeedClient.DownloadAsync(true);                 // Checks basic data validity.
     }
     catch (System.Net.WebException)
     {
         PlatformDependentSettings.ShowMessage(Settings.Localization.UnreachableHost);
         return(false);
     }
     return(true);
 }
Exemple #2
0
 /// <summary>
 /// Returns true if everything is OK.
 /// </summary>
 public static async Task <bool> CheckBasicDataValidity()
 {
     if (!DataFeedDesktop.OfflineMode)
     {
         try
         {
             await DataFeedClient.DownloadAsync(true);                     // Checks basic data validity.
         }
         catch (System.Net.WebException)
         {
             MessageBox.Show(Settings.Localization.UnreachableHost, Settings.Localization.Offline, MessageBoxButtons.OK, MessageBoxIcon.Error);
             return(false);
         }
     }
     return(true);
 }
        /// <summary>
        /// Processes the request.
        /// </summary>
        /// <typeparam name="Req">Request type.</typeparam>
        /// <typeparam name="Proc">Processing object type.</typeparam>
        /// <typeparam name="Res">Response type.</typeparam>
        /// <param name="request">Request to process.</param>
        public static async Task <Res> ProcessAsync <Req, Proc, Res>(Req request) where Proc : Networking <Req, Res>, new() where Res : ResponseBase where Req : RequestBase
        {
            try
            {
                await DataFeedClient.DownloadAsync(true);

                using (var processing = new Proc())
                {
                    return(await processing.ProcessAsync(request, Settings.TimeoutDuration));
                }
            }
            catch
            {
                return(default(Res));
            }
        }
Exemple #4
0
        /// <summary>
        /// Loads data feed.
        /// </summary>
        public static async void LoadDataFeedAsync()
        {
            try
            {
                DataFeedClient.Load();                 // Load some data first if exists, then try to update them.
            }
            catch
            {
            }

            try
            {
                await DataFeedClient.DownloadAsync(false, TimeoutDuration);
            }
            catch
            {
                PlatformDependentSettings.ShowMessage(Settings.Localization.UnreachableHost);
            }
        }
Exemple #5
0
 static StopSimplifiedDataController()
 {
     AsyncHelpers.RunSync(() => DataFeedClient.DownloadAsync(true));
 }
Exemple #6
0
 static LineDataController()
 {
     AsyncHelpers.RunSync(() => DataFeedClient.DownloadAsync(true));
 }
Exemple #7
0
 static ThroughgoingLinesDataController()
 {
     AsyncHelpers.RunSync(() => DataFeedClient.DownloadAsync(true));
 }