Ejemplo n.º 1
0
 /// <summary>
 /// Start the Outlook thread if required.
 /// </summary>
 private void StartThreadIfNeeded()
 {
     if (!m_enabledFlag || m_sessionStatus != OutlookSessionStatus.Stopped) return;
     m_sessionStatus = OutlookSessionStatus.Listening;
     Debug.Assert(m_thread == null);
     m_thread = new WmOutlookThread(this);
     m_thread.Start();
 }
Ejemplo n.º 2
0
 public WmOutlookThreadMsg(WmOutlookThread thread, UInt64 sessionID, AnpMsg msg)
 {
     m_thread = thread;
     SessionID = sessionID;
     Msg = msg;
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Called when the Outlook thread has completed. 'ex' is null if the 
        /// thread has been cancelled, otherwise it contains the reason why the
        /// thread has stopped.
        /// </summary>
        public void OnThreadCompletion(Exception ex)
        {
            Debug.Assert(m_thread != null);

            // The Outlook thread is not allowed to fail.
            if (ex != null) Base.HandleException(ex, true);

            // The thread has stopped.
            Debug.Assert(m_sessionStatus == OutlookSessionStatus.Stopping);
            m_sessionStatus = OutlookSessionStatus.Stopped;
            m_thread = null;

            // Notify the listeners.
            if (OnThreadCollected != null) OnThreadCollected(this, null);

            // Restart the thread if the broker is enabled.
            StartThreadIfNeeded();
        }