bool EstaCorriendoTurno(Turno turno) { return _cola.Peek() == turno; }
private void QuitarDeCola(Turno turno) { if (EstaCorriendoTurno(turno)) ApagarMicrofono(turno.Mic.Number); List<Turno> turnos = this.Turnos; turnos.Remove(turno); RefrescarCola(turnos); if (_cola.ToList().Count <= 0) { _timer.Stop(); DesconectarseDeServidor(); } _view.ActualizarBotonesMicrofonos(); }
public void AgregarACola(double selectedTime, Microfono mic) { long time = (long)(selectedTime * 60); Turno turno = new Turno { Time = time, TotalTime = time, Mic = mic }; _cola.Enqueue(turno); _view.ActualizarBotonesMicrofonos(); if (!_timer.IsEnabled) { ConectarseAServidor(); _timer.Start(); } }