/// <summary>
        /// Configures the HockeyAppSDK
        /// </summary>
        /// <param name="appIdentifier">Identifier of the app</param>
        /// <param name="appVersionInformation">optional version of the app. If null the executing assembly version is used</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="apiBase">optional: apiBase - if not the standard is used</param>
        /// <param name="userAgentString">The user agent string.</param>
        /// <param name="keepRunning">optional: if an unhandled exception is thrown on the dispatcher thread, the system can be kept alive - default is false</param>
        /// <exception cref="System.Exception">ApiBase must not be empty!</exception>
        public void Configure(string appIdentifier, 
                            string appVersionInformation = null,
                            string userID = null, 
                            string contactInformation = null,
                            Func<Exception, string> descriptionLoader = null,
                            string apiBase = "https://rink.hockeyapp.net",
                            string userAgentString = null,
                            bool keepRunning = false)
          
        {
            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 });

            string  myAppVersion= string.IsNullOrEmpty(appVersionInformation)?
                Assembly.GetCallingAssembly().GetName().Version.ToString()
                :appVersionInformation;

            HockeyClient.ConfigureInternal(appIdentifier,
                myAppVersion,
                apiBase: apiBase,
                userID: userID,
                contactInformation: contactInformation,
                userAgentName: HockeyConstants.USER_AGENT_STRING,
                sdkName: HockeyConstants.SDKNAME,
                sdkVersion: HockeyConstants.SDKVERSION,
                os: Environment.OSVersion.Platform.ToString(),
                osVersion: Environment.OSVersion.Version.ToString() + Environment.OSVersion.ServicePack);
            this._crashHandler = new CrashHandler(HockeyClient.Current, descriptionLoader, keepRunning);
        }
Esempio n. 2
0
        /// <summary>
        /// Configures the HockeyAppSDK
        /// </summary>
        /// <param name="appIdentifier">Identifier of the app</param>
        /// <param name="appVersionInformation">optional version of the app. If null the executing assembly version is used</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="apiBase">optional: apiBase - if not the standard is used</param>
        /// <param name="userAgentString">The user agent string.</param>
        /// <param name="keepRunning">optional: if an unhandled exception is thrown on the dispatcher thread, the system can be kept alive - default is false</param>
        /// <exception cref="System.Exception">ApiBase must not be empty!</exception>
        public void Configure(string appIdentifier,
                              string appVersionInformation = null,
                              string userID             = null,
                              string contactInformation = null,
                              Func <Exception, string> descriptionLoader = null,
                              string apiBase         = "https://rink.hockeyapp.net",
                              string userAgentString = null,
                              bool keepRunning       = false)

        {
            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 });

            string myAppVersion = string.IsNullOrEmpty(appVersionInformation)?
                                  Assembly.GetCallingAssembly().GetName().Version.ToString()
                :appVersionInformation;

            HockeyClient.ConfigureInternal(appIdentifier,
                                           myAppVersion,
                                           apiBase: apiBase,
                                           userID: userID,
                                           contactInformation: contactInformation,
                                           userAgentName: HockeyConstants.USER_AGENT_STRING,
                                           sdkName: HockeyConstants.SDKNAME,
                                           sdkVersion: HockeyConstants.SDKVERSION,
                                           os: Environment.OSVersion.Platform.ToString(),
                                           osVersion: Environment.OSVersion.Version.ToString() + Environment.OSVersion.ServicePack);
            this._crashHandler = new CrashHandler(HockeyClient.Current, descriptionLoader, keepRunning);
        }
        /// <summary>
        /// Links the synchronization context to the specified frame
        /// and ensures that it is still in use after each navigation event
        /// </summary>
        /// <param name="rootFrame">The root frame.</param>
        /// <param name="handler">The handler.</param>
        /// <returns></returns>
        /// <exception cref="System.ArgumentNullException">rootFrame</exception>
        public static AsyncSynchronizationContext RegisterForFrame(Frame rootFrame, CrashHandler handler)
        {
            if (rootFrame == null)
                throw new ArgumentNullException("rootFrame");

            crashHandler = handler;

            var synchronizationContext = Register();

            rootFrame.Navigating += (sender, args) => EnsureContext(synchronizationContext);
            rootFrame.Loaded += (sender, args) => EnsureContext(synchronizationContext);

            return synchronizationContext;
        }
        /// <summary>
        /// Links the synchronization context to the specified frame
        /// and ensures that it is still in use after each navigation event
        /// </summary>
        /// <param name="rootFrame">The root frame.</param>
        /// <param name="handler">The handler.</param>
        /// <returns></returns>
        /// <exception cref="System.ArgumentNullException">rootFrame</exception>
        public static AsyncSynchronizationContext RegisterForFrame(Frame rootFrame, CrashHandler handler)
        {
            if (rootFrame == null)
            {
                throw new ArgumentNullException("rootFrame");
            }

            crashHandler = handler;

            var synchronizationContext = Register();

            rootFrame.Navigating += (sender, args) => EnsureContext(synchronizationContext);
            rootFrame.Loaded     += (sender, args) => EnsureContext(synchronizationContext);

            return(synchronizationContext);
        }
 static CrashHandler() { _instance = new CrashHandler(); }
Esempio n. 6
0
 static CrashHandler()
 {
     _instance = new CrashHandler();
 }