/// <summary> /// Starts operation processing. /// </summary> /// <param name="owner">Owner POP3 client.</param> /// <returns>Returns true if asynchronous operation in progress or false if operation completed synchronously.</returns> /// <exception cref="ArgumentNullException">Is raised when <b>owner</b> is null reference.</exception> internal bool Start(POP3_Client owner) { if(owner == null){ throw new ArgumentNullException("owner"); } m_pPop3Client = owner; SetState(AsyncOP_State.Active); try{ // Start executing LIST command. POP3_Client.ListAsyncOP listOP = new ListAsyncOP(); listOP.CompletedAsync += delegate(object sender,EventArgs<ListAsyncOP> e){ ListCompleted(listOP); }; if(!m_pPop3Client.ListAsync(listOP)){ ListCompleted(listOP); } } catch(Exception x){ m_pException = x; m_pPop3Client.LogAddException("Exception: " + x.Message,x); SetState(AsyncOP_State.Completed); } // Set flag rise CompletedAsync event flag. The event is raised when async op completes. // If already completed sync, that flag has no effect. lock(m_pLock){ m_RiseCompleted = true; return m_State == AsyncOP_State.Active; } }