Exemple #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("是否要保存", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == System.Windows.Forms.DialogResult.Yes)
            {
                MesDeviceBLL MesDeviceBLL = new MesDeviceBLL();
                var          rows         = MesDeviceBLL.GetList();
                if (rows.Count > 0)
                {
                    for (int i = 0; i < rows.Count; i++)
                    {
                        string url = "http://" + rows[i].D_IP + ":8090/setIdentifyCallBack";

                        string postData = "pass="******"&" + "callbackUrl=" + txtUrl.Text; //http://192.168.1.140:8090/api/FaceRecording/GetUserInfo";
                        string strtemp  = FaceRecognition.RequestWithHttps(url, postData);
                        if (!FaceRecognition.json(strtemp))
                        {
                            untCommon.InfoMsg("该IP地址不可用!");
                            return;
                        }
                        JObject joModel = (JObject)JsonConvert.DeserializeObject(strtemp);
                        if (!bool.Parse(joModel["success"].ToString()))
                        {
                            untCommon.InfoMsg(joModel["msg"].ToString());
                            return;
                        }
                        else
                        {
                            untCommon.InfoMsg("人脸识别回调设置成功!");
                        }
                    }
                }
            }
        }
Exemple #2
0
        private void loadData()
        {
            try
            {
                MesDeviceBLL MesDeviceBLL = new MesDeviceBLL();
                var          rows         = MesDeviceBLL.GetList();

                if (rows == null || rows.Count < 1)
                {
                    untCommon.InfoMsg("没有任何设备信息数据!");
                    dataGridView.DataSource = rows;
                    return;
                }
                dataGridView.DataSource = rows;
                for (int i = 0; i < rows.Count; i++)
                {
                    string url = "http://" + rows[i].D_IP + ":8090/getDeviceKey";

                    string postData = "";

                    string strtemp = FaceRecognition.Port(url, postData);

                    if (FaceRecognition.json(strtemp))
                    {
                        JObject joModel = (JObject)JsonConvert.DeserializeObject(strtemp);
                        string  strData;
                        if (bool.Parse(joModel["success"].ToString()))
                        {
                            strData = joModel["result"].ToString();
                        }
                        else
                        {
                            strData = joModel["msg"].ToString();
                        }
                        if (strData == "1")
                        {
                            this.dataGridView.Rows[i].Cells["设备状态"].Value = "在线";
                        }
                        else
                        {
                            this.dataGridView.Rows[i].Cells["设备状态"].Value = "离线";
                        }
                    }
                    else
                    {
                        //untCommon.InfoMsg("该IP地址不可用!");
                        this.dataGridView.Rows[i].Cells["设备状态"].Value = "离线";
                    }
                }
            }
            catch (Exception ex)
            {
                untCommon.ErrorMsg("设备信息加载数据异常:" + ex.Message);
            }
        }