예제 #1
0
        /// <summary>
        /// Initiates the Acd portal start up operation
        /// </summary>
        internal IAsyncResult BeginStartUp(AsyncCallback userCallback, object state)
        {
            StartupAsyncResult asyncResult = new StartupAsyncResult(userCallback, state, this);

            bool firstTime = false;

            lock (_syncRoot)
            {
                if (_portalState == PortalState.Created)
                {
                    this.UpdatePortalState(PortalState.Starting);
                    _matchMaker  = this.Platform.MatchMaker;
                    _agentHunter = new AcdAgentHunter(this, _matchMaker, _logger);
                    firstTime    = true;
                }
                else
                {
                    throw new InvalidOperationException("AcdPortal is already being started");
                }
            }

            if (firstTime)
            {
                ThreadPool.QueueUserWorkItem((waitState) =>
                {
                    var tempAr = waitState as StartupAsyncResult;
                    tempAr.Process();
                }, asyncResult);
            }

            return(asyncResult);
        }
예제 #2
0
        public IAsyncResult BeginStartUp(string ConfigXMLFile, AsyncCallback userCallback, object state)
        {
            var asyncResult = new StartupAsyncResult(userCallback, state, ConfigXMLFile, this);

            lock (_syncRoot)
            {
                if (_acdPlatformState == AcdPlatformState.Created)
                {
                    this.UpdateAcdPlatformState(AcdPlatformState.Starting);
                    ThreadPool.QueueUserWorkItem((waitState) =>
                    {
                        var tempAr = waitState as StartupAsyncResult;
                        tempAr.Process();
                    }, asyncResult);
                }
                else
                {
                    throw new InvalidOperationException("AcdPlatform has already been started");
                }
            }

            return(asyncResult);
        }
예제 #3
0
        /// <summary>
        /// BeginStartup is the entry point to start the AcdAgentMatchMaker.
        /// The AcdAgentMatchMaker will start subscribing to the Presence of Agents
        /// </summary>
        internal IAsyncResult BeginStartup(AsyncCallback callback, object state)
        {
            StartupAsyncResult asyncResult = new StartupAsyncResult(callback, state, this);

            lock (_syncRoot)
            {
                if (_matchMakerState == MatchMakerState.Created)
                {
                    this.UpdateState(MatchMakerState.Starting);
                    ThreadPool.QueueUserWorkItem((waitState) =>
                    {
                        var tempAr = waitState as StartupAsyncResult;
                        tempAr.Process();
                    }, asyncResult);
                }
                else
                {
                    throw new InvalidOperationException("AcdAgentMatchMaker has already been started");
                }
            }

            return(asyncResult);
        }
예제 #4
0
        internal void EndStartup(IAsyncResult result)
        {
            StartupAsyncResult asyncResult = result as StartupAsyncResult;

            asyncResult.EndInvoke();
        }