Пример #1
0
 public void Create()
 {
     WidcommPortSingleThreader.MiscNoReturnCommand cmd = _st.AddCommand(
         new WidcommPortSingleThreader.MiscNoReturnCommand(delegate {
         _child.Create();
     }));
     cmd.WaitCompletion();
 }
Пример #2
0
        //----
        internal WidcommSppClient(WidcommBluetoothFactoryBase fcty)
        {
            _fcty           = fcty;
            _singleThreader = fcty.GetSingleThreader();
            if (_singleThreader == null)
            {
                throw new InvalidOperationException("Internal Error: No GetSingleThreader");
            }
            _handleClientStateChange = HandleClientStateChange;
            bool success = false;

            try {
                _singleThreader.AddCommand(new WidcommPortSingleThreader.MiscNoReturnCommand(
                                               () => NativeMethods.SppClient_Create(out _pSppCli, _handleClientStateChange)
                                               )).WaitCompletion();
                if (_pSppCli == IntPtr.Zero)
                {
                    throw new InvalidOperationException("Failed to initialise CSppClient.");
                }
                success = true;
            } finally {
                if (!success)
                {
                    Debug.Assert(_pSppCli == IntPtr.Zero, "but failed!");
                }
            }
        }
Пример #3
0
 //----
 #region SingleThread Actions
 private T AddCommand <T>(T cmd)
     where T : WidcommPortSingleThreader.StCommand
 {
     return(_singleThreader.AddCommand(cmd));
 }