Beispiel #1
0
        //选择页码,更新DataGridView列表
        private void cboDNSPage_SelectedIndexChanged(object sender, EventArgs e)
        {
            int iPage = cboDNSPage.SelectedIndex;

            if (iPage < 0)
            {
                return;
            }
            dgvDNS.Rows.Clear();

            //将回调保存,防止垃圾回收,出现异常
            DnsNotify = DNSListNotify;

            //获取DNS设备列表
            int iRet = NVSSDK.NSLook_GetList
                       (
                ServerID,
                Encoding.ASCII.GetBytes(UserName),
                Encoding.ASCII.GetBytes(Password),
                iPage,
                DnsNotify,
                null,
                NVSSDK.TYPE_DNS
                       );

            //刷新DataGridView
            dgvDNS.Invalidate();

            if (iRet != 0)
            {
                MessageBox.Show("NSLook_GetList DNS Error ! " + iRet);
            }
        }
Beispiel #2
0
        //获取NVS设备列表
        private void btnNVSRefresh_Click(object sender, EventArgs e)
        {
            int iCount = 0;

            //获取NVS设备数量
            int iRet = NVSSDK.NSLook_GetCount
                       (
                ServerID,
                Encoding.ASCII.GetBytes(UserName),
                Encoding.ASCII.GetBytes(Password),
                ref iCount, NVSSDK.TYPE_NVS
                       );

            if (iRet != 0)
            {
                MessageBox.Show("NSLook_GetCount NVS Error ! " + iRet);
                textNVSCount.Text = "0";
                return;
            }
            textNVSCount.Text = iCount.ToString();

            //将回调保存,防止垃圾回收,出现异常
            NvsNotify = NVSListNotify;
            if (iCount > 0)
            {
                //清空DataGridView的内容
                dgvNVS.Rows.Clear();

                //获取NVS列表
                iRet = NVSSDK.NSLook_GetList
                       (
                    ServerID,
                    Encoding.ASCII.GetBytes(UserName),
                    Encoding.ASCII.GetBytes(Password),
                    0,
                    null,
                    NvsNotify,
                    NVSSDK.TYPE_NVS
                       );

                //操作失败
                if (iRet != 0)
                {
                    MessageBox.Show("NSLook_GetList NVS Error ! " + iRet);
                }
            }
        }