コード例 #1
0
        public void placerTrameAlarme(int id, int nbr, int type, ulong data, int idAlarme, int typeAlarme, int etat)
        {
            bool placer = false;

            foreach (IdBase trame in listeTram)
            {
                if (trame.id == id && !placer)
                {
                    IdAlarme trameCorrecte = (IdAlarme)trame;
                    trameCorrecte.nbData     = nbr;
                    trameCorrecte.type       = type;
                    trameCorrecte.data       = data;
                    trameCorrecte.idAl       = idAlarme;
                    trameCorrecte.typeAlarme = typeAlarme;
                    trameCorrecte.etat       = etat;
                    placer = true;
                    MettreAJourGrid(trameCorrecte);
                }
            }
            if (!placer)
            {
                IdAlarme trame = new IdAlarme();
                trame.id     = id;
                trame.nbData = nbr;
                trame.type   = type;
                trame.data   = data;
                listeTram.Add(trame);
                DataGridViewRow row = (DataGridViewRow)grid.Rows[0].Clone();
                row.Cells[0].Value = trame.id;
                row.Cells[1].Value = trame.type;
                gridRows++;
                grid.Height = boxheight * gridRows + 3;
                grid.Invoke((MethodInvoker)(() => grid.Rows.Add(row)));
            }
        }
コード例 #2
0
 private void MettreAJourGrid(IdAlarme trame)
 {
     for (int i = 0; i < grid.Rows.Count; i++)
     {
         for (int j = 0; j < grid.Columns.Count; j++)
         {
             if (j == 0 && grid.Rows[i].Cells[j].Value.ToString() == trame.id.ToString())
             {
                 grid.Rows[i].Cells[j + 1].Value = "Alarme";
             }
         }
     }
 }