Esempio n. 1
0
        private Connection ConvertConnection(INetworkConnection connection)
        {
            INetwork network = null;

            try
            {
                network = connection.GetNetwork();

                uint crLo, crHi, coLo, coHi;
                network.GetTimeCreatedAndConnected(out crLo, out crHi, out coLo, out coHi);

                return(new Connection
                {
                    AdapterID = connection.GetAdapterId(),

                    IsConnected = connection.IsConnected,
                    IsConnectedToInternet = connection.IsConnectedToInternet,
                    ConnectionID = connection.GetConnectionId(),
                    Connectivity = (Connectivity)connection.GetConnectivity(),
                    DomainType = (DomainType)connection.GetDomainType(),

                    Network = ConvertNetwork(network)
                });
            }
            finally
            {
                ReleaseComObject(network);
            }
        }