If the system does not set the main program, the system startup form is set up wrong, it is easy to clean and can not lead to a clean exit from memory when you exit the system, and even will encounter some unnecessary problems in compiler development, for example, has been in memory occupancy, etc., have to withdraw from the development environment would be re-compiled debug the problem.
Recently the main system re-adjusted, repeated tests have confirmed that the problem can not be corrected a clean exit from the memory, the heart Lishu Tan lot.
The main program set in the configuration file, set the reference login program.
< add key = " LogOnAssembly " value = " DotNet.WinForm.LogOn " />
< add key = " LogOnForm " value = " FrmLogOn " />
< add key = " MainForm " value = " SDIMainForm " />
Project reference is shown below
The main code is as follows
{
Form logOnForm = CacheManager.Instance.GetForm(BaseSystemInfo.LogOnAssembly, BaseSystemInfo.LogOnForm);
logOnForm.ShowDialog( this );
}
Event Log button to invoke the reference section of the main form
{
Form mainForm = this .Owner;
((IBaseMainForm)mainForm).InitService();
((IBaseMainForm)mainForm).InitForm();
mainForm.Show();
}
The following is a login form part of the interface definition
// All Rights Reserved, Copyright (C) 2010, Jirisoft, Ltd.
// -------------------- ---------------------------------------- the using the System; namespace DotNet.WinForm.Utilities { /// <the Summary> /// IBaseMainForm /// Interface main window /// /// modify records /// /// 2008.10.29 version: 1.1 JiRiGaLa renamed. /// 2008.05.04 Version: 1.0 JiRiGaLa created. /// /// Version: 1.0 /// /// <author> /// <name> JiRiGaLa
</ name> /// <DATE> 2008.05.04 </ DATE> /// </ author> /// </ Summary> public interface IBaseMainForm { /// <Summary> /// initialization Form /// </ Summary> void initForm (); /// <Summary> /// initiated service /// </ Summary> void InitService (); /// <Summary> /// check menu /// </ Summary> void CheckMenu (); } }
Reproduced in: https: //my.oschina.net/iwenr/blog/227737