Example #1
0
        /// <summary>
        /// Dispatch an KCD event and update the state as needed.
        /// </summary>
        private void DispatchKcdEvent(AnpMsg msg)
        {
            // Dispatch the event to the appropriate handler.
            KwsAnpEventStatus newStatus = DispatchAnpEventToHandler(msg);

            // For quenching purposes we assume the event was processed.
            WmSm.HandleKcdEventProcessed();

            // If the ANP event has been processed, update its entry in the
            // database and the catch up state as required.
            if (newStatus == KwsAnpEventStatus.Processed)
            {
                if (msg.ID > 0)
                {
                    Debug.Assert(m_ks.NbUnprocessedEvent > 0);
                    m_kws.UpdateKAnpEventStatusInDb(msg.ID, KwsAnpEventStatus.Processed);
                    m_ks.NbUnprocessedEvent--;
                    UpdateKcdEventUpToDateState();
                    m_kws.OnStateChange(WmStateChange.Permanent);
                }
            }
        }