コード例 #1
0
        void Lock_End(object state, bool timedout)
        {
            Abort_SO stateObj = (Abort_SO)state;

            try
            {
                stateObj.UpdateContext();
                //----------------------------------------
                //Indicate that we lock CC
                stateObj.CCLocked = true;

                if (null != _client.CurrentDTP)
                {
                    //----------------------------------------
                    //In case when we have active DTP we delegate
                    //handling responses to it and here only send
                    //abort command
                    _cc.BeginSendCommand(stateObj.Timeout,
                                         "ABOR",
                                         new AsyncCallback(SendCmd_End),
                                         stateObj);
                }
                else
                {
                    //----------------------------------------
                    //In case there is no DTP, but user wants
                    //issue abort command we should dealing with
                    //responses here ...
                    _cc.BeginSendCommandEx(stateObj.Timeout,
                                           "ABOR",
                                           new AsyncCallback(SendCmdEx_End),
                                           stateObj);
                }
            }
            catch (Exception e)
            {
                stateObj.Exception = e;
                stateObj.SetCompleted();
            }
        }