/// <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); } }
/// <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: Constants.USER_AGENT_STRING, sdkName: Constants.SDKNAME, sdkVersion: Constants.SDKVERSION, os: Environment.OSVersion.Platform.ToString(), osVersion: Environment.OSVersion.Version.ToString() + Environment.OSVersion.ServicePack); this._crashHandler = new CrashHandler(HockeyClient.Instance, descriptionLoader, keepRunning); }
/// <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: Constants.USER_AGENT_STRING, sdkName: Constants.SDKNAME, sdkVersion: Constants.SDKVERSION, os: Environment.OSVersion.Platform.ToString(), osVersion: Environment.OSVersion.Version.ToString() + Environment.OSVersion.ServicePack); this._crashHandler = new CrashHandler(HockeyClient.Instance, descriptionLoader, keepRunning); }
/// <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="apiBase">optional: apiBase - if not the standard is used</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", string userAgentString = 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); }
/// <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="apiBase">optional: apiBase - if not the standard is used</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", string userAgentString = 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); }
/// <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); } }
/// <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"></param> /// <returns></returns> 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(); }