// 委托
public delegate void ShowProgressBar(long total, long current);
// 事件
public event ShowProgressBar showProgressBar;
void Show_ProgressBar(long total, long current)
{
if (this.InvokeRequired)
{
this.Invoke(new ShowProgressBar(Show_ProgressBar), new object[] { total, current });
}
else
{
this.progressBarImport.Maximum = (int)total;
this.progressBarImport.Value = (int)current;
}
}
public void ImportStart()
{
this.showProgressBar = new ShowProgressBar(Show_ProgressBar);
//buttonImport.Enabled = false;
try
{
sqlDB.Open();
oracleDB.Open();
ArrayList al = sqlDB.getDataBaseTables();
for (int i = 0; i < al.Count; i++)
{
showProgressBar(al.Count, i);
InsertDataTableToTable(al[i].ToString());
}
Thread.CurrentThread.Abort();
}
finally
{
sqlDB.Close();
oracleDB.Close();
}
//buttonImport.Enabled = true;
}