VSNDK.DebugEngine.AD7PortSupplier.EnumPorts C# (CSharp) Method

EnumPorts() public method

Retrieves a list of all the ports supplied by a port supplier. (http://msdn.microsoft.com/en-ca/library/bb146984.aspx)
public EnumPorts ( IEnumDebugPorts2 &ppEnum ) : int
ppEnum IEnumDebugPorts2 Returns an IEnumDebugPorts2 object containing a list of ports supplied.
return int
        public int EnumPorts(out IEnumDebugPorts2 ppEnum)
        {
            m_ports.Clear();
            int success = verifyAndAddPorts();
            AD7Port[] ports = new AD7Port[m_ports.Count()];

            if (m_ports.Count() > 0)
            {
                int i = 0;
                foreach (var p in m_ports)
                {
                    ports[i] = p.Value;
                    i++;
                }
            }
            else
            {
                if (success == 0)
                    MessageBox.Show("Visual Studio can debug only one BlackBerry application at a time.\n\nPlease, select a different transport or close the current debug session.", "Visual Studio is already debugging an application", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                else if (success == -1)
                    MessageBox.Show("You must select an API Level to be able to attach to a running process.\n\nPlease, use \"BlackBerry -> Settings -> Get more\" to download one.", "Missing NDK", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                else
                    MessageBox.Show("Missing Device/Simulator information. Please, use menu BlackBerry -> Settings to add any of those information.", "Missing Device/Simulator Data", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

            ppEnum = new AD7PortEnum(ports);
            return VSConstants.S_OK;
        }