Exemplo n.º 1
0
 protected virtual void ServerOnUserIsBusy(object sender, string message)
 {
     if (sender as Port != this)
     {
         return;
     }
     State = PortState.Enabled;
     UserIsBusy?.Invoke(sender, message);
     PortEnabled?.Invoke(this, EventArgs.Empty);
 }
Exemplo n.º 2
0
 private void CheckActivePortCalledNumber(Port port, int callNumber)
 {
     if (IsDisableListContainsCalledNumber(callNumber))
     {
         UserIsUnavaliable?.Invoke(port, "User is unavaliable now. Please try again.");
     }
     else if (IsActiveListContainsCalledNumber(callNumber))
     {
         UserIsBusy?.Invoke(port, "User is busy. Please try again later.");
     }
     else if (IsEnabledListContainsCalledNumber(callNumber))
     {
         var port2 = EnabledPorts.FirstOrDefault(x => x.Number == callNumber);
         if (port2 != null)
         {
             EstablishConnection?.Invoke(this, new ConnectionEventArgs(port, port2));
         }
     }
     else
     {
         UserDoesntExists?.Invoke(port, "We're sorry, but user with this number doesn't exists.");
     }
 }