浏览UI表单时,Backgroundworker和线程无法正常工作 [英] Backgroundworker and thread doesnt work well when browsing the UI form

查看:48
本文介绍了浏览UI表单时,Backgroundworker和线程无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿.

我得到了一个大程序,该程序在主循环中运行,并调用不同功能的地狱.它确实包括下载网页等.现在的问题是,在加载网站时,用户无法单击该程序的其余部分,因为它在工作时正在冻结".

现在,我重写了整个程序,以便可以通过backgroundthread阅读/设置文本框等,
但是问题来了.

如果程序等加载了一个站点,而我在加载该站点的同时开始单击该程序,则它并没有完全完成该功能,因此该站点也没有完全加载.
还是有办法避免这种情况吗?

解决方案

不是一个词.

您可以通过修改代码来避免这种情况.您应该有一个后台线程加载该网站,该线程将继续进行直到完成.如果您的代码阻止了此操作,那么您需要对其进行修复,而我们却无法告诉您如何才能看到代码.


我不是来自英语国家,我是抱歉!

我会看看我是否可以那样做.但是,如果我只是把注意力从应用程序上移开,它仍然会停止进程(等停止加载主页),这仍然很奇怪.

Hey.

I got a kind of big program, that runs in a main loop and call a hell of different functions. It does include downloading webpages, and such. Problem is as it is right now the user dont have the possibility to click around the rest of the program while it is loading a site, since it is doing the "freezing" while its working.

Now I have rewrote the whole program so I can read/set textboxes etc through a backgroundthread,
but here the problems comes.

If the program etc. loads a site, and I start click around the program while it is loading the site, it aint finishing the function completely, so the site aint loaded completely.
Aint there anyway I can avoid this?

解决方案

ain''t is not a word.

You can avoid it by fixing your code. You should have a background thread loading the site, which continues until it is done. If your code is stopping that, then you need to fix it, and we can''t tell you how without seeing code.


And I am not from a english speaking country, I am sorry for that!

I will see if I can do it that way. But it is still strange it stops the process (etc stops loading the homepage) if I just take away the focus from the application.


这篇关于浏览UI表单时,Backgroundworker和线程无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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