Exemplo n.º 1
0
        public static NetworkAnalyzer Connect(string currentAddress, NetworkAnalyzer.ValidateSupportDelegate supportDelegate, bool interactive)
        {
            NetworkAnalyzer ANetworkAnalyzer = null;
            string          str = (currentAddress != null ? currentAddress : "GPIB0::18::INSTR");

            NetworkAnalyzer.m_validateSupportDelegate = supportDelegate;
            if (interactive)
            {
                throw new Exception("不支持交互模式");
            }
            try
            {
                if (NetworkAnalyzer.DetermineSupport(str) == null)
                {
                    ANetworkAnalyzer = NetworkAnalyzer.CreateDetectedNetworkAnalyzer(str);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            NetworkAnalyzer.m_validateSupportDelegate = null;
            if (ANetworkAnalyzer != null)
            {
                ANetworkAnalyzer.Connected = true;
            }
            return(ANetworkAnalyzer);
        }