public static void DIConnect() { if (!DIApplication.Connected) { DIConnection lObjDIConnection = new DIConnection(); lObjDIConnection.ConnectToDI(GetCredentials()); if (lObjDIConnection.Company != null && lObjDIConnection.Company.Connected) { DIApplication.DIConnect(lObjDIConnection.Company); } } }
public static void DIReconnect() { try { if (Company != null) { Company.Disconnect(); MemoryUtility.ReleaseComObject(Company); } } catch (Exception lObjException) { LogUtility.WriteException(lObjException); } DIConnection lObjDIConnection = new DIConnection(); lObjDIConnection.ConnectToDI(GetCredentials()); if (lObjDIConnection.Company != null && lObjDIConnection.Company.Connected) { DIApplication.DIConnect(lObjDIConnection.Company); } }