Torna al Thread
try
{
System.Collections.Generic.List<Allarmi> Allarme = new System.Collections.Generic.List<Allarmi>();
Allarme = (from ListaAllarme in xmlDoc.Descendants("numero")
where ListaAllarme.Attribute("id").Value == (NumeroAllarme)
select ListaAllarme)
.Select(x => new Allarmi()
{
Testo = x.Descendants("messaggio").ElementAt(0).Attribute("testo").Value,
RitardoCombinatore = Convert.ToInt16(x.Descendants("messaggio").ElementAt(1).Attribute("ritardocombinatore").Value),
UscitaCombinatore = Convert.ToInt16(x.Descendants("messaggio").ElementAt(2).Attribute("uscitacombinatore").Value),
Muto = x.Descendants("messaggio").ElementAt(3).Attribute("muto").Value
}).ToList();
TestoAllarme = (from p in Allarme
select p.Testo).FirstOrDefault();
ritardoCombinatore = (from p in Allarme
select p.RitardoCombinatore).FirstOrDefault();
uscitaCombinatore = (from p in Allarme
select p.UscitaCombinatore).FirstOrDefault();
MessaggioMuto = (from p in Allarme
select p.Muto).FirstOrDefault();
}
catch
{ }
}
public class Allarmi
{
public string Testo { get; set; }
public int RitardoCombinatore { get; set; }
public int UscitaCombinatore { get; set; }
public string Muto { get; set; }
}