예제 #1
0
        private void startCall(CallEmployee employee)
        {
            employee.State = "Busy";

            Random r          = new Random();
            int    callLength = r.Next(5, 7); //produces a call length

            Task.Delay(callLength * 1000).ContinueWith(t => endCall(employee));
        }
예제 #2
0
 private void takeNextCall(CallEmployee employee)
 {
     //employee takes next call if there are callers waiting
     if (callerList.Any())
     {
         callerList.RemoveAt(0);
         OnPropertyChanged("callerList"); //list has been updated
         startCall(employee);
     }
     else
     {
         callerCount = 0;
     }
 }
예제 #3
0
 private void endCall(CallEmployee employee)
 {
     employee.State = "Free";
     Task.Delay(1000).ContinueWith(t => takeNextCall(employee));
 }