private void OnEnd(object sender, MailScanEventArgs e)
        {
            m_traceClient.NotifyFinished();
			lock (this)
			{
				m_state = AuditState.Stopped;
			}
        }
 private void OnError(object sender, MailScanEventArgs e)
 {
     //throw new Exception("The method or operation is not implemented.");
 }
 void m_emailScanner_InitialiseFolder(object sender, MailScanEventArgs e)
 {
     m_traceClient.NotifyInitialScanFolder(e.FolderName);
 }
        private void OnMailItem(object sender, MailScanEventArgs e)
        {
			if (!m_continue)
				return;
			
            //need to notify clients even when we could do nothing with message.
            if (null == e.Uro)
            {
                //Skip the actual call to the audit engine. 
                //Clients need to be able to handle null notifications.
                m_traceClient.NotifyItemAudited(null);
            }
            else if (m_engine != null)
            {
                StringBuilder info = new StringBuilder();
				try
				{
					info.AppendFormat(Properties.Resources.AUDIT_PROCESS, e.Uro.Properties[MailMessagePropertyKeys.Subject]);

					System.Diagnostics.Trace.WriteLine(info.ToString(), "AuditInfo");
					Logging.Trace.WriteLine("Passing a message to the policy engine: \"" + e.Uro.Properties[MailMessagePropertyKeys.Subject] + "\"", "TraceAuditHelper.m_emailScanner_MailItem");

                    IPolicyResponseObject pro = m_engine.ProcessConditions(Workshare.Policy.RunAt.Client, e.Uro);

                    InternalExternalHelper.SetMessageRouting(pro);

					OnAuditMail(new AuditEventArgs(pro));
				}
				catch (Exception ex)
				{
					info.Remove(0, info.Length);
					info.AppendFormat(Properties.Resources.AUDIT_PROCESSEX, e.Uro.Properties[MailMessagePropertyKeys.Subject], ex.Message);
					System.Diagnostics.Trace.WriteLine(info.ToString(), "AuditInfo");
					m_traceClient.NotifyItemAudited(null);
					Logging.Trace.WriteLine(ex.Message, "TraceAuditManager.OnMailItem Exception");
				}
				finally
				{
					e.Dispose();
				}
            }
        }
 /// <summary>
 /// Called when the scanner finds an email for us to audit.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void OnMailItem(object sender, MailScanEventArgs e)
 {
     if (m_emailEngine != null)
     {
         Logging.Trace.WriteLine("Passing a message to the policy engine: \"" + e.MailMessage.Subject + "\"", "TraceAuditHelper.m_emailScanner_MailItem");
         m_emailEngine.Monitor(Workshare.Policy.Interfaces.RunAtMode.Client, e.MailMessage, null);
     }
 }
 private void OnEnd(object sender, MailScanEventArgs e)
 {
     m_traceClient.NotifyFinished();
 }