mirror of
https://github.com/inthehand/32feet.git
synced 2026-10-28 22:54:52 +08:00
35 lines
985 B
C#
35 lines
985 B
C#
using System.Diagnostics;
|
|
using IOBluetooth;
|
|
using IOBluetoothUI;
|
|
|
|
namespace IOBluetoothSample;
|
|
|
|
[Register("AppDelegate")]
|
|
public class AppDelegate : NSApplicationDelegate
|
|
{
|
|
public override void DidFinishLaunching(NSNotification notification)
|
|
{
|
|
var hcontroller = IOBluetooth.HostController.DefaultController;
|
|
|
|
// Insert code here to initialize your application
|
|
foreach (var btdev in IOBluetooth.BluetoothDevice.PairedDevices)
|
|
{
|
|
Debug.WriteLine(btdev.Name);
|
|
}
|
|
|
|
var controller = new IOBluetoothUI.DeviceSelectorController();
|
|
var result = controller.RunModal();
|
|
if (result == (int)ModalResponse.Success)
|
|
{
|
|
NSAlert alert = new NSAlert(){ MessageText = controller.Results[0].Name};
|
|
alert.RunModal();
|
|
}
|
|
|
|
|
|
}
|
|
|
|
public override void WillTerminate(NSNotification notification)
|
|
{
|
|
// Insert code here to tear down your application
|
|
}
|
|
} |