/// <summary> /// Call in your app if user logs out. Deletes all persistently stored data like FeedbackThreadToken, and cached Message. . /// </summary> public static void LogoutFromFeedback(this IHockeyClient @this) { var settingValues = ApplicationData.Current.LocalSettings.Values; settingValues.RemoveValue(ConstantsUniversal.FeedbackThreadKey); FeedbackManager.Current.CurrentFeedbackFlyoutVM = new FeedbackFlyoutVM(); }
/// <summary> /// Send crashes to the HockeyApp server. If crashes are available a messagebox will popoup to ask the user if he wants to send crashes. /// </summary> /// <param name="this"></param> /// <param name="sendAutomatically">if true crashes will be sent without asking</param> /// <returns></returns> public static async Task <bool> SendCrashesAsync(this IHockeyClient @this, Boolean sendAutomatically = false) { @this.AsInternal().CheckForInitialization(); if (sendAutomatically) { return(await @this.AsInternal().SendCrashesAndDeleteAfterwardsAsync().ConfigureAwait(false)); } else { if (await @this.AsInternal().AnyCrashesAvailableAsync()) { MessageBoxResult result = MessageBox.Show(LocalizedStrings.LocalizedResources.CrashLogQuestion, LocalizedStrings.LocalizedResources.CrashLogMessageBox, MessageBoxButton.YesNo); if (result.Equals(MessageBoxResult.Yes)) { return(await @this.AsInternal().SendCrashesAndDeleteAfterwardsAsync().ConfigureAwait(false)); } else { await @this.AsInternal().DeleteAllCrashesAsync().ConfigureAwait(false); } } return(false); } }
/// <summary> /// You need to call this method in your App's OnActivated method if you use the feedback feature. This allows for HockeyApp to continue after a /// PickFileAndContinue resume when adding images as attachments to a message /// </summary> /// <param name="this"></param> /// <param name="e"></param> /// <returns>true if the reactivation occured because of Feedback Filepicker</returns> public static bool HandleReactivationOfFeedbackFilePicker(this IHockeyClient @this, IActivatedEventArgs e) { var continuationEventArgs = e as IContinuationActivatedEventArgs; if (continuationEventArgs != null && ActivationKind.PickFileContinuation.Equals(continuationEventArgs.Kind)) { var args = (FileOpenPickerContinuationEventArgs)e; if (args.ContinuationData.ContainsKey(FeedbackManager.FilePickerContinuationKey)) { if (args.Files.Count > 0) { dynamic pars = new DynamicNavigationParameters(); pars.ImageFile = args.Files[0]; ((Window.Current.Content) as Frame).Navigate(typeof(FeedbackImagePage), pars); return(true); } else { ((Window.Current.Content) as Frame).Navigate(typeof(FeedbackFormPage)); return(true); } } } return(false); }
/// <summary> /// Initializes the singleton application object. This is the first line of authored code /// executed, and as such is the logical equivalent of main() or WinMain(). /// </summary> public App() { // Setup DI IServiceCollection serviceCollection = new ServiceCollection(); serviceCollection.AddApplication(); serviceCollection.AddInfrastructureCommon(); serviceCollection.AddInfrastructureKeePass(); serviceCollection.AddInfrastructureUwp(); serviceCollection.AddWin81App(); Services = serviceCollection.BuildServiceProvider(); _mediator = Services.GetService <IMediator>(); _resource = Services.GetService <IResourceProxy>(); _settings = Services.GetService <ISettingsProxy>(); _navigation = Services.GetService <INavigationService>(); _notification = Services.GetService <INotificationService>(); _log = Services.GetService <ILogger>(); _hockey = Services.GetService <IHockeyClient>(); _file = Services.GetService <IFileProxy>(); _messenger = Services.GetService <IMessenger>(); InitializeComponent(); Suspending += OnSuspending; Resuming += OnResuming; UnhandledException += OnUnhandledException; _messenger.Register <SaveErrorMessage>(this, async message => await HandleSaveError(message)); }
/// <summary> /// Call in your app if user logs out. Deletes all persistently stored data like FeedbackThreadToken, and cached Message. . /// </summary> public static async Task LogoutFromFeedbackAsync(this IHockeyClient @this) { var settingValues = ApplicationData.Current.LocalSettings.Values; settingValues.RemoveValue(ConstantsUniversal.FeedbackThreadKey); await FeedbackManager.Current.ClearMessageCacheAsync(); }
/// <summary> /// Send crashes to the HockeyApp server /// </summary> /// <param name="client"></param> /// <returns></returns> public static async Task <bool> SendCrashesAsync(this IHockeyClient client) { client.AsInternal().CheckForInitialization(); bool result = await client.AsInternal().SendCrashesAndDeleteAfterwardsAsync().ConfigureAwait(false); return(result); }
/// <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> /// <returns>Configurable Hockey client. Configure additional settings by calling methods on the returned IHockeyClientConfigurable</returns> public static IHockeyClientConfigurable Configure(this IHockeyClient @this, string appIdentifier) { @this.AsInternal().PlatformHelper = new HockeyPlatformHelper81(); @this.AsInternal().AppIdentifier = appIdentifier; //Application.Current.Resuming += HandleAppResuming; Application.Current.Suspending += HandleAppSuspending; TaskScheduler.UnobservedTaskException += async(sender, e) => { e.SetObserved(); await HockeyClient.Current.AsInternal().HandleExceptionAsync(e.Exception); if (customUnobservedTaskExceptionFunc == null || customUnobservedTaskExceptionFunc(e)) { Application.Current.Exit(); } }; Application.Current.UnhandledException += async(sender, e) => { e.Handled = true; await HockeyClient.Current.AsInternal().HandleExceptionAsync(e.Exception); if (customUnhandledExceptionFunc == null || customUnhandledExceptionFunc(e)) { Application.Current.Exit(); } }; return(@this as IHockeyClientConfigurable); }
internal CrashHandler(IHockeyClient hockeyClient, Func<Exception, string> descriptionLoader) { this._hockeyClient = hockeyClient; this._descriptionLoader = descriptionLoader; InitCrashLogInformation(); Application.Current.UnhandledException += Current_UnhandledException; TaskScheduler.UnobservedTaskException += TaskScheduler_UnobservedTaskException; }
internal CrashHandler(IHockeyClient hockeyClient, Func <Exception, string> descriptionLoader) { this._hockeyClient = hockeyClient; this._descriptionLoader = descriptionLoader; InitCrashLogInformation(); Application.Current.UnhandledException += Current_UnhandledException; TaskScheduler.UnobservedTaskException += TaskScheduler_UnobservedTaskException; }
public static void ConfigureWithDefaultParameters(this IHockeyClient hockeyClient) { hockeyClient.Configure(Constants.HockeyAppId, new TelemetryConfiguration { EnableDiagnostics = true, Collectors = WindowsCollectors.Session | WindowsCollectors.UnhandledException }); }
/// <summary> /// Invoke this method to open the feedback UI where a user can send you a message including image attachments over the HockeyApp feedback system. /// </summary> /// <param name="this"></param> /// <param name="initialUserName">[Optional] Username to prefill the name field</param> /// <param name="initialEMail">[Optional] Email to prefill the email field</param> public static void ShowFeedback(this IHockeyClient @this, string initialUserName = null, string initialEMail = null) { @this.AsInternal().CheckForInitialization(); var flyout = new FeedbackFlyout(); FeedbackManager.Current.InitialEmail = initialEMail; FeedbackManager.Current.InitialUsername = initialUserName; flyout.ShowIndependent(); }
public override void ViewDidLoad() { base.ViewDidLoad(); hockeyClient = new HockeyClientTouch(); hockeyClient.Configure("$AppID", "1.0", true, true, true); hockeyClient.TrackEvent("Start iOS application from HockeyApp"); // Perform any additional setup after loading the view, typically from a nib. }
/// <summary> /// Identify user with hockeaypp auth. Opening a login page to require valid email address for app if needed /// </summary> /// <param name="this"></param> /// <param name="appSecret">Your app's app secret (see HockeyApp app page)</param> /// <param name="successRedirect">Page-URI to redirect to after successful login</param> /// <param name="navigationService">[optional] obsolete - not needed</param> /// <param name="eMail">[Optional] initial email</param> /// <param name="tokenValidationPolicy"><see cref="TokenValidationPolicy"/></param> /// <param name="authValidationMode"><see cref="AuthValidationMode"/></param> public static void IdentifyUser(this IHockeyClient @this, string appSecret, Uri successRedirect, NavigationService navigationService = null, string eMail = null, TokenValidationPolicy tokenValidationPolicy = TokenValidationPolicy.EveryLogin, AuthValidationMode authValidationMode = AuthValidationMode.Graceful) { @this.AsInternal().CheckForInitialization(); AuthManager.Instance.AuthenticateUser(successRedirect, AuthenticationMode.Identify, tokenValidationPolicy, authValidationMode, eMail, appSecret); }
public static IHockeyClientConfigurable Configure(this IHockeyClient @this, string identifier) { @this.AsInternal().AppIdentifier = identifier; @this.AsInternal().PlatformHelper = new HockeyPlatformHelperWPF(); AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; Application.Current.DispatcherUnhandledException += Current_DispatcherUnhandledException; TaskScheduler.UnobservedTaskException += TaskScheduler_UnobservedTaskException; return((IHockeyClientConfigurable)@this); }
/// <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> /// Inititate user identification and define a action to perform when authorization is successfull /// </summary> /// <param name="this">The this.</param> /// <param name="appSecret">The application secret from HockeyApp.</param> /// <param name="successAction">Action to perform when login is successfull</param> /// <param name="eMail">[Optional] E-Mail adress to prefill form</param> /// <param name="tokenValidationPolicy">[Optional] Default is EveryLogin</param> /// <param name="authValidationMode">[Optional] Default is Graceful</param> public static void IdentifyUser(this IHockeyClient @this, string appSecret, Action successAction, string eMail = null, TokenValidationPolicy tokenValidationPolicy = TokenValidationPolicy.EveryLogin, AuthValidationMode authValidationMode = AuthValidationMode.Graceful) { @this.AsInternal().CheckForInitialization(); var authMan = AuthManager.Current; authMan.SuccessAction = successAction; authMan.AuthenticateUser(AuthenticationMode.Identify, tokenValidationPolicy, authValidationMode, eMail, appSecret); }
internal CrashHandler(IHockeyClient hockeyClient, Func <Exception, string> descriptionLoader, bool keepRunning) { this._hockeyClient = hockeyClient; this._descriptionLoader = descriptionLoader; AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; if (keepRunning) { Application.Current.DispatcherUnhandledException += Current_DispatcherUnhandledException; } TaskScheduler.UnobservedTaskException += TaskScheduler_UnobservedTaskException; }
/// <summary> /// Inititate user authorization and define a page navigate to when authorization is successfull /// </summary> /// <param name="this"></param> /// <param name="pageTypeForSuccessRedirect">Pagetype to navigate when login is successfull</param> /// <param name="eMail">[Optional] E-Mail adress to prefill form</param> /// <param name="tokenValidationPolicy">[Optional] Default is EveryLogin</param> /// <param name="authValidationMode">[Optional] Default is Graceful</param> public static void AuthorizeUser(this IHockeyClient @this, Type pageTypeForSuccessRedirect, string eMail = null, TokenValidationPolicy tokenValidationPolicy = TokenValidationPolicy.EveryLogin, AuthValidationMode authValidationMode = AuthValidationMode.Graceful) { @this.AsInternal().CheckForInitialization(); var authMan = AuthManager.Current; authMan.SuccessRedirectPageType = pageTypeForSuccessRedirect; AuthManager.Current.AuthenticateUser(AuthenticationMode.Authorize, tokenValidationPolicy, authValidationMode, eMail, null); }
internal CrashHandler(IHockeyClient hockeyClient, Func<Exception, string> descriptionLoader, bool keepRunning) { this._hockeyClient = hockeyClient; this._descriptionLoader = descriptionLoader; AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; if (keepRunning) { Application.Current.DispatcherUnhandledException += Current_DispatcherUnhandledException; } TaskScheduler.UnobservedTaskException += TaskScheduler_UnobservedTaskException; }
/// <summary> /// Configures the client. /// </summary> /// <param name="this">This object.</param> /// <param name="identifier">Identifier.</param> /// <returns>HockeyClient configurable.</returns> public static IHockeyClientConfigurable Configure(this IHockeyClient @this, string identifier) { @this.AsInternal().AppIdentifier = identifier; @this.AsInternal().PlatformHelper = new HockeyPlatformHelperWPF(); AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; Application.Current.DispatcherUnhandledException += Current_DispatcherUnhandledException; ServiceLocator.AddService <IPlatformService>(new PlatformService()); TelemetryConfiguration.Active.InstrumentationKey = identifier; return((IHockeyClientConfigurable)@this); }
/// <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> /// Invoke this method to navigate to the feedback UI where a user can send you a message including image attachments over the HockeyApp feedback system. /// Make sure to add a call to HockeyClient.Current.HandleReactivationOfFeedbackFilePicker(..) to your App's OnActivated() method to allow for resuming /// the process after PickFileAndContinue.. /// </summary> /// <param name="this"></param> /// <param name="initialUsername">[Optional] Username to prefill the name field</param> /// <param name="initialEmail">[Optional] Email to prefill the email field</param> public static void ShowFeedback(this IHockeyClient @this, string initialUsername = null, string initialEmail = null) { HockeyClient.Current.AsInternal().CheckForInitialization(); dynamic pars = new DynamicNavigationParameters(); pars.IsCallFromApp = true; FeedbackManager.Current.InitialEmail = initialEmail; FeedbackManager.Current.InitialUsername = initialUsername; var frame = Window.Current.Content as Frame; frame.Navigate(typeof(FeedbackMainPage), pars); }
/// <summary> /// Invoqué lorsque l'application est lancée normalement par l'utilisateur final. D'autres points d'entrée /// seront utilisés par exemple au moment du lancement de l'application pour l'ouverture d'un fichier spécifique. /// </summary> /// <param name="e">Détails concernant la requête et le processus de lancement.</param> protected override async void OnLaunched(LaunchActivatedEventArgs e) { #if DEBUG if (System.Diagnostics.Debugger.IsAttached) { this.DebugSettings.EnableFrameRateCounter = true; } #endif hockeyClient = new HockeyClientWindowsUWP(); hockeyClient.Configure("d4f10c8b3fdd46a19382a5f4c103f22", true, true); hockeyClient.TrackEvent("Start application"); // send crashes to the HockeyApp server // await hockeyClient.SendCrashesAsync(); Frame rootFrame = Window.Current.Content as Frame; // Ne répétez pas l'initialisation de l'application lorsque la fenêtre comporte déjà du contenu, // assurez-vous juste que la fenêtre est active if (rootFrame == null) { // Créez un Frame utilisable comme contexte de navigation et naviguez jusqu'à la première page rootFrame = new Frame(); rootFrame.NavigationFailed += OnNavigationFailed; if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) { //TODO: chargez l'état de l'application précédemment suspendue } // Placez le frame dans la fenêtre active Window.Current.Content = rootFrame; } if (e.PrelaunchActivated == false) { if (rootFrame.Content == null) { // Quand la pile de navigation n'est pas restaurée, accédez à la première page, // puis configurez la nouvelle page en transmettant les informations requises en tant que // paramètre rootFrame.Navigate(typeof(MainPage), e.Arguments); } // Vérifiez que la fenêtre actuelle est active Window.Current.Activate(); } }
protected override async void OnStartup(StartupEventArgs e) { base.OnStartup(e); App.hockeyClient = new HockeyClientWpf(); App.hockeyClient.Configure("$APIKey here", "1.0.0.0", true, true, true); App.hockeyClient.TrackEvent("Start application from HockeyApp"); //send crashes to the HockeyApp server await App.hockeyClient.SendCrashesAsync(); IsolatedStorageFile isoStore = IsolatedStorageFile.GetStore(IsolatedStorageScope.User | IsolatedStorageScope.Assembly, null, null); var value = isoStore.AvailableFreeSpace; }
public static IHockeyClientConfigurable Configure(this IHockeyClient @this, string identifier, bool keepRunningAfterException) { @this.AsInternal().PlatformHelper = new HockeyPlatformHelperWinForms(); @this.AsInternal().AppIdentifier = identifier; AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; if (keepRunningAfterException) { Application.ThreadException += Current_ThreadException; Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException); } TaskScheduler.UnobservedTaskException += TaskScheduler_UnobservedTaskException; return((IHockeyClientConfigurable)@this); }
/// <summary> /// Configures HockeyClient. /// </summary> /// <param name="this">HockeyClient object.</param> /// <param name="identifier">Identfier.</param> /// <param name="keepRunningAfterException">Keep running after exception.</param> /// <returns>Instance object.</returns> public static IHockeyClientConfigurable Configure(this IHockeyClient @this, string identifier, bool keepRunningAfterException) { @this.AsInternal().PlatformHelper = new HockeyPlatformHelperWinForms(); @this.AsInternal().AppIdentifier = identifier; AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; if (keepRunningAfterException) { Application.ThreadException += Current_ThreadException; Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException); } TelemetryConfiguration.Active.InstrumentationKey = identifier; return((IHockeyClientConfigurable)@this); }
/// <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); }
/// <summary> /// Configures HockeyClient. /// </summary> /// <param name="client">HockeyClient object.</param> /// <param name="identifier">Identfier.</param> /// <param name="keepRunningAfterException">Keep running after exception.</param> /// <returns>Instance object.</returns> public async static Task <IHockeyClientConfigurable> Configure(this IHockeyClient client, string identifier) { client.AsInternal().PlatformHelper = new HockeyPlatformHelperMono(); client.AsInternal().AppIdentifier = identifier; ServiceLocator.AddService <IPlatformService> (new PlatformService()); ServiceLocator.AddService <BaseStorageService> (new StorageService()); ServiceLocator.AddService <IApplicationService> (new ApplicationService()); ServiceLocator.AddService <IDeviceService> (new DeviceService()); ServiceLocator.AddService <IHttpService> (new HttpClientTransmission()); ServiceLocator.AddService <IUnhandledExceptionTelemetryModule> (new UnhandledExceptionTelemetryModule()); await WindowsAppInitializer.InitializeAsync(identifier); return((IHockeyClientConfigurable)client); }
protected override void OnStart() { base.OnStart(); hockeyClient = new HockeyClientDroid(this, this.Application); hockeyClient.Configure("$APPId", "1.0", true, true, true); hockeyClient.TrackEvent("Start application from HockeyApp"); hockeyClient.TrackEvent( "Custom Properties", new Dictionary <string, string> { { "UserName", "Test Username" } }, new Dictionary <string, double> { { "Version", 3.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> /// 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); }
/// <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, Frame rootFrame = null) { @this.AsInternal().PlatformHelper = new HockeyPlatformHelperWP8SL(); @this.AsInternal().AppIdentifier = appId; CrashHandler.Current.Application = Application.Current; CrashHandler.Current.Application.UnhandledException += (sender, args) => { CrashHandler.Current.HandleException(args.ExceptionObject); if (customUnhandledExceptionAction != null) { customUnhandledExceptionAction(args); } }; if (rootFrame != null) { //Idea based on http://www.markermetro.com/2013/01/technical/handling-unhandled-exceptions-with-asyncawait-on-windows-8-and-windows-phone-8/ //catch async void Exceptions AsyncSynchronizationContext.RegisterForFrame(rootFrame, CrashHandler.Current); } return(@this as IHockeyClientConfigurable); }