//------------------------------------------------------------------------------------------------------------------- // Подписки // Станция protected void PortAddedToApe(object sender, PortEventArgs e) { IPhoneExchange phoneExchange = sender as IPhoneExchange; if (phoneExchange != null && e != null && e.Port == this) { //Debug.WriteLine("[Port.PortAddedToApe] PortId: {0}", e.Port.PortId); phoneExchange.PortAdded -= PortAddedToApe; phoneExchange.PortRemoved += PortRemovedFromApe; phoneExchange.CallStarted += IncommingCallReceived; phoneExchange.CallEnded += IncommingCallEnded; phoneExchange.CallAccepted += OutgoingCallAccepted; } }
public Port(IPhoneExchange phoneExchange, IPortId portId) { if (phoneExchange == null) { throw new ArgumentNullException("phoneExchange", "phoneExchange cannot be null."); } if (portId == null) { throw new ArgumentNullException("portId", "portId cannot be null."); } PortId = portId; PortState = PortStates.NotConnected; phoneExchange.PortAdded += PortAddedToApe; }
public IPort CreatePort(IPhoneExchange phoneExchange, IPortId portId) { return(new Port(phoneExchange, portId)); }