internal void ResponseCall(ConcurrentQueue <Call> calls) { calls.TryDequeue(out Call call); if (call != null) { WriteLine($"Employee id = {ID}, recived {call}\n"); Thread.Sleep(call.DurationSec * 1000); WriteLine($"{call} has been ended.\n"); AttendedCalls.Enqueue(call); State = EmployeeState.AVAILABLE; } else { Thread.Sleep(3000); } ReadyForNextCall?.Invoke(calls); }
public void ResponseCall(ConcurrentQueue <ICall> calls) { ICall call; calls.TryDequeue(out call); if (call != null) { Console.WriteLine("{0}: {1} has been recieved. Starting conversation...", Name, call.Name); Conversation(); EndCall(); } else { //Wait 3 seconds for new calls. Thread.Sleep(3000); } ReadyForNextCall?.Invoke(calls); }