in Hands-on lab/lab-files/starter-project/SmartMeterSimulator/MainForm.cs [87:107]
private void InstallDevice(object sender, EventArgs e)
{
//Clicking on a button window represents installing the device locally
//by marrying the device to its matching Transmit Status Window
//Get the button control which is the container for this device
Button button = (Button)sender;
//Set matching Transmit Status Window name, this window shows
//when a device is transmitting temperature data to IoT Hubs
string statusId = "Status" + button.Name.Last();
var sensor = new Sensor(button.Name);
button.Tag = sensor;
//Install the device
sensor.InstallDevice(statusId);
//Change the color to Yellow to indicate the device has been installed
button.BackColor = Color.Yellow;
button.Click -= InstallDevice;
}