Example #1
0
        public Form1()
        {
            InitializeComponent();

            string[] szLocalIP;
            int      iCnt, iLen;
            TreeNode portNode;

            adamList            = new ArrayList();
            m_iTimeout          = 1000; //ms
            m_iResetMilliSecond = 8000; //ms

            // add tree node to host for local IP
            if (AdamSocket.GetLocalNetwork(out szLocalIP))
            {
                tcpTree.BeginUpdate();
                iLen = szLocalIP.Length;
                for (iCnt = 0; iCnt < iLen; iCnt++)
                {
                    portNode                    = new TreeNode(szLocalIP[iCnt]);
                    portNode.ImageIndex         = 5;
                    portNode.SelectedImageIndex = 6;
                    tcpTree.Nodes[0].Nodes.Add(portNode);
                }
                // the node for those IP not in the domain
                portNode                    = new TreeNode("Others");
                portNode.ImageIndex         = 5;
                portNode.SelectedImageIndex = 6;
                tcpTree.Nodes[0].Nodes.Add(portNode);
                tcpTree.Nodes[0].Expand();
                tcpTree.EndUpdate();
            }
        }
Example #2
0
        public static bool SetAdamInformationEx(AdamInfoType i_infoType, int i_iTimeout, AdamInformation i_adamObject)
        {
            string[] szLocalIPs;
            bool     bRet = false;

            if (AdamSocket.GetLocalNetwork(out szLocalIPs))
            {
                foreach (string szLocalIP in szLocalIPs)
                {
                    if (AdamSocket.SetAdamInformation(i_infoType, i_iTimeout, i_adamObject, szLocalIP))
                    {
                        bRet = true;
                        break;
                    }
                }
            }

            return(bRet);
        }
Example #3
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            int             iIndex;
            int             iCount = 0;
            AdamInformation adamObject;

            string[] szLocalIPs;
            adamList = new ArrayList();

            Cursor.Current = Cursors.WaitCursor;
            ClearNodes();

            if (AdamSocket.GetLocalNetwork(out szLocalIPs))
            {
                foreach (string szLocalIP in szLocalIPs)
                {
                    ArrayList adamCarryList;
                    AdamSocket.GetAdamDeviceList(m_iTimeout, szLocalIP, out adamCarryList);

                    if (adamCarryList.Count > 0)
                    {
                        for (iIndex = 0; iIndex < adamCarryList.Count; iIndex++)
                        {
                            adamObject = new AdamInformation();
                            adamObject = (AdamInformation)adamCarryList[iIndex];

                            if (adamList.Contains(adamObject) == false)
                            {
                                adamList.Add(adamObject); //Add Device to list
                                InsertNode(iCount, adamObject);
                                iCount = iCount + 1;
                            }
                        }
                    }
                }
            }

            Cursor.Current = Cursors.Default;
        }