Windows app Initializer is TelemetryConfiguration and TelemetryModules Bootstrap the WindowsApps SDK.
 /// <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);
 }
Exemplo n.º 2
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);
        }
        /// <summary>
        /// Configures HockeyClient.
        /// </summary>
        /// <param name="this">HockeyClient object.</param>
        /// <param name="identifier">Identfier.</param>
        /// <param name="appId">Namespace of main app type.</param>
        /// <param name="appVersion">Four field app version.</param>
        /// <param name="storeRegion">storeRegion.</param>
        /// <param name="localApplicationSettings">A persistable collection of settings equivalent to:
        /// https://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k(Windows.Storage.ApplicationData);k(TargetFrameworkMoniker-.NETCore,Version%3Dv5.0);k(DevLang-csharp)&rd=true</param>
        /// <param name="roamingApplicationSettings">A persistable collection of settings equivalent to:
        /// https://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k(Windows.Storage.ApplicationData);k(TargetFrameworkMoniker-.NETCore,Version%3Dv5.0);k(DevLang-csharp)&rd=true.</param>
        /// <param name="keepRunningAfterException">Keep running after exception.</param>
        /// <returns>Instance object.</returns>
        public static IHockeyClientConfigurable Configure(this IHockeyClient @this, string identifier, string appId, string appVersion, string storeRegion, IDictionary <string, object> localApplicationSettings, IDictionary <string, object> roamingApplicationSettings, bool keepRunningAfterException = false)
        {
            if (@this.AsInternal().TestAndSetIsConfigured())
            {
                return(@this as IHockeyClientConfigurable);
            }
            if (localApplicationSettings == null)
            {
                throw new ArgumentNullException("localApplicationSettings");
            }
            if (roamingApplicationSettings == null)
            {
                throw new ArgumentNullException("roamingApplicationSettings");
            }

            var deviceService = new DeviceService();

            @this.AsInternal().PlatformHelper = new HockeyPlatformHelperWinForms(deviceService);
            @this.AsInternal().AppIdentifier  = identifier;

            ServiceLocator.AddService <IPlatformService>(new PlatformService(localApplicationSettings, roamingApplicationSettings));
            ServiceLocator.AddService <IApplicationService>(new ApplicationService(appId, appVersion, storeRegion));
            ServiceLocator.AddService <IHttpService>(new WinFormsHttpService());
            ServiceLocator.AddService <IDeviceService>(deviceService);
            ServiceLocator.AddService <BaseStorageService>(new StorageService());
            ServiceLocator.AddService <IUnhandledExceptionTelemetryModule>(new UnhandledExceptionTelemetryModule(keepRunningAfterException));

            var config = new TelemetryConfiguration()
            {
#if DEBUG
                EnableDiagnostics = true,
#endif
                InstrumentationKey = identifier
            };

            WindowsAppInitializer.InitializeAsync(identifier, config).ContinueWith(t =>
            {
                object userId = null;
                if (roamingApplicationSettings.TryGetValue("HockeyAppUserId", out userId) && userId != null)
                {
                    ((IHockeyClientConfigurable)@this).SetContactInfo(userId.ToString(), null);
                }
            });

            return((IHockeyClientConfigurable)@this);
        }
Exemplo n.º 4
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);
        }
Exemplo n.º 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="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);
        }