void Quit_End(IAsyncResult ar) { Disconnect_SO stateObj = (Disconnect_SO)ar.AsyncState; try { stateObj.UpdateContext(); _cmdQuit.EndExecute(ar); } catch (Exception e) { stateObj.Exception = e; } stateObj.SetCompleted(); }
internal IAsyncResult BeginExecute(int timeout, AsyncCallback cb, object state) { Disconnect_SO stateObj = new Disconnect_SO(timeout, cb, state); _asyncResult = stateObj; try { _cmdReset.BeginExecute(timeout, new AsyncCallback(Reset_End), stateObj); } catch { stateObj.SetCompleted(); throw; } return(stateObj); }
void Reset_End(IAsyncResult ar) { Disconnect_SO stateObj = (Disconnect_SO)ar.AsyncState; try { stateObj.UpdateContext(); _cmdReset.EndExecute(ar); _cmdQuit.BeginExecute(stateObj.Timeout, new AsyncCallback(Quit_End), stateObj); } catch (Exception e) { stateObj.Exception = e; stateObj.SetCompleted(); } }