private void TimerLeerStatusDetector_Tick(object sender, EventArgs e) { try { TimerLeerStatusDetector.Stop(); if (!LeerStatusWorker.IsBusy) { LeerStatusWorker.RunWorkerAsync(); } } catch (ArgumentNullException ex) { } }
public void GenerarDetectorZona(int posx, int posy, string tipo, int sizepx, string name, bool mover, int idDetector, Image img, string identificador, string dispositivo, string tipoDispositivo, string figura) { try { PictureBox p = new PictureBox(); p.Location = new Point(posx, posy); p.BringToFront(); if (figura == "Círculo") { var path = new System.Drawing.Drawing2D.GraphicsPath(); path.AddEllipse(0, 0, sizepx, sizepx); p.Region = new Region(path); } else { p.Size = new Size(sizepx, sizepx); } p.Tag = tipo + "*" + idDetector.ToString() + "*" + identificador + "*" + sizepx.ToString() + "*" + name.Trim() + "*" + dispositivo + "*" + tipoDispositivo + "*" + figura; p.Image = null; p.BackColor = Color.Transparent; p.SizeMode = PictureBoxSizeMode.StretchImage; p.BackColor = Color.Transparent; p.Draggable(mover); p.MouseHover += new EventHandler(Panel_Hover); p.MouseLeave += new EventHandler(Panel_Leave); PictureBox pic = FindPictureBox(); Action action = () => { pic.Controls.Add(p); }; pic.Invoke(action); } catch (ArgumentNullException ex) { Console.WriteLine("MONITOREO GENERAR DETECTOR"); TimerLeerStatusDetector.Start(); border_timer.Start(); } }
public void CargarImagenDesdeBd(int idZona) { try { //if (pictureBox1.Image != null) //{ // pictureBox1.Image = null; //} PictureBox pic = new PictureBox(); pic.Tag = "ZONA PIC"; pic.SizeMode = PictureBoxSizeMode.StretchImage; pic.Dock = DockStyle.Fill; pic.BringToFront(); panel1.Controls.Add(pic); DataTable dt = new DataTable(); Procedimientos P = new Procedimientos(); P.Id = idZona; dt = P.ObtenerImagenesZonas(); for (int i = 0; i < dt.Rows.Count; i++) { byte[] imgshow = (byte[])(dt.Rows[i][1]); MemoryStream Ms = new MemoryStream(imgshow); try { Image loadedImage = Image.FromStream(Ms); pic.Image = loadedImage; pic.SizeMode = PictureBoxSizeMode.StretchImage; pic.Refresh(); } catch (ArgumentNullException ex) { Console.WriteLine("MONITOREO CARGAR IMAGEN DESDE BD"); TimerLeerStatusDetector.Start(); border_timer.Start(); // The user lacks appropriate permissions to read files, discover paths, etc. MessageBox.Show("Security error. Please contact your administrator for details.\n\n" + "Error message: " + ex.Message + "\n\n" + "Details (send to Support):\n\n" + ex.StackTrace ); } } } catch (ArgumentNullException ex) { } }
public void LoadSlideShows(int idZonaSlide) { estadoDevice = "OK"; panel3.BackColor = Verde; //rojo; NombreZona_lbl.ForeColor = Blanco; panel2.BackColor = Gray; TimerLeerStatusDetector.Stop(); border_timer.Stop(); EliminarTodosDetectores(); EliminarPlanoPrincipal(); ObtenerUltimoEstadoFacp(); ObtenerEstadoEvacuacionFacp(); NombreZona_lbl.Text = zonasNombresList[indexSlideShow]; this.Text = zonasNombresList[indexSlideShow]; CargarZona(); CargarDetectores(idZonaSlide); CambiarColorBorde(); TimerLeerStatusDetector.Start(); border_timer.Start(); }
private void LeerStatusWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { try { TimerLeerStatusDetector.Start(); } catch (ArgumentNullException ex) { } }
public void CambiarEstadoDetector(PictureBox pb, string estado, string figura) { try { if (pb.Image != null) { pb.Image = null; //pb.Refresh(); } if (figura == "Círculo" || figura == "Cuadro") { if (estado == "OK") { pb.Image = Properties.Resources.DetectorOK; } else if (estado == "HEAT" || estado == "SMOKE" || estado == "PULL STATION" || estado == "MONITOR") { pb.Image = Properties.Resources.DetectorFuego; } else if (estado == "INVREP") { pb.Image = Properties.Resources.DetectorFalta; } else if (estado == "OPEN" || estado == "SHORT" || estado == "DIRTY1" || estado == "DIRTY2" || estado == "INV ID" || estado == "TEST F") { pb.Image = Properties.Resources.DetectorWarning; } else //no pudo ser leido { pb.Image = Properties.Resources.DetectorNoLeido; } } else if (figura == "Letra M") { if (estado == "OK") { pb.Image = Properties.Resources.transLetraMverde; } else if (estado == "HEAT" || estado == "SMOKE" || estado == "PULL STATION" || estado == "MONITOR") { pb.Image = Properties.Resources.ModuloActivo; } else if (estado == "INVREP") { pb.Image = Properties.Resources.ModuloFalta; } else if (estado == "OPEN" || estado == "SHORT" || estado == "DIRTY1" || estado == "DIRTY2" || estado == "INV ID" || estado == "TEST F") { pb.Image = Properties.Resources.transLetraMamarilla; } else //no pudo ser leido { pb.Image = Properties.Resources.ModuloFalta; } } else // Letra P { if (estado == "OK") { pb.Image = Properties.Resources.transLetraPverde; } else if (estado == "HEAT" || estado == "SMOKE" || estado == "PULL STATION" || estado == "MONITOR") { pb.Image = Properties.Resources.PullActivo; } else if (estado == "INVREP") { pb.Image = Properties.Resources.DetectorFalta; } else if (estado == "OPEN" || estado == "SHORT" || estado == "DIRTY1" || estado == "DIRTY2" || estado == "INV ID" || estado == "TEST F") { pb.Image = Properties.Resources.transLetraPamarilla; } else //no pudo ser leido { pb.Image = Properties.Resources.PullFalta; } // pb.Show(); //pb.Load(); } } catch (ArgumentNullException ex) { Console.WriteLine("MONITOREO CAMBIAR ESTADO DETECTOR"); TimerLeerStatusDetector.Start(); border_timer.Start(); } //estadoDevice = estado; }