public async void ExecuteDigitalWrite_Click(object sender, EventArgs e) { OperationsPanel.Enabled = false; CredentialsPanel.Enabled = false; Response.Text = "Waiting for response.."; Status.Text = "Executing.."; Bolt myBolt = new Bolt(ApiKey.Text.Trim(), DeviceId.Text.Trim()); string state = DigitalWriteStateSel.SelectedIndex == 0 ? DigitalStates.Low : DigitalStates.High; string pin = ""; switch (DigitalWritePinSel.SelectedIndex) { case 0: pin = DigitalPins.D0; break; case 1: pin = DigitalPins.D1; break; case 2: pin = DigitalPins.D2; break; case 3: pin = DigitalPins.D3; break; case 4: pin = DigitalPins.D4; break; } RequestURL.Text = BuildRequestUrl("digitalWrite", new List <string> { "pin", "state" }, new List <string> { pin, state }); Response response = await myBolt.DigitalWrite(pin, state); Response.Text = response.ResponseString; Status.Text = "Ready"; OperationsPanel.Enabled = true; CredentialsPanel.Enabled = true; }