微信导入数据 页面卡死Bug
This commit is contained in:
1 parent
bbcc45625c
commit
423fb3d4f3
1 file changed
+16
-2
@@ -1205,7 +1205,7 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
bool isCollectAuthorityUser = true;
|
||||
Get1688ProductForm.Out1688ProductImport(isCollectAuthorityUser, this.statusBar, this.pbLoading, OutProdSaveDbCallBack);
|
||||
}
|
||||
private void bt_import_wx_Click(object sender, EventArgs e)
|
||||
private async void bt_import_wx_Click(object sender, EventArgs e)
|
||||
{
|
||||
OpenFileDialog openFileDialog = new OpenFileDialog();
|
||||
openFileDialog.Multiselect = true;
|
||||
@@ -1214,11 +1214,16 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
// 显示对话框并获取结果
|
||||
if (openFileDialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
try
|
||||
{
|
||||
btn_import_wx.Enabled = false;
|
||||
var filePathLst = openFileDialog.FileNames.ToList();
|
||||
int successNum = 0;
|
||||
int failedNum = 0;
|
||||
var pddtoWxFactory = new PDDProdFormConverter();
|
||||
|
||||
await Task.Run(() =>
|
||||
{
|
||||
foreach (var filePath in filePathLst)
|
||||
{
|
||||
string sourceContent = "";
|
||||
@@ -1244,15 +1249,24 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
this.statusBar.lblTaskStatus.Text = "正在导入,尝试导入" + (successNum + failedNum) + ",成功" + successNum + ",失败" + failedNum;
|
||||
}));
|
||||
}
|
||||
|
||||
});
|
||||
SearchDbProd(1, " 导入完成,尝试导入" + (successNum + failedNum) + ",成功" + successNum + ",失败" + failedNum);
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
btn_import_wx.Enabled = true;
|
||||
pbLoading.Visible = false;
|
||||
this.statusBar.lblTaskStatus.Text = "导入完成,尝试导入" + (successNum + failedNum) + ",成功" + successNum + ",失败" + failedNum;
|
||||
BaseMsgForm.ShowInfo("导入完成!");
|
||||
}));
|
||||
}
|
||||
finally
|
||||
{
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
btn_import_wx.Enabled = true;
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user