BackgroundWorker的在C# [英] Backgroundworker in C#

查看:174
本文介绍了BackgroundWorker的在C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

其实,我需要提示加载图像throwugh backgrounderworker,每当一个特定的功能在这里被调用
是我的代码:

Actually, i need to prompt a loading image throwugh backgrounderworker, whenever a particular function is been invoked here is my code :

 private void bgwFile_DoWork(object sender, DoWorkEventArgs e)
 {
        FormFieldsLoad();      
 }

private void bgwFile_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
    if (e.Cancelled == true)
    {
        Status.Text = "cancelled";
    }
    else if (e.Error != null)
    {
    }

    picprocess.SendToBack(); 
    Status.Text = "Completed";         
}

 //Below Method where i have called RunWorkerAsync()
private void buttonUpload_Click(object sender, EventArgs e)
{
    LoadFile(pdfFullPath, txtPassword.Text);
    form = document.getDocumentCatalog().getAcroForm();
    java.util.List FieldTypes = form.getFields();
    availableFieldsTable.Clear();
    btnLoad.Enabled = false;     
    Status.Text = "Document loaded successfully!!!";

    picprocess.BringToFront();  
    bgwFile.RunWorkerAsync();
}



在运行上面的代码,它调用加载图片,但没有输出被显示它不断显示加载图片..它不叫了 RunWorkerCompleted

任何一个可以帮助我出PLS

Can any one help me out pls

感谢

推荐答案

你分配事件处理程序?

Did you assign the event handlers?

bwgFile.DoWork += bgwFile_DoWork;
bwgFile.RunWorkerCompleted += bgwFile_RunWorkerCompleted;

您确定 FormFieldsLoad 终止?

这篇关于BackgroundWorker的在C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