Пример #1
0
 /// <summary>
 /// Register the usage of the application with a ClearCanvas server on a background thread.
 /// </summary>
 /// <remarks>
 /// A check is done of the <see cref="UsageTrackingSettings"/>, and if usage tracking is enabled, the
 /// <paramref name="message"/> is sent to the ClearCanvas server.
 /// </remarks>
 /// <param name="message">The usage message to send.</param>
 /// <param name="thread">Flag telling if the usage will be sent on the current thread or a background thread.</param>
 public static void Register(UsageMessage message, UsageTrackingThread thread)
 {
     if (UsageTrackingSettings.Default.Enabled)
     {
         try
         {
             UsageMessage theMessage = message;
             if (thread == UsageTrackingThread.Current)
             {
                 Send(theMessage);
             }
             else if (thread == UsageTrackingThread.Background)
             {
                 ThreadPool.QueueUserWorkItem(Send, theMessage);
             }
         }
         catch (Exception e)
         {
             // Fail silently
             Platform.Log(LogLevel.Debug, e);
         }
     }
 }
Пример #2
0
		/// <summary>
		/// Register the usage of the application with a ClearCanvas server on a background thread.
		/// </summary>
		/// <remarks>
		/// A check is done of the <see cref="UsageTrackingSettings"/>, and if usage tracking is enabled, the 
		/// <paramref name="message"/> is sent to the ClearCanvas server.
		/// </remarks>
		/// <param name="message">The usage message to send.</param>
		/// <param name="thread">Flag telling if the usage will be sent on the current thread or a background thread.</param>
		public static void Register(UsageMessage message, UsageTrackingThread thread)
		{
			if (UsageTrackingSettings.Default.Enabled)
				try
				{
					UsageMessage theMessage = message;
					if (thread == UsageTrackingThread.Current)
						Send(theMessage);
					else if (thread == UsageTrackingThread.Background)
						ThreadPool.QueueUserWorkItem(Send, theMessage);
				}
				catch (Exception e)
				{
					// Fail silently
					Platform.Log(LogLevel.Debug, e);
				}
		}