protected void ThingList_SelectedIndexChanged(object sender, EventArgs e) { IOT.currentID = Convert.ToInt32(ThingList.SelectedValue); Thing thing = ThingDB.GetThing(IOT.currentID); LabelAddress.Text = thing.IPAddress.Trim(); // Example of polymorphism LabelType.Text = thing.GetDisplayText(); }
protected void ButtonPing_Click(object sender, EventArgs e) { LabelResponse.Text = ""; Thing thing = ThingDB.GetThing(IOT.currentID); // Ping class Ping ping = new Ping(); try { PingReply reply = ping.Send(thing.IPAddress.Trim()); LabelResponse.Text = reply.Status.ToString(); } catch (PingException) { } }