Encapsulates the global telemetry configuration typically loaded from the configuration file.
All TelemetryContext objects are initialized using the Active telemetry configuration provided by this class.
Inheritance: IDisposable
 /// <summary>
 /// Bootstraps HockeyApp SDK.
 /// </summary>
 /// <param name="this"><see cref="HockeyClient"/></param>
 /// <param name="appId">The application identifier, which is a unique hash string which is automatically created when you add a new application to HockeyApp service.</param>
 /// <param name="configuration">Telemetry Configuration.</param>
 public static IHockeyClientConfigurable Configure(this IHockeyClient @this, string appId, TelemetryConfiguration configuration)
 {
     ServiceLocator.AddService<BaseStorageService>(new StorageService());
     ServiceLocator.AddService<IApplicationService>(new ApplicationService());
     ServiceLocator.AddService<IDeviceService>(new DeviceService());
     ServiceLocator.AddService<Services.IPlatformService>(new PlatformService());
     ServiceLocator.AddService<IHttpService>(new HttpClientTransmission());
     ServiceLocator.AddService<IUnhandledExceptionTelemetryModule>(new UnhandledExceptionTelemetryModule());
     WindowsAppInitializer.InitializeAsync(appId, configuration);
     return @this as IHockeyClientConfigurable;
 }
        /// <summary>
        /// This is the main configuration method. Call this in the Constructor of your app. This registers an error handler for unhandled errors.
        /// </summary>
        /// <param name="this"></param>
        /// <param name="appIdentifier">Your unique app id from HockeyApp.</param>
        /// <param name="endpointAddress">The HTTP address where the telemetry is sent.</param>
        /// <param name="configuration">Telemetry configuration.</param>
        /// <returns>Configurable Hockey client. Configure additional settings by calling methods on the returned IHockeyClientConfigurable</returns>
        public static IHockeyClientConfigurable Configure(this IHockeyClient @this, string appIdentifier, TelemetryConfiguration configuration = null)
        {
            @this.AsInternal().PlatformHelper = new HockeyPlatformHelper81();
            @this.AsInternal().AppIdentifier = appIdentifier;

            ServiceLocator.AddService<BaseStorageService>(new StorageService());
            ServiceLocator.AddService<IApplicationService>(new ApplicationService());
            ServiceLocator.AddService<IDeviceService>(new DeviceService());
            ServiceLocator.AddService<Services.IPlatformService>(new PlatformService());
            ServiceLocator.AddService<IUnhandledExceptionTelemetryModule>(new UnhandledExceptionTelemetryModule());
            WindowsAppInitializer.InitializeAsync(appIdentifier, configuration);
            return @this as IHockeyClientConfigurable;
        }
        /// <summary>
        /// Initializes default configuration and starts automatic telemetry collection for specified WindowsCollectors flags. Must specify InstrumentationKey as a parameter or in configuration file.
        /// <param name="instrumentationKey">Telemetry configuration.</param>
        /// <param name="configuration">Telemetry configuration.</param>
        /// </summary>
        internal static Task InitializeAsync(string instrumentationKey, TelemetryConfiguration configuration = null)
        {
            Guid instrumentationKeyGuid;
            if (!Guid.TryParse(instrumentationKey, out instrumentationKeyGuid))
            {
                throw new ArgumentException(string.Format(System.Globalization.CultureInfo.InvariantCulture, "instrumentationKey {0} is incorrect. It must be a string representation of a GUID", instrumentationKey));
            }

            // breeze accepts instrumentation key in 32 digits separated by hyphens format only.
            instrumentationKey = instrumentationKeyGuid.ToString("D");
            if (configuration == null)
            {
                configuration = new TelemetryConfiguration();
            }

            configuration.InstrumentationKey = instrumentationKey;
            TelemetryConfiguration.Active = configuration;
            return Task.Delay(TimeSpan.FromSeconds(1)).ContinueWith(t => Initalize());
        }
        /// <summary>
        /// main configuration method. call in app constructor
        /// </summary>
        /// <param name="this"></param>
        /// <param name="appId"></param>
        /// <param name="rootFrame"></param>
        /// <returns></returns>
        public static IHockeyClientConfigurable Configure(this IHockeyClient @this, string appId, TelemetryConfiguration telemetryConfiguration = null, Frame rootFrame = null)
        {
            @this.AsInternal().PlatformHelper = new HockeyPlatformHelperWP8SL();
            @this.AsInternal().AppIdentifier = appId;
            CrashHandler.Current.Application = Application.Current;
                
            ServiceLocator.AddService<BaseStorageService>(new StorageService());
            ServiceLocator.AddService<Services.IApplicationService>(new ApplicationService());
            ServiceLocator.AddService<Services.IPlatformService>(new PlatformService());
            ServiceLocator.AddService<IDeviceService>(new DeviceService());
            var exceptionModule = new UnhandledExceptionTelemetryModule(rootFrame);

            // we need to initialize in Configure method and not in WindowsAppInitializer.InitializeAsync 
            // to prevent UnauthorizedAccessException with Invalid cross-thread access message
            exceptionModule.Initialize();
            ServiceLocator.AddService<IUnhandledExceptionTelemetryModule>(exceptionModule);
            WindowsAppInitializer.InitializeAsync(appId, telemetryConfiguration);
            return @this as IHockeyClientConfigurable;
        }
