コード例 #1
0
        /// <summary>
        /// Specifies a common dialog box.
        /// </summary>
        /// <param name="hwndOwner">A value that represents the window handle of the owner window for the common dialog box.</param>
        /// <returns>true if the dialog box was successfully run; otherwise, false.</returns>
        protected override bool RunDialog(IntPtr hwndOwner)
        {
            AssertWindowsFormsThread();
            if (this._ShowDiscoverableOnly) {
                // ShowDiscoverableOnly is not supported by the Microsoft stack on desktop Windows.
                return false;
            }
            //
            if ((object)dialogWin32 != (object)dialog) {
                dialogWin32 = (BLUETOOTH_SELECT_DEVICE_PARAMS)dialog;
            }
            //set parent window
            dialogWin32.hwndParent = hwndOwner;

            //set class of device filters
            dialogWin32.SetClassOfDevices(ClassOfDevices.ToArray());

            bool success = NativeMethods.BluetoothSelectDevices(ref dialogWin32);

            if (success) {
                if (dialogWin32.cNumDevices > 0) {
                    device = new BluetoothDeviceInfo(new WindowsBluetoothDeviceInfo(dialogWin32.Device));
                }

                bool freed = NativeMethods.BluetoothSelectDevicesFree(ref dialogWin32);
            }

            return success;
        }
コード例 #2
0
        internal SelectBluetoothDeviceDialog(bool forceCustomDialog)
        {
#if NETCF
            InTheHand.Net.PlatformVerification.ThrowException();
#endif
#if !WinXP
            // Always the custom dialog on WM/CE.
            forceCustomDialog = true;
            _msftFilterProxy  = null;
#endif
            BluetoothRadio radio;
            if (forceCustomDialog || (radio = BluetoothRadio.PrimaryRadio) != null && radio.SoftwareManufacturer != Manufacturer.Microsoft)
            {
                dialogCustom = new SelectBluetoothDeviceForm();
                dialog       = dialogCustom;
            }
            else
            {
#if WinXP
                _msftFilterProxy = MsftFilterProxy;
                dialogWin32      = new BLUETOOTH_SELECT_DEVICE_PARAMS();
                dialogWin32.Reset();
                dialog = dialogWin32;
#else
                Debug.Fail("Should use custom dialog on non-Win32!");
#endif
            }

            ClassOfDevices = new System.Collections.Generic.List <ClassOfDevice>();
        }
コード例 #3
0
        internal SelectBluetoothDeviceDialog(bool forceCustomDialog)
        {

#if WinXP
                _msftFilterProxy = MsftFilterProxy;
                dialogWin32 = new BLUETOOTH_SELECT_DEVICE_PARAMS();
                dialogWin32.Reset();
                dialog = dialogWin32;
#else
                Debug.Fail("Should use custom dialog on non-Win32!");
#endif

            ClassOfDevices = new System.Collections.Generic.List<ClassOfDevice>();
        }
コード例 #4
0
ファイル: NativeMethods.cs プロジェクト: jehy/32feet.NET
 internal static extern bool BluetoothSelectDevicesFree(ref BLUETOOTH_SELECT_DEVICE_PARAMS pbtsdp);