public void Dispose() { // This API is a share resources. A number of users may be getting labels from the same instance. // All Document requests are closed by the caller, so we let the caller with the last Document kill the API process. try { if (CodeSoftApi != null) { if (CodeSoftApi.Documents != null && CodeSoftApi.Documents.Count() == 0) { //CodeSoftApi.Documents.CloseAll(false); _NetApp.Quit(); _NetApp = null; } } } catch (Exception err) { /* External process. Not much control over this */ log4net.LogManager.GetLogger("ERROR").Error(new Exception("CodeSoft API dispose faile :" + err.Message)); } }
/// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (_csDoc != null) { _csDoc.Close(false); _csDoc.Dispose(); } if (_csApp != null) { _csApp.Quit(); } if (Business.Context != null) { Business.Context.Dispose(); } if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); }