日期:2014-05-18  浏览次数:20762 次

Winform单线程窗体假死问题紧急求救!
我winform   里面有个方法
public   void   UserState()
{
string   filepath=this.textBox1.Text.Trim();
string   path;
if   (filepath.Substring(filepath.Length-1,1)!=@ "\ ")
path=filepath+@ "\UserRegion ";
else
path=filepath+@ "UserRegion ";      
Directory.CreateDirectory(path);         //创建“用户管理”文件夹

DataTable   dt=getUser();

string   m1= " ";
string   m2= " ";
string   m3= " ";
string   m4= " ";
//string   restr= " ";
DrawChart   ch=new   DrawChart();
for(int   i=0;i <dt.Rows.Count;i++)
{
string   fullpath=path+@ "\ "+dt.Rows[i][ "用户名 "].ToString();
Directory.CreateDirectory(fullpath);         //创建“用户管理--用户”文件夹

Directory.CreateDirectory(fullpath+@ "\in ");     //创建“用户管理--用户---in”文件夹
Directory.CreateDirectory(fullpath+@ "\out ");   //创建“用户管理--用户---out”文件夹

string   hs_in=dt.Rows[i][ "进口过货物的HS编码 "].ToString();
string   hs_out=dt.Rows[i][ "出口过货物的HS编码 "].ToString();

string   com_name= "深圳市奇鼎实业有限公司 ";
#region   进口
if   (hs_in!= " ")
{
string   []   s_in=hs_in.Split( '$ ');
for(int   j=0;j <s_in.Length;j++)
{
string   hs1=s_in[j].ToString();
Directory.CreateDirectory(fullpath+@ "\in\ "+hs1+ " ");
m1=fullpath+@ "\in\ "+hs1+ " "+@ "\Month1 ";
m2=fullpath+@ "\in\ "+hs1+ " "+@ "\Month3 ";
m3=fullpath+@ "\in\ "+hs1+ " "+@ "\Month6 ";
m4=fullpath+@ "\in\ "+hs1+ " "+@ "\Month12 ";

Directory.CreateDirectory(m1);         //创建“用户管理--用户---in---hs编码---Month1”文件夹
Directory.CreateDirectory(m2);       //创建“用户管理--用户---in---hs编码---Month3”文件夹
Directory.CreateDirectory(m3);     //创建“用户管理--用户---in---hs编码---Month6”文件夹
Directory.CreateDirectory(m4);   //创建“用户管理--用户---in---hs编码---Month12”文件夹

label1.Text= "正在处理的用户是: "+dt.Rows[i][ "用户名 "]+ "\n处理1个月用户进口过的HS编码是: "   +s_in[j].ToString()+ "\n ";
//调用生成图片
string   saveurl1=fullpath+@ "\in\ "+hs1+ " "+@ "\Month1\ ";
ch.DrawChartIn(hs1,1,c1Chart1,saveurl1,com_name);

this.label1.Text= "正在处理的用户是: "+dt.Rows[i][ "用户名 "]+ "\n处理3个月用户进口过的HS编码是: "   +s_in[j].ToString()+ "\n ";
//调用生成图片
string   saveurl2=fullpath+@ "\in\ "+hs1+ " "+@ "\Month3\ ";
ch.DrawChartIn(hs1,2,c1Chart1,saveurl2,com_name);


label1.Text= "正在处理的用户是: "+dt.Rows[i][ "用户名 "]+ "\n处理6个月用户进口过的HS编码是: "   +s_in[j].ToString()+ "\n ";
//调用生成图片
string   saveurl3=fullpath+@ "\in\ "+hs1+ " "+@ "\Month6\ ";
ch.DrawChartIn(hs1,3,c1Chart1,saveurl3,com_name);


label1.Text= "正在处理的用户是: "+dt.Rows[i][ "用户名 "]+ "\n处理12个月用户进口过的HS编码是: "   +s_in[j].ToString()+ "\n ";
//调用生成图