如何结束关闭整个应用程序在C#.NET后处理?应用程序、后处理、结束、NET

2023-09-04 22:54:37 作者:囍遇伱

我有一个.NET 2005(C#)桌面应用程序,其中有一个登录表单和一个MDI窗体,然后有多个子表单。所有其他形式只在MDI的形式打开。

I have a .NET 2005 (C#) desktop application, in which there is a login form and an MDI form, which then have multiple subforms. All other forms are opened in MDI form only.

在用户登录时,我隐藏登录表单,然后显示MDI窗体,但在关闭MDI窗体,我的申请过程并没有结束,因为登录表单仍有隐忧。我想,当用户关闭MDI窗体,整个应用程序应该关闭(基本上,这个过程不应该在任务管理器中显示),因为如果每次用户关闭并重新打开应用程序和登录,它会创建一些性能问题。

After a user logs in, I hide the login form and then show the MDI form, but when I close the MDI form, my application process does not end because the login form is still hidden. I want that, when the user closes the MDI form, the whole application should close (essentially, the process should not be shown in the task manager), because if everytime the user closes and reopens the application and logs in, it will create some performance problem.

我在做类似如下:

//my login validation script,

//after successful login

this.Hide();

if (globalData.ObjMdiMain.IsDisposed)
{
    globalData.ObjMdiMain = new mdiMain();
}
globalData.ObjMdiMain.Show();

全球国际是我的,我创建所需要的整个应用程序的全局对象的静态类。在那里,我已经定义了我的MDI形式 ObjMdiMain 对象,我在这里访问它的登录表单。

globalData is my static class where I create global objects which are required by the whole application. There, I have defined the ObjMdiMain object of my MDI form and I am accessing it here in the login form.

那么,有没有任何方法或函数,它将结束,从系统的整个过程,像Application.End();还是其他什么东西?

So, is there any method or function which will end the whole process from system, something like "Application.End();" or something else?

谢谢!

推荐答案

这似乎是一个MySQL的.NET连接器的bug,因为我采用的是MySQL .NET连接器的DLL连接到我的MySQL数据库。我已经看到了一些其他的抱怨这一点。看到 http://bugs.mysql.com/bug.php?id=36688

It seems a MySql .net connector bug, because I was using mysql .net connector DLL to connect to my mysql db. I have seen some other complains about it too. See http://bugs.mysql.com/bug.php?id=36688

我使用的5.1版的MySQL .NET连接器的DLL,我刚才已经升级到6.1(最新)和它工作正常,没有任何错误。

I was using MySQL .net connector DLL of version 5.1, I have just upgraded to 6.1 (latest) and its working fine without any error.

在这里下载最新的DLL: http://dev.mysql.com/下载/连接器/ NET / 6.1.html

Download the latest DLL here: http://dev.mysql.com/downloads/connector/net/6.1.html

感谢