//Draw sensor public void DrawSensor(string mac) { try { Database myDatabase = new Database(); Bitmap icon_true; Bitmap icon_false; #if ACTOR_BAOCHAY int pixel_x = Convert.ToInt32(myDatabase.getSensorBCPixel_x(mac)); int pixel_y = Convert.ToInt32(myDatabase.getSensorBCPixel_y(mac)); string status = myDatabase.getStatusSensorBC(mac); #else int pixel_x = Convert.ToInt32(myDatabase.getSensorPixel_x(mac)); int pixel_y = Convert.ToInt32(myDatabase.getSensorPixel_y(mac)); string status = myDatabase.getStatusSensor(mac); #endif icon_true = new Bitmap(path_icon_sensor_true); icon_false = new Bitmap(path_icon_sensor_false); if (status == "true" || status == "True") { gr.DrawImage(icon_true, pixel_x, pixel_y); } else { gr.DrawImage(icon_false, pixel_x, pixel_y); } gr.DrawString(mac, draw_font, draw_brush, pixel_x, pixel_y); } catch { } }
private void cbmac_SelectedIndexChanged(object sender, EventArgs e) { try { Database my_Database = new Database(); int index = cbSelectNode.SelectedIndex; if (index == 0) { if (rbDeleteNode.Checked == true || rdeditnode.Checked == true) { string macSensor = cbmac.Text; tbLatitude.Text = my_Database.getSensorPixel_x(macSensor).ToString(); tbLongitude.Text = my_Database.getSensorPixel_y(macSensor).ToString(); tbActor.Text = my_Database.getVanSensor(macSensor); } } else { string macActor = cbmac.Text; tbLatitude.Text = my_Database.getActorPixel_x(macActor).ToString(); tbLongitude.Text = my_Database.getActorPixel_y(macActor).ToString(); } } catch { } }