示例#5
0
        /// <summary>
        /// This is the main configuration method. Call this in the Constructor of your app. This registers an error handler for unhandled errors.
        /// </summary>
        /// <param name="this"></param>
        /// <param name="appIdentifier">Your unique app id from HockeyApp.</param>
        /// <param name="endpointAddress">The HTTP address where the telemetry is sent.</param>
        /// <param name="configuration">Telemetry configuration.</param>
        /// <returns>Configurable Hockey client. Configure additional settings by calling methods on the returned IHockeyClientConfigurable</returns>
        public static IHockeyClientConfigurable Configure(this IHockeyClient @this, string appIdentifier, TelemetryConfiguration configuration = null)
        {
            @this.AsInternal().PlatformHelper = new HockeyPlatformHelper81();
            @this.AsInternal().AppIdentifier  = appIdentifier;

            ServiceLocator.AddService <BaseStorageService>(new StorageService());
            ServiceLocator.AddService <IApplicationService>(new ApplicationService());
            ServiceLocator.AddService <IDeviceService>(new DeviceService());
            ServiceLocator.AddService <Services.IPlatformService>(new PlatformService());
            ServiceLocator.AddService <IUnhandledExceptionTelemetryModule>(new UnhandledExceptionTelemetryModule());
            WindowsAppInitializer.InitializeAsync(appIdentifier, configuration);
            return(@this as IHockeyClientConfigurable);
        }
示例#6
0
        /// <summary>
        /// This is the main configuration method. Call this in the Constructor of your app. This registers an error handler for unhandled errors.
        /// </summary>
        /// <param name="this"></param>
        /// <param name="appIdentifier">Your unique app id from HockeyApp.</param>
        /// <param name="configuration">Your unique app id from HockeyApp.</param>
        /// <returns>Configurable Hockey client. Configure additional settings by calling methods on the returned IHockeyClientConfigurable</returns>
        public static IHockeyClientConfigurable Configure(this IHockeyClient @this, string appIdentifier, TelemetryConfiguration configuration = null)
        {
            if (@this.AsInternal().TestAndSetIsConfigured())
            {
                return(@this as IHockeyClientConfigurable);
            }

            @this.AsInternal().PlatformHelper = new HockeyPlatformHelper81();
            @this.AsInternal().AppIdentifier  = appIdentifier;

            Application.Current.Suspending += HandleAppSuspending;

            ServiceLocator.AddService <BaseStorageService>(new StorageService());
            ServiceLocator.AddService <IApplicationService>(new ApplicationService());
            ServiceLocator.AddService <IDeviceService>(new DeviceService());
            ServiceLocator.AddService <Services.IPlatformService>(new PlatformService());
            ServiceLocator.AddService <IHttpService>(new HttpClientTransmission());
            ServiceLocator.AddService <IUnhandledExceptionTelemetryModule>(new UnhandledExceptionTelemetryModule());
            WindowsAppInitializer.InitializeAsync(appIdentifier, configuration);
            return(@this as IHockeyClientConfigurable);
        }
示例#7
0
 /// <summary>
 /// Bootstraps HockeyApp SDK.
 /// </summary>
 /// <param name="this"><see cref="HockeyClient"/></param>
 /// <param name="appId">The application identifier, which is a unique hash string which is automatically created when you add a new application to HockeyApp service.</param>
 /// <param name="configuration">Telemetry Configuration.</param>
 public static IHockeyClientConfigurable Configure(this IHockeyClient @this, string appId, TelemetryConfiguration configuration)
 {
     if (@this.AsInternal().TestAndSetIsConfigured())
     {
         return(@this as IHockeyClientConfigurable);
     }
     ServiceLocator.AddService <BaseStorageService>(new StorageService());
     ServiceLocator.AddService <IApplicationService>(new ApplicationService());
     ServiceLocator.AddService <IDeviceService>(new DeviceService());
     ServiceLocator.AddService <Services.IPlatformService>(new PlatformService());
     ServiceLocator.AddService <IHttpService>(new HttpClientTransmission());
     ServiceLocator.AddService <IUnhandledExceptionTelemetryModule>(new UnhandledExceptionTelemetryModule());
     WindowsAppInitializer.InitializeAsync(appId, configuration);
     return(@this as IHockeyClientConfigurable);
 }
        /// <summary>
        /// Creates a new <see cref="TelemetryConfiguration"/> instance loaded from the configuration file.
        /// If the configuration file does not exist, the new configuration instance is initialized with minimum defaults 
        /// needed to send telemetry to Application Insights.
        /// </summary>
        internal static TelemetryConfiguration CreateDefault()
        {
            var configuration = new TelemetryConfiguration();
            TelemetryConfigurationFactory.Instance.Initialize(configuration);

            return configuration;
        }