Exemple #1
0
        private async void ConnectionButtonClick(object Sender, EventArgs Events)
        {
            Button button = (Button)Sender;

            switch (button.Id)
            {
            case Resource.Id.ConnectButton:
                button.Enabled = false;
                await bluetoothConnection.StartSearchingForArduinoToConnectAsync();

                button.Enabled = true;
                break;

            case Resource.Id.DisconnectButton:
                bluetoothConnection.StopSearchingForDevices();
                break;
            }
        }
Exemple #2
0
        async partial void ConnectionButtonPressed(UIButton sender)
        {
            switch (sender.Tag)
            {
            case 1:
                if (!bluetoothConnection.IsSearching)
                {
                    sender.Enabled = false;
                    await bluetoothConnection.StartSearchingForArduinoToConnectAsync();

                    sender.Enabled = true;
                }
                break;

            case 2:
                if (bluetoothConnection.IsSearching)
                {
                    bluetoothConnection.StopSearchingForDevices();
                }
                break;
            }
        }