public Terminal(PhoneNumber PhoneNumber) { this.PhoneNumber = PhoneNumber; this.Online += (sender, e) => { Console.WriteLine("Terminal {0} turned to online mode!", this.PhoneNumber); }; this.OffLine += (sender, e) => { Console.WriteLine("Terminal {0} turned to offline mode!", this.PhoneNumber); }; this.IncomingRequest += (sender, e) => { Console.WriteLine("Terminal {0} received request from {1}!", this.PhoneNumber, (e.Request as IncomingRequest).Source); }; }
public Response(ResponseState state, PhoneNumber source) { State = state; Source = source; }
protected void SetPortStateAfterConnectionInterrupted(PhoneNumber Source, PhoneNumber target) { IPort SourcePort = GetPortByNumber(Source); if (SourcePort != null) SourcePort.State = PortState.Free; IPort targetPort = GetPortByNumber(target); if (targetPort != null) targetPort.State = PortState.Free; }
protected ITerminal GetTerminalByNumber(PhoneNumber PhoneNumber) { return this.m_terminals.FirstOrDefault(x => x.PhoneNumber == PhoneNumber); }
protected IPort GetPortByNumber(PhoneNumber PhoneNumber) { return this.m_portMapping[PhoneNumber]; }
protected CallInfo GetConnectionInfo(PhoneNumber PhoneNumber) { return this.m_connectionCollection.FirstOrDefault(x => (x.Source == PhoneNumber || x.Target == PhoneNumber)); }
protected bool CheckOnCorrectness(PhoneNumber Source, PhoneNumber target) { return (Source != default(PhoneNumber) && target != default(PhoneNumber)); }
public CallInfo(PhoneNumber source, PhoneNumber target, DateTime start, TimeSpan duration) : this(source, target, start) { this.Duration = duration; }
public CallInfo(PhoneNumber source, PhoneNumber target, DateTime start) { this.Source = source; this.Target = target; this.Started = start; }
public CallInfo(PhoneNumber target, PhoneNumber source, TerminalState state) { Target = target; Source = source; State = state; }
public void Call(PhoneNumber target) { if (!IsOnline) OnOutgoingRequest(this, target); if (m_serverRequest != null) OnOnline(this, EventArgs.Empty); }
protected virtual void OnOutgoingRequest(object sender, PhoneNumber target) { if (OutgoingConnection != null) { this.m_serverRequest = new OutgoingRequest(this.PhoneNumber, target); OutgoingConnection(sender, new RequestEventArgs(this.m_serverRequest)); } }
public void IncomingRequestFrom(PhoneNumber Source) { OnIncomingRequest(this, new IncomingRequest(Source)); }