void bw_DoWork(object sender, DoWorkEventArgs e) { string ip = e.Argument as string; var formDatas = new List <FormItemModel>(); // 文件名 formDatas.Add(new FormItemModel() { Key = "", Value = "", }); try { //提交表单 var result = FormPost.PostForm("http://" + ip + ":9300/config", null); //cameraInfo.IP = ip.Text; CameraResponse cr = JsonHelper.FromJSON <CameraResponse>(result); Console.WriteLine(result); LogHelper.WriteLog(result); e.Result = cr; } catch (Exception) { e.Result = null; } }
private bool UpdateCameraFW(string file_name, string update_fpath) { if (ci.state == CamContectingState.ONLINE) { var formDatas = new List <FormItemModel>(); // 文件名 formDatas.Add(new FormItemModel() { Key = "File", Value = "", FileName = file_name, FileContent = File.OpenRead(update_fpath) }); try { //提交表单 var result = FormPost.PostForm("http://" + ci.IP + ":9301/Update", formDatas); //cameraInfo.IP = ip.Text; } catch (Exception) { return(false); } } else { return(false); } return(true); }
private static void PostToHW(object j, object i) { string ip = i as string; string json = j as string; var formDatas = new List <FormItemModel>(); //添加文本 formDatas.Add(new FormItemModel() { Key = "BlackCell-Position", Value = json // "id-test-id-test-id-test-id-test-id-test-" }); //提交表单 try { AIThermometerAPP.Instance().blackcell_pos_error = true; var result = FormPost.PostForm("http://" + ip + ":9300/config", formDatas); AIThermometerAPP.Instance().ResetBlackCell(); } catch (Exception ex) { LogHelper.WriteLog("post to hw error", ex); } }
private static void PostToHW(object j, object i) { string ip = i as string; var formDatas = j as List <FormItemModel>; //提交表单 try { var result = FormPost.PostForm("http://" + ip + ":9300/config", formDatas); } catch (Exception ex) { LogHelper.WriteLog("update camera error", ex); } }
private void okButton_Click(object sender, RoutedEventArgs e) { if (!isFileUpgrade) { var sm = versionCombo.SelectedValue as string; var formDatas = new List <FormItemModel>(); // 温度系数 formDatas.Add(new FormItemModel() { Key = "Patch", Value = sm // "id-test-id-test-id-test-id-test-id-test-" }); var result = FormPost.PostForm("http://" + ci.IP + ":9301/Patch/apply", formDatas); DialogResult = true; } else { DialogResult = true; } }