filehelpers 3.0.39中的SqlServerStorage

时间:2015-01-28 18:42:34

标签: c# filehelpers

我使用Filehelpers 2.0和SetProgressHandler来显示进度。现在我想更改为Filehelpers 3.0.39,但我不能使用SetProgressHandler,因为它不再存在。我怎样才能显示进度??? 我在2.0版中的代码是:

SqlServerStorage storage = new SqlServerStorage(typeof(ExportarNuevasEmpresas));
....
storage.SetProgressHandler(new ProgressChangeHandler(ProgressChangeEx));

private void ProgressChangeEx(ProgressEventArgs e)     
{
    xpProgressBar1.Position = e.ProgressCurrent;
    xpProgressBar1.Text = "Registro " + e.ProgressCurrent.ToString();
    Application.DoEvents();
}

提前感谢您的帮助。

玛利亚

1 个答案:

答案 0 :(得分:2)

试试这个:

SqlServerStorage storage = new SqlServerStorage(typeof(ExportarNuevasEmpresas));
//....
storage.Progress += storage_Progress;

private void storage_Progress(object sender, ProgressEventArgs e)
{
    xpProgressBar1.Position = e.Percent;
    xpProgressBar1.Text = "Registro " + e.Percent.ToString();
    Application.DoEvents();
}