예제 #1
0
 private void btnConfirm_Click(object sender, EventArgs e)
 {
     if (btnConfirm.Text == "重新连接")
     {
         if (DMSDK.DM_CheckOnline("192.168.1.2", 80) < 0)
         {
             MessageBox.Show("未检测到在线仪器,请检查后重试!");
             btnConfirm.Text = "重新连接";
         }
         else
         {
             DMSDK.DM_Init();
             temp_OperateHandle = DMSDK.DM_Connect(ucPbx1.Handle, "192.168.1.2", 80);
             temp_ConnectHandle = DMSDK.DM_OpenMonitor(ucPbx1.Handle, "192.168.1.2", 5000, 0);
             DMSDK.DM_GetNetmask(temp_OperateHandle, SubMask);
             DMSDK.DM_GetGateway(temp_OperateHandle, GateWay);
             btnConfirm.Text = "确认修改";
         }
     }
     else if (btnConfirm.Text == "确认修改")
     {
         if (SubMask.ToString() == "" || GateWay.ToString() == "")
         {
             MessageBox.Show("参数异常!请重试!");
             return;
         }
         DMSDK.DM_SetIPAddr(temp_OperateHandle, ipAddressTextBox1.IPAdd.ToString(), SubMask.ToString(), GateWay.ToString());
         MessageBox.Show("修改完成");
         this.Close();
     }
 }
예제 #2
0
 private void FrmIpConfig_Load(object sender, EventArgs e)
 {
     if (DMSDK.DM_CheckOnline("192.168.1.2", 5000) < 0)
     {
         MessageBox.Show("未检测到在线仪器,请检查后重试!");
         btnConfirm.Text = "重新连接";
     }
     else
     {
         temp_OperateHandle = DMSDK.DM_Connect(ucPbx1.Handle, "192.168.1.2", 80);
         if (temp_OperateHandle > 0)
         {
             temp_ConnectHandle = DMSDK.DM_OpenMonitor(ucPbx1.Handle, "192.168.1.2", 5000, 0);
         }
         if (temp_OperateHandle > 0 && temp_ConnectHandle > 0)
         {
             DMSDK.DM_GetNetmask(temp_OperateHandle, SubMask);
             DMSDK.DM_GetGateway(temp_OperateHandle, GateWay);
         }
         else
         {
             MessageBox.Show("连接失败,请重试!");
             this.Close();
         }
         if (SubMask.Length == 0)
         {
             MessageBox.Show("连接失败,请重试!");
             this.Close();
         }
     }
 }
예제 #3
0
 private void btnConfirm_Click(object sender, EventArgs e)
 {
     if (btnConfirm.Tag.ToString() == "Confirm")
     {
         btnConfirm.Text = "确认修改";
         if (Mac.Length == 0)
         {
             MessageBox.Show("MAC地址无效!重试!");
             return;
         }
         DMSDK.DM_SetIPAddr(tempConnect, IPAddressIP.IPAdd.ToString(), IPAddressSubMask.IPAdd.ToString(), IPAddressGateWay.IPAdd.ToString());
         sqlCreate.UpDate_CameraEnable(StaticClass.Temper_CameraId, "无", Convert.ToBoolean(cbxIsEnable.SelectedIndex), StaticClass.DataBaseName);
         MessageBox.Show("修改成功!请重新进入!");
         StaticClass.Temper_IsEnanle = Convert.ToBoolean(cbxIsEnable.SelectedIndex);
         this.Close();
     }
     else if (btnConfirm.Tag.ToString() == "Reconnect")
     {
         btnConfirm.Text = "重新连接";
         if (DMSDK.DM_CheckOnline(StaticClass.Temper_Ip, 80) < 0)// 离线检测  为离线
         {
             MessageBox.Show("无法连接探测器,请检查线路,或修改参数后重新连接!");
             btnConfirm.Tag              = "Reconnect";
             chbModifyGateWay.Enabled    = false;
             chbModifyMac.Enabled        = false;
             chbModifyNetMask.Enabled    = false;
             cbxIsEnable.SelectedIndex   = Convert.ToInt32(StaticClass.Temper_IsEnanle);
             StaticClass.Temper_IsEnanle = Convert.ToBoolean(cbxIsEnable.SelectedIndex);
         }
         else
         {
             tempConnect = DMSDK.DM_Connect(this.Handle, IPAddressIP.IPAdd.ToString(), 80);
             if (tempConnect < 0)
             {
                 MessageBox.Show("连接失败!请检查设备与参数后重试!");
                 return;
             }
             btnConfirm.Text = "确认修改";
             btnConfirm.Tag  = "Confirm";
             Mac             = new StringBuilder();
             SubMask         = new StringBuilder();
             GateWay         = new StringBuilder();
             DMSDK.DM_GetMAC(tempConnect, Mac);
             DMSDK.DM_GetNetmask(tempConnect, SubMask);
             DMSDK.DM_GetGateway(tempConnect, GateWay);
             cbxIsEnable.SelectedIndex   = Convert.ToInt32(StaticClass.Temper_IsEnanle);
             StaticClass.Temper_IsEnanle = Convert.ToBoolean(cbxIsEnable.SelectedIndex);
             Update_IpAddrGateWay(GateWay.ToString());
             Update_IpAddrSubMask(SubMask.ToString());
             tbxMAC.Text = Mac.ToString();
             tbxMAC.Text = Mac.ToString();
             chbModifyGateWay.Enabled = true;
             chbModifyMac.Enabled     = true;
             chbModifyNetMask.Enabled = true;
             cbxIsEnable.Enabled      = true;;
         }
     }
 }
예제 #4
0
 private void FrmConfig_Load(object sender, EventArgs e)
 {
     DMSDK.DM_Init();
     DMSDK.DM_PlayerInit(uCPbx.Handle);
     StaticClass.tempIntPtr = uCPbx.Handle;
     if (DMSDK.DM_CheckOnline(StaticClass.Temper_Ip, 5000) < 0)
     {
         MessageBox.Show("该探测器未连接,无法进行其他设置!");
     }
     else
     {
         StaticClass.tempConnect = DMSDK.DM_Connect(uCPbx.Handle, StaticClass.Temper_Ip, 80);
         if (StaticClass.tempConnect > 0)
         {
             StaticClass.tempMonitor = DMSDK.DM_OpenMonitor(uCPbx.Handle, StaticClass.Temper_Ip, 5000, 0);
         }
     }
     grpConfig.Text         = "网络设置";
     btnNetConfig.Tag       = 1;
     btnNetConfig.BackColor = Color.Yellow;
     btnNetConfig.PerformClick();
 }
예제 #5
0
        private int tempConnect;//临时连接句柄

        private void FrmCameraConfig_Load(object sender, EventArgs e)
        {
            Mac     = new StringBuilder();
            SubMask = new StringBuilder();
            GateWay = new StringBuilder();
            if (StaticClass.Temper_Ip != "")
            {
                string[] str = StaticClass.Temper_Ip.Split('.');
                IPAddressIP.tbx1.Text = str[0];
                IPAddressIP.tbx2.Text = str[1];
                IPAddressIP.tbx3.Text = str[2];
                IPAddressIP.tbx4.Text = str[3];
                if (DMSDK.DM_CheckOnline(StaticClass.Temper_Ip, 80) < 0)// 离线检测  为离线
                {
                    btnConfirm.Tag = "Reconnect";
                    Update_IpAddrGateWay("0.0.0.0");
                    Update_IpAddrSubMask("0.0.0.0");
                    chbModifyGateWay.Enabled    = false;
                    chbModifyMac.Enabled        = false;
                    chbModifyNetMask.Enabled    = false;
                    btnUpdateIsenable.Visible   = true;
                    cbxIsEnable.SelectedIndex   = Convert.ToInt32(StaticClass.Temper_IsEnanle);
                    StaticClass.Temper_IsEnanle = Convert.ToBoolean(cbxIsEnable.SelectedIndex);
                }
                else if (DMSDK.DM_CheckOnline(StaticClass.Temper_Ip, 80) > 0)               //连接成功
                {
                    tempConnect = DMSDK.DM_Connect(this.Handle, StaticClass.Temper_Ip, 80); //
                    if (tempConnect <= 0)
                    {
                        MessageBox.Show("连接失败!请检查设备与参数后重试!");
                        return;
                    }
                    DMSDK.DM_GetMAC(tempConnect, Mac);
                    if (Mac.Length == 0)
                    {
                        btnConfirm.Tag = "Reconnect";
                        Update_IpAddrGateWay("0.0.0.0");
                        Update_IpAddrSubMask("0.0.0.0");
                        chbModifyGateWay.Enabled    = false;
                        chbModifyMac.Enabled        = false;
                        chbModifyNetMask.Enabled    = false;
                        btnUpdateIsenable.Visible   = true;
                        cbxIsEnable.SelectedIndex   = Convert.ToInt32(StaticClass.Temper_IsEnanle);
                        StaticClass.Temper_IsEnanle = Convert.ToBoolean(cbxIsEnable.SelectedIndex);
                        MessageBox.Show("连接失败!请检查设备与参数后重试!");
                    }
                    else
                    {
                        DMSDK.DM_GetNetmask(tempConnect, SubMask);
                        DMSDK.DM_GetGateway(tempConnect, GateWay);
                        Update_IpAddrGateWay(GateWay.ToString());
                        Update_IpAddrSubMask(SubMask.ToString());
                        tbxMAC.Text = Mac.ToString();
                        cbxIsEnable.SelectedIndex   = Convert.ToInt32(StaticClass.Temper_IsEnanle);
                        StaticClass.Temper_IsEnanle = Convert.ToBoolean(cbxIsEnable.SelectedIndex);
                        btnConfirm.Tag            = "Confirm";
                        chbModifyGateWay.Enabled  = true;
                        chbModifyMac.Enabled      = true;
                        chbModifyNetMask.Enabled  = true;
                        btnUpdateIsenable.Visible = false;
                    }
                }
            }
            if (btnConfirm.Tag.ToString() == "Confirm")
            {
                btnConfirm.Text = "确认修改";
            }
            else if (btnConfirm.Tag.ToString() == "Reconnect")
            {
                btnConfirm.Text = "重新连接";
            }
        }