日期:2014-05-18 浏览次数:20875 次
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Form logo = new logo();
//判断程序配置文件是否存在,如不存在则打开服务器设置窗口,如存在则判断是否可以连接到数据库服务器
fun.Ini.path = System.IO.Directory.GetCurrentDirectory() + "\\config.ini";
if (fun.Ini.IniReadValue("Assistant", "server").Trim() == "" | fun.Ini.IniReadValue("Assistant", "database").Trim() == "" | fun.Ini.IniReadValue("Assistant", "user").Trim() == "" | fun.Ini.IniReadValue("Assistant", "password").Trim() == "")
{
module.setServer s = new module.setServer();
s.ShowDialog();
if (s.DialogResult == DialogResult.OK)
{
//启动登录窗口
logo.Show();
Application.Run();
}
}
else
{
if (fun.pub.ConnBool(fun.Ini.IniReadValue("Assistant", "server").Trim(), fun.Ini.IniReadValue("Assistant", "database").Trim(), fun.MySecurity.SDecryptString(fun.Ini.IniReadValue("Assistant", "user"), ""), fun.MySecurity.SDecryptString(fun.Ini.IniReadValue("Assistant", "password"), "")) == false)
{
if (System.Windows.Forms.MessageBox.Show("不能连接到服务器" + fun.Ini.IniReadValue("Assistant", "server").Trim() + ",或该服务器中未包含程序所需的数据库,\n请检查网络连接或重新设置服务器!\n现在要重设服务器吗?", "错误", System.Windows.Forms.MessageBoxButtons.OKCancel, System.Windows.Forms.MessageBoxIcon.Stop) == DialogResult.OK)
{