Exemplo n.º 1
0
        /// <summary>
        /// Clear the current event log. Remove all events contained in the active event log.
        /// </summary>
        /// <exception cref="CommunicationException">Thrown if the error code returned from the call to the PTUDLL32.ClearEvent() method is not
        /// CommunicationError.Success.</exception>
        public void ClearEvent()
        {
            // Check that the function delegate has been initialized.
            Debug.Assert(m_ClearEvent != null, "CommunicationEvent.ClearEvent() - [m_ClearEvent != null]");
            Debug.Assert(m_MutexCommuncationInterface != null, "CommunicationEvent.ClearEvent() - [m_MutexCommuncationInterface != null]");

            CommunicationError errorCode = CommunicationError.UnknownError;
            try
            {
                m_MutexCommuncationInterface.WaitOne(DefaultMutexWaitDurationMs, false);
                errorCode = (CommunicationError)m_ClearEvent();
            }
            catch (Exception)
            {
                errorCode = CommunicationError.SystemException;
                throw new CommunicationException("CommunicationEvent.ClearEvent()", errorCode);
            }
            finally
            {
                m_MutexCommuncationInterface.ReleaseMutex();
            }

            if (DebugMode.Enabled == true)
            {
                DebugMode.ClearEvent_t clearEvent = new DebugMode.ClearEvent_t(errorCode);
                DebugMode.Write(clearEvent.ToXML());
            }

            if (errorCode != CommunicationError.Success)
            {
                throw new CommunicationException("CommunicationEvent.ClearEvent()", errorCode);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Clear the current event log. Remove all events contained in the active event log.
        /// </summary>
        /// <exception cref="CommunicationException">Thrown if the error code returned from the call to the PTUDLL32.ClearEvent() method is not
        /// CommunicationError.Success.</exception>
        public void ClearEvent()
        {
            Debug.Assert(m_MutexCommuncationInterface != null, "CommunicationEvent.ClearEvent() - [m_MutexCommuncationInterface != null]");

            CommunicationError errorCode = CommunicationError.UnknownError;
            try
            {
                m_MutexCommuncationInterface.WaitOne(DefaultMutexWaitDurationMs, false);
                errorCode = m_EventStreamMarshal.ClearEvent();
            }
            catch (Exception)
            {
                errorCode = CommunicationError.SystemException;
                throw new CommunicationException("CommunicationEvent.ClearEvent()", errorCode);
            }
            finally
            {
                m_MutexCommuncationInterface.ReleaseMutex();
            }

            if (DebugMode.Enabled == true)
            {
                DebugMode.ClearEvent_t clearEvent = new DebugMode.ClearEvent_t(errorCode);
                DebugMode.Write(clearEvent.ToXML());
            }

            if (errorCode != CommunicationError.Success)
            {
                throw new CommunicationException("CommunicationEvent.ClearEvent()", errorCode);
            }
        }