Пример #1
0
        protected virtual void PortOnCallAccepted(object sender, AnswerEventArgs e)
        {
            var port1 = ActivePorts.FirstOrDefault(x => x.Key.Number == e.number1).Key;
            var port2 = EnabledPorts.FirstOrDefault(x => x.Number == e.number2);

            AnswerOnAccept?.Invoke(this, new ConnectionEventArgs(port1, port2, e.message));
        }
Пример #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.");
     }
 }