C#表单应用程序保持冻结[请帮助!] [英] c# forms application keeps freezing [Please help!]

查看:93
本文介绍了C#表单应用程序保持冻结[请帮助!]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿,所以要用足够多的信息来保持简短和甜美.

Hey there so going to keep this short and sweet with hopfully enough information.

因此,我创建了一个C#表单应用程序,并且拥有我的Mainframe(form1),Variables类(类文件)和WallsESP(类文件).

So i have created a C# forms application and I have my Mainframe(form1), Variables class(class file) and my WallsESP(class file).

我正在尝试让我的应用程序在WallsESP类内运行Public void enableWalls,而不会冻结应用程序.

I'm trying to get my application to run a Public void enableWalls inside the WallsESP class without the application freezing.

就像一旦运行代码,大型机表单应用程序将变得不可用.有没有办法解决这个问题,这样我就可以在使能enableWall void的同时继续使用表单应用程序?

It's like once it runs the code the mainframe forms application becomes unusable. is there a way around this so i can continue to use the forms application while having this enableWall void running?

enableWalls void工作原理只会冻结应用程序的其余部分.

The enableWalls void works it just freezes the rest of the application up.

希望有人可以帮助我!

Hopefully, someone can help me!

预先感谢!

推荐答案

"Public void enableWalls"中的代码可能是耗时的代码,导致主窗体的UI冻结或挂起.

The code within "Public void enableWalls" may be time consuming code causing the UI of the main form to freeze or hang.

不知道"Public void enableWalls"内部的代码是什么,很难提供解决方案吗?

Without knowing what the code inside "Public void enableWalls" does it is difficult to provide a solution.

一种可能性是在"Public void enableWalls"内部运行代码.如果可能的话,在一个单独的线程中.但同样,在没有看到代码或不了解任何代码的情况下,该方向可能无效.

One possibility would be to run the code inside "Public void enableWalls" in a separate thread if that would be possible. But again without seeing the code or knowing anything about the code that direction may not be valid.

例如,如果您在记事本中键入帖子信息,然后将其复制并粘贴到没有标签显示的帖子中,则是可能的.

It's possible if you type your posts information in Notepad for example then copy that and paste it into a post that no tags will appear.


这篇关于C#表单应用程序保持冻结[请帮助!]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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