}//HubEventHandler()

        //
        //
        //
        // *************************************************************************
        // ***                      Process Request                             ****
        // *************************************************************************
        /// <summary>
        /// These are request for fill hub resources.  Some can not be completed yet, and these
        /// will be stored in a Queue for retrying later.
        /// </summary>
        private void ProcessAuditTrailEvent(AuditTrailEventArgs eventArg)
        {
            if (eventArg == null)
            {
                return;
            }

            if (eventArg.auditTrailEventType == AuditTrailEventType.LoadAuditTrailFills)
            {
                if (m_Listener != null)
                {
                    // It does not need the TT to start fill listening.
                    m_IsInitializingBooks = false;
                    Log.NewEntry(LogLevel.Minor, "Connected to audit trail file.");
                    m_Listener.Filled += new EventHandler(HubEventEnqueue);
                    AuditTrailPlayer  auditTrailReader  = (AuditTrailPlayer)eventArg.Data[0];
                    AuditTrailFillHub auditTrailFillHub = (AuditTrailFillHub)eventArg.Data[1];
                    DateTime          auditTrailReadingStartDateTime = (DateTime)eventArg.Data[2];
                    DateTime          auditTrailPlayingEndDateTime   = (DateTime)eventArg.Data[3];
                    LogHub            log = (LogHub)eventArg.Data[4];
                    m_Listener.Log = log;

                    // Get the variables from GUI thread to load audit trail fills and update initial state of fill hub.
                    if (auditTrailReader.TryReadAuditTrailFills(auditTrailReadingStartDateTime, auditTrailPlayingEndDateTime, auditTrailFillHub))
                    {
                        m_NeededCheckKeys.Clear();
                        m_NeededCheckKeys.AddRange(auditTrailReader.m_NeededBookInstrumentList);
                        Log.NewEntry(LogLevel.Minor, "Successfully load fills from audit trail file.");
                    }
                    else
                    {
                        Log.NewEntry(LogLevel.Major, "Failed to load fills from audit trail file.");
                        return;
                    }
                }
            }
            else if (eventArg.auditTrailEventType == AuditTrailEventType.PlayAuditTrailFills)
            {
                AuditTrailPlayer  auditTrailReader  = (AuditTrailPlayer)eventArg.Data[0];
                AuditTrailFillHub auditTrailFillHub = (AuditTrailFillHub)eventArg.Data[1];
                DateTime          auditTrailReadingStartDateTime = (DateTime)eventArg.Data[2];
                DateTime          auditTrailPlayingEndDateTime   = (DateTime)eventArg.Data[3];
                LogHub            log = (LogHub)eventArg.Data[4];

                // Get the variables from GUI thread to play the audit trail fills.
                if (auditTrailReader.TryPlayAuditTrailFillsForFillHub(auditTrailFillHub, auditTrailReadingStartDateTime, auditTrailPlayingEndDateTime, out auditTrailFillHub))
                {
                    Log.NewEntry(LogLevel.Minor, "Successful in playing the audit trail file.");
                }
                else
                {
                    Log.NewEntry(LogLevel.Major, "Failed to play the audit trail file.");
                    return;
                }
            }
        }// ProcessRequest()
        }//buttonLoadDropFile_Click()

        /// <summary>
        /// This method will load all the fills from audit trail files and potentially create books that are not in the drop files.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonLoadAuditTrailFills_Click(object sender, EventArgs e)
        {
            if (sender == this.buttonLoadAuditTrailFills)
            {
                // Load fills from the audit trail and prepare books.
                Log.NewEntry(LogLevel.Minor, "The button of load audit trail fills is clicked by user.");

                DateTime minDateTime = new DateTime(2000, 1, 1);
                if (m_UserSelectedRecoveryDropFileDateTime > minDateTime)
                {
                    // Check whether the end date time is larger than the start date time.
                    if (m_UserSelectedPlayerEndDateTime < m_UserSelectedRecoveryDropFileDateTime)
                    {
                        Log.NewEntry(LogLevel.Major, "The end player date time is smaller than the start recovery date time.");
                        return;
                    }

                    // Start the listener in this fill hub.
                    m_AuditTrailPlayer = new AuditTrailPlayer(m_AuditTrailFilePath, m_UserName, m_FillHubOrFillManagerName, Log);
                    AuditTrailEventArgs fillHubRequest = new AuditTrailEventArgs();
                    fillHubRequest.auditTrailEventType = AuditTrailEventType.LoadAuditTrailFills;
                    fillHubRequest.Data    = new object[5];
                    fillHubRequest.Data[0] = m_AuditTrailPlayer;
                    fillHubRequest.Data[1] = m_AuditTrailFillHub;
                    fillHubRequest.Data[2] = m_UserSelectedRecoveryDropFileDateTime;
                    fillHubRequest.Data[3] = m_UserSelectedPlayerEndDateTime;
                    fillHubRequest.Data[4] = Log;
                    m_AuditTrailFillHub.HubEventEnqueue(fillHubRequest);
                }
                else
                {
                    Log.NewEntry(LogLevel.Major, "The user does not give a start recovery date time. The date time in the code is now {0}.", m_UserSelectedRecoveryDropFileDateTime);
                    return;
                }
            }
        }//buttonLoadAuditTrailFills_Click()
        }//TTAPIService_ServiceStateChanged()

        /// <summary>
        /// Start all the processes automatically to recover the positions for user.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonRecover_Click(object sender, EventArgs e)
        {
            if (sender == buttonRecover)
            {
                Log.NewEntry(LogLevel.Minor, "The button of recovering positions is clicked by user.");
                DateTime minDateTime = new DateTime(2000, 1, 1);
                if (m_UserSelectedRecoveryDropFileDateTime <= minDateTime)
                {
                    Log.NewEntry(LogLevel.Major, "The user does not give a start recovery date time. The date time in the code is now {0}.", m_UserSelectedRecoveryDropFileDateTime);
                    return;
                }
                else
                {
                    Log.NewEntry(LogLevel.Minor, "The user has chosen a drop file recovery date time of {0}.", m_UserSelectedRecoveryDropFileDateTime);

                    // Check if the user name or fill hub name is empty or null.
                    m_UserName = textBoxUserName.Text;
                    m_FillHubOrFillManagerName = textBoxFillHubName.Text;
                    if (string.IsNullOrEmpty(m_UserName) || string.IsNullOrEmpty(m_FillHubOrFillManagerName))
                    {
                        Log.NewEntry(LogLevel.Major, "There are no user name or fill hub name.");
                        return;
                    }

                    // Clear the previous audit trail fill hub.
                    if (m_AuditTrailFillHub != null)
                    {
                        m_AuditTrailFillHub.RequestStop();
                    }

                    if (m_DropFilePlayer.TryPlayDropFileForOneFillHub(m_UserName, m_FillHubOrFillManagerName, m_UserSelectedRecoveryDropFileDateTime, out m_AuditTrailFillHub))
                    {
                        // Create the books on the fill hub page and start.
                        m_UserSelectedRecoveryDropFileDateTime = m_DropFilePlayer.SelectedDropDateTime;
                        DropFileStartDateTime.Value            = m_UserSelectedRecoveryDropFileDateTime;
                        m_AuditTrailFillHub.Start();

                        // Try to get the final state of the fill hub.
                        if (m_FillHubPage != null)
                        {
                            m_FillHubPage.Shutdown();
                        }
                        m_FillHubPage = new FillHubPage();
                        m_FillHubPage.AddHub(m_AuditTrailFillHub);

                        // Display the fill hub page onto the GUI.
                        tabControlFillPageViewer.TabPages.Clear();
                        tabControlFillPageViewer.TabPages.Add(m_FillHubPage);
                        m_AuditTrailFillHub.CreateBooksStatic(m_MarketTTAPIService);
                        Log.NewEntry(LogLevel.Minor, "Successful in reading the drop file.");
                    }
                    else
                    {
                        Log.NewEntry(LogLevel.Major, "Failed to read the drop file.");
                        return;
                    }

                    //// Load fills from the audit trail and prepare books.
                    // Check whether the end date time is larger than the start date time.
                    if (m_UserSelectedPlayerEndDateTime < m_UserSelectedRecoveryDropFileDateTime)
                    {
                        Log.NewEntry(LogLevel.Major, "The end player date time is smaller than the start recovery date time.");
                        return;
                    }

                    // Start the listener in this fill hub.
                    m_AuditTrailPlayer = new AuditTrailPlayer(m_AuditTrailFilePath, m_UserName, m_FillHubOrFillManagerName, Log);
                    AuditTrailEventArgs fillHubRequestLoad = new AuditTrailEventArgs();
                    fillHubRequestLoad.auditTrailEventType = AuditTrailEventType.LoadAuditTrailFills;
                    fillHubRequestLoad.Data           = new object[5];
                    fillHubRequestLoad.Data[0]        = m_AuditTrailPlayer;
                    fillHubRequestLoad.Data[1]        = m_AuditTrailFillHub;
                    fillHubRequestLoad.Data[2]        = m_UserSelectedRecoveryDropFileDateTime;
                    fillHubRequestLoad.Data[3]        = m_UserSelectedPlayerEndDateTime;
                    fillHubRequestLoad.Data[4]        = Log;
                    m_AuditTrailFillHub.BooksCreated += new EventHandler(WaitBooksCreated);
                    m_AuditTrailFillHub.HubEventEnqueue(fillHubRequestLoad);
                } //DateTime_Check()
            }
        }         //buttonRecover_Click()