在另一个线程中运行表单 [英] Run a form in another thread

查看:122
本文介绍了在另一个线程中运行表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的c#项目中有五种形式。一个主机是一个httplistener,我想持续运行。当侦听器得到消息时,它将它传递给一个静态类,然后调用适当的表单进行另一个处理。

i have five forms in my c# project. one host an httplistener that i want to run continionsly. when the listener gets a message, it passes it to a static class, which in turn calls the appropriate forms for another processing.

有可能静态类调用新线程中的新形式?如果是这样,请帮我解决

is it possible that the static class calls the new form in a new thread? if so please help me out

推荐答案

表单中的代码应该只处理表单的视觉方面。其他任何东西,尤其是http侦听器,都应该使用在后台线程上运行的独立类来处理。

The code in the forms should only deal with the visual aspects of the form. Anything else,especially http listeners, should be handled with separate classes running on background threads.

这篇关于在另一个线程中运行表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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