Example #1
0
        //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
            { }
        }