/// <summary> /// The ClientError Event Handler /// </summary> public virtual void OnClientError(ClientErrorEventArgs e) { try { CFXManagerClient.AbortClient(); } catch { ; } if (ClientError != null) { ClientError(m_lock_object, e); } }
/// <summary> ///Close the client. Must be called by the consumer application prior to exiting to ensure that the client ///unregisters from the service, and that all client related resources are freed. Failure to call this ///method will at the very least prevent any future client connections from being established with the API ///service during the current CFX Manager session. /// ///Wraps CFXManagerClient:CloseClient() in the local exception handling framework /// </summary> public void CloseClient() { lock (m_lock_object) { try { if (CFXManagerClient.IsConnected()) { Unregister(); } CFXManagerClient.AbortClient(); } catch (Exception ex) { OnClientError(new ClientErrorEventArgs(new ErrorRecord(ex, System.Reflection.MethodBase.GetCurrentMethod().Name))); } } }