Exemplo n.º 1
0
        void ConnectPorts(object sender, string number)
        {
            IPort firstPort    = ports[IndexOfPort(sender.ToString())];
            int   secondPortId = IndexOfPort(number);

            if (secondPortId != -1)
            {
                IPort secondPort = ports[secondPortId];
                if (firstPort.Region == secondPort.Region)
                {
                    secondPort.ConnectedToPort(firstPort.Number);
                }
                else
                {
                    firstPort.EndCall();
                }
            }
        }