¿por que me produce una excepción?
Thread hs;
hs = new Thread(()=>Playsound(sound));
while (bstate==-1)
{
t = Int16.Parse(bpm.Text);
t = 60000 / t;
hs.Start();
cajas[compas-1].Fill = new SolidColorBrush(Colors.White);
cajas[0].Fill = new SolidColorBrush(Colors.Red);
await Task.Delay(t);
for (int k = 1; k < compas-1; k++)
{
hs.Start();
cajas[k-1].Fill = new SolidColorBrush(Colors.White);
cajas[k].Fill = new SolidColorBrush(Colors.Black);
await Task.Delay(t);
}
hs.Start();
cajas[compas - 2].Fill = new SolidColorBrush(Colors.White);
cajas[compas - 1].Fill = new SolidColorBrush(Colors.Black);
await Task.Delay(t);
}
Texto de la excepción:
System.Threading.ThreadStateException: 'Subproceso en ejecución o terminado; no se puede reiniciar.' La excepcion se produce en el segundo hs.Start();
await Task.Delay(t)
en diferentes lugares? Hay algo raro en el diseño. – sstan el 20 nov. 17 a las 14:51