Ejemplo n.º 1
0
        internal IAsyncResult BeginStartUp(AsyncCallback userCallback, object state)
        {
            StartUpAsyncResult ar = new StartUpAsyncResult(this, userCallback, state);

            bool firstTime = false;

            lock (_syncRoot)
            {
                if (_state == MusicOnHoldServerState.Created)
                {
                    firstTime = true;
                    this.UpdateState(MusicOnHoldServerState.Starting);
                }
                else
                {
                    throw new InvalidOperationException("AcdMusicOnHoldServer instance is an invalid state.");
                }
            }

            if (firstTime)
            {
                ThreadPool.QueueUserWorkItem((waitState) =>
                {
                    var tempAr = waitState as StartUpAsyncResult;
                    tempAr.Process();
                }, ar);
            }
            return(ar);
        }
Ejemplo n.º 2
0
        internal IAsyncResult BeginStartUp(AsyncCallback userCallback, object state)
        {
            StartUpAsyncResult ar = new StartUpAsyncResult(String.Empty, userCallback, state, this);

            bool firstTime = false;

            lock (_syncRoot)
            {
                if (_state == ConferenceServicesAnchorState.Idle)
                {
                    this.UpdateState(ConferenceServicesAnchorState.Establishing);
                    firstTime = true;
                }
                else
                {
                    throw new InvalidOperationException("AcdConferenceServicesAnchor: anchor instance already started");
                }
            }

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

            return(ar);
        }
Ejemplo n.º 3
0
        internal void EndStartUp(IAsyncResult ar)
        {
            StartUpAsyncResult result = ar as StartUpAsyncResult;

            result.EndInvoke();
        }