Inheritance: IUnhandledExceptionTelemetryModule
Ejemplo n.º 1
0
        /// <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);
        }
        /// <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;
        }