protected virtual void PortOnSendRejectMessageToTerminal(object sender, AnswerEventArgs e) { if (Number == e.number2) { TerminalSendMessage?.Invoke(this, e.message); } }
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)); }
//methods-handlers of port events protected virtual void PortOnCallRequesting(object sender, AnswerEventArgs e) { TerminalRequiredAnswer?.Invoke(this, "Incoming call. Type 'y' to answer, 'n' to reject"); if (_userAnswer != null && _userAnswer.ToLower().Equals("y")) { AcceptCall?.Invoke(this, new AnswerEventArgs(e.number1, e.number2, $"User 2 : Connection with {e.number1} established")); } else { RejectCall?.Invoke(this, new AnswerEventArgs(e.number1, e.number2, $"{e.number2} has rejected call")); } }
protected virtual void TerminalOnRejectCall(object sender, AnswerEventArgs e) { CallRejected?.Invoke(this, e); }
protected virtual void PortOnCallRejected(object sender, AnswerEventArgs e) { var port1 = ActivePorts.FirstOrDefault(x => x.Key.Number == e.number1).Key; AnswerOnReject?.Invoke(port1, e.message); }