Exemplo n.º 1
0
 /// <summary>
 /// Tracks the event.
 /// </summary>
 /// <param name="type">The type.</param>
 /// <param name="category">The category.</param>
 /// <param name="action">The action.</param>
 private static void TrackEvent(Type type, string category, string action)
 {
     InitEvent(type, category, action);
     if (NetworkMonitor.IsNetworkAvailable)
     {
         var result = HttpWebClientService.DownloadImage(new Uri(NetworkConstants.
                                                                 GoogleAnalyticsUrl), new RequestParams(BuildQueryString()));
         if (EveMonClient.IsDebugBuild)
         {
             // Trace the error (if any) and event category
             EveMonClient.Trace($"({category} - {action})");
             if (result.Error != null)
             {
                 EveMonClient.Trace($"{result.Error.Message}");
             }
         }
     }
     else
     {
         // Reschedule later
         Dispatcher.Schedule(TimeSpan.FromMinutes(1), () => TrackEvent(type, category,
                                                                       action));
         if (EveMonClient.IsDebugBuild)
         {
             EveMonClient.Trace($"in {TimeSpan.FromMinutes(1)}");
         }
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Tracks the event.
        /// </summary>
        /// <param name="type">The type.</param>
        /// <param name="category">The category.</param>
        /// <param name="action">The action.</param>
        private static void TrackEvent(Type type, string category, string action)
        {
            InitEvent(type, category, action);

            if (NetworkMonitor.IsNetworkAvailable)
            {
                DownloadResult <Image> result = HttpWebClientService.DownloadImage(new Uri(NetworkConstants.GoogleAnalyticsUrl),
                                                                                   HttpMethod.Post, postdata: BuildQueryString());

                if (!EveMonClient.IsDebugBuild)
                {
                    return;
                }

                EveMonClient.Trace($"({category} - {action})");

                if (result.Error != null)
                {
                    EveMonClient.Trace($"{result.Error.Message}");
                }

                return;
            }

            // Reschedule later otherwise
            Dispatcher.Schedule(TimeSpan.FromMinutes(1), () => TrackEvent(type, category, action));

            if (EveMonClient.IsDebugBuild)
            {
                EveMonClient.Trace($"in {TimeSpan.FromMinutes(1)}");
            }
        }