///* Returns true when and only when // * acad.GetAcadState().IsQuiescent // * can be evaluated without throwing the RPC_E_CALL_REJECTED 'Call was rejected by callee.' // * exception AND when it evaluates to True (we catch and discard the RPC_E_CALL_REJECTED exception). // */ public static bool AcadIsAvailableAndQuiescent(IAcadApplication acad) { AcadState currentAcadState; try { currentAcadState = acad.GetAcadState(); return(currentAcadState.IsQuiescent); } catch (System.Runtime.InteropServices.COMException e) { Console.WriteLine("encountered (and dropped) a COMException while attempting to " + "determine whether the acad application object is quiescent: " + e.ToString() ); // System.Runtime.InteropServices.COMException: 'Call was rejected by callee. (Exception from HRESULT: 0x80010001 (RPC_E_CALL_REJECTED))' return(false); } }