|
@@ -30,7 +30,7 @@ namespace XdCxRhDW.App.CorTools
|
|
|
{
|
|
|
static readonly string inifile = Path.Combine(Application.StartupPath, "par.ini");
|
|
|
volatile bool beRunning = false;
|
|
|
- private string uploadUrL;
|
|
|
+ private string uploadUrL;
|
|
|
BindingList<CafResult> gridSource = new BindingList<CafResult>();
|
|
|
|
|
|
public DetectToolForm()
|
|
@@ -288,9 +288,9 @@ namespace XdCxRhDW.App.CorTools
|
|
|
xItem.snrThreshold = int.Parse(teSnr.Text);
|
|
|
|
|
|
}
|
|
|
- catch
|
|
|
+ catch (Exception ex)
|
|
|
{
|
|
|
- DxHelper.MsgBoxHelper.ShowError($"参数错误");
|
|
|
+ DxHelper.MsgBoxHelper.ShowError($"参数错误{ex.Message}");
|
|
|
return;
|
|
|
}
|
|
|
if (lciStartPos.Visibility == LayoutVisibility.Never)
|
|
@@ -320,7 +320,7 @@ namespace XdCxRhDW.App.CorTools
|
|
|
|
|
|
var content = new StringContent(JsonConvert.SerializeObject(xcitem), System.Text.Encoding.UTF8, "application/json");
|
|
|
var result = PostRequest<CafResult>(uploadUri, content);
|
|
|
- // var result = await ExecuteCorAsync(xcitem);
|
|
|
+ // var result = await ExecuteCorAsync(xcitem);
|
|
|
if (result != null)
|
|
|
{
|
|
|
//var smitemindex = gridSource.FindIndex(m => m.smpstart == xcitem.smpStart && m.smplen == xcitem.smpCount);
|
|
@@ -350,27 +350,26 @@ namespace XdCxRhDW.App.CorTools
|
|
|
private string UpLoadFile(string filePath)
|
|
|
{
|
|
|
string file = string.Empty;
|
|
|
- // 构建上传请求的 Uri
|
|
|
- string uploadUri =$"{uploadUrL}/UploadFile";
|
|
|
|
|
|
- // 添加文件内容到 MultipartFormDataContent
|
|
|
- byte[] fileBytes = File.ReadAllBytes(filePath);
|
|
|
-
|
|
|
- // 创建 MultipartFormDataContent 用于封装文件内容
|
|
|
- MultipartFormDataContent content = new MultipartFormDataContent();
|
|
|
- ByteArrayContent fileContent = new ByteArrayContent(fileBytes);
|
|
|
- content.Add(fileContent, "file", Path.GetFileName(filePath));
|
|
|
+ // 构建上传请求的 Uri
|
|
|
+ string uploadUri = $"{uploadUrL}/UploadFile";
|
|
|
try
|
|
|
{
|
|
|
+ // 添加文件内容到 MultipartFormDataContent
|
|
|
+ byte[] fileBytes = File.ReadAllBytes(filePath);
|
|
|
+
|
|
|
+ // 创建 MultipartFormDataContent 用于封装文件内容
|
|
|
+ MultipartFormDataContent content = new MultipartFormDataContent();
|
|
|
+ ByteArrayContent fileContent = new ByteArrayContent(fileBytes);
|
|
|
+ content.Add(fileContent, "file", Path.GetFileName(filePath));
|
|
|
+
|
|
|
// 发送上传请求
|
|
|
- file = PostRequest<string>(uploadUri, content);
|
|
|
+ file = PostRequest<string>(uploadUri, content);
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
throw new Exception($"上传文件{filePath}到{uploadUri}失败!");
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
return file;
|
|
|
}
|
|
|
private async Task<CafResult> ExecuteCorAsync(XcorrStruct xItem)
|