Esempio n. 1
0
        /// <summary>
        /// Configures the HockeyAppSDK
        /// </summary>
        /// <param name="appIdentifier">Identifier of the app</param>
        /// <param name="appVersionInformation">version of the app</param>
        /// <param name="userID">optional user id - e.g. the logged in user</param>
        /// <param name="contactInformation">optional contact information like an email adress</param>
        /// <param name="descriptionLoader">optional delegate for attaching description information like event logs etc. Can be null.</param>
        /// <param name="rootFrame">optional: rootFrame - if the rootframe is provided async void exception handling is improved</param>
        public void Configure(string appIdentifier,
                              string appVersionInformation,
                              string userID             = null,
                              string contactInformation = null,
                              Func <Exception, string> descriptionLoader = null,
                              string apiBase  = "https://rink.hockeyapp.net/api/2/",
                              Frame rootFrame = null)
        {
            if (String.IsNullOrWhiteSpace(apiBase))
            {
                throw new Exception("ApiBase must not be empty!");
            }

            logger.Info("Configure HockeyClientWPF with appIdentifier={0}, userID={1}, contactInformation={2}, descriptionLoader available{3}, sendCrashesAutomatically={4}, apiBase={5}",
                        new object[] { appIdentifier, userID, contactInformation, (descriptionLoader != null).ToString(), apiBase });

            HockeyClient.ConfigureInternal(appIdentifier,
                                           appVersionInformation,
                                           apiBase: apiBase,
                                           userID: userID,
                                           contactInformation: contactInformation,
                                           userAgentName: "",
                                           sdkName: Constants.SDKNAME,
                                           sdkVersion: Constants.SDKVERSION);

            this._crashHandler = new CrashHandler(HockeyClient.Instance, descriptionLoader);

            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/
                AsyncSynchronizationContext.RegisterForFrame(rootFrame, this._crashHandler);
            }
        }
Esempio n. 2
0
        public void Configure(Application application,
                              string identifier,
                              Frame rootFrame = null,
                              Func <Exception, string> descriptionLoader = null,
                              string apiBase            = null,
                              string userId             = null,
                              string contactInformation = null)
        {
            if (this._application == null)
            {
                this._crashLogInfo = new CrashLogInformation()
                {
                    PackageName  = application.GetType().Namespace,
                    ProductID    = ManifestHelper.GetProductID(),
                    Version      = ManifestHelper.GetAppVersion(),
                    WindowsPhone = Environment.OSVersion.Version.ToString(),
                    Manufacturer = GetDeviceManufacturer(),
                    Model        = GetDeviceModel()
                };


                this._application = application;
                this._application.UnhandledException += OnUnhandledException;
                HockeyClient.ConfigureInternal(identifier,
                                               ManifestHelper.GetAppVersion(),
                                               userID: userId,
                                               apiBase: apiBase,
                                               contactInformation: contactInformation,
                                               userAgentName: Constants.UserAgentString,
                                               sdkName: Constants.SdkName,
                                               sdkVersion: Constants.SdkVersion,
                                               descriptionLoader: descriptionLoader,
                                               os: Environment.OSVersion.Platform.ToString(),
                                               osVersion: Environment.OSVersion.Version.ToString(),
                                               device: GetDeviceModel(),
                                               oem: GetDeviceManufacturer());
                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/
                    AsyncSynchronizationContext.RegisterForFrame(rootFrame, this);
                }
            }
            else
            {
                throw new InvalidOperationException("CrashHandler was already configured!");
            }
        }
Esempio n. 3
0
 public void Configure(Application application, string identifier, Frame rootFrame = null, Func <Exception, string> descriptionLoader = null)
 {
     if (this.application == null)
     {
         this.application       = application;
         this.identifier        = identifier;
         this.descriptionLoader = descriptionLoader;
         this.application.UnhandledException += OnUnhandledException;
         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/
             AsyncSynchronizationContext.RegisterForFrame(rootFrame, this);
         }
     }
     else
     {
         throw new InvalidOperationException("CrashHandler was already configured!");
     }
 }
Esempio 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, 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);
        }