Exemplo n.º 1
0
        void Connect_ConnCallback(IAsyncResult ar)
        {
            BeginConnectState   bsState      = (BeginConnectState)ar.AsyncState;
            AsyncResultNoResult arCliConnect = bsState.arCliConnect;

            try {
                ConnEndConnect(ar);
                Connect_SetAsCompleted_CompletedSyncFalse(arCliConnect, null);
            } catch (Exception ex) {
                Connect_SetAsCompleted_CompletedSyncFalse(arCliConnect, ex);
            }
        }
Exemplo n.º 2
0
        void Connect_FillInPortCallback(IAsyncResult ar)
        {
            BeginConnectState   bcState   = (BeginConnectState)ar.AsyncState;
            AsyncResultNoResult arConnect = bcState.arCliConnect;

            try {
                BluetoothEndPoint remoteEpWithPort = EndFillInPort(ar);
                if (arConnect.IsCompleted)
                {
                    // User called Close/Dispose when we were in (slow!) SDP lookup.
                    Debug.Assert(m_disposed, "arConnect.IsCompleted but NOT m_cancelled");
                    return;
                }
                _remotePort = remoteEpWithPort.Port;
                Debug.Assert(_remotePort != -1 && _remotePort != 0, "port is 'empty' is: " + _remotePort);
                ConnBeginConnect(remoteEpWithPort, Connect_ConnCallback, bcState);
            } catch (Exception ex) {
                Connect_SetAsCompleted_CompletedSyncFalse(arConnect, ex);
            }
        }