Example #1
0
        void Lock_End(object state, bool timedout)
        {
            Reset_SO stateObj = (Reset_SO)state;

            try
            {
                stateObj.UpdateContext();
                if (timedout)
                {
                    string msg = string.Format("Unable to lock CC within {0} time: ", stateObj.Timeout);
                    NSTrace.WriteLineError(msg + Environment.StackTrace);
                    stateObj.Exception = GetTimeoutException(stateObj.Timeout);
                    stateObj.SetCompleted();
                }
                else
                {
                    try
                    {
                        Cmd_RunDTP curDTP = _client.CurrentDTP;
                        if (null != curDTP)
                        {
                            curDTP.Reset();
                        }
                    }
                    finally
                    {
                        _cc.Unlock();
                    }

                    //----------------------------------------
                    //Wait till DTP finishes
                    _client.BeginWaitForDTPFinished(stateObj.Timeout,
                                                    new WaitOrTimerCallback(DTPFinishedWait_End),
                                                    stateObj);
                }
            }
            catch (Exception e)
            {
                stateObj.Exception = e;
                stateObj.SetCompleted();
            }
        }