private static void readMode() { if (File.Exists(configFilePath)) { ReadINI RI = new ReadINI(configFilePath); try { String tempStr = RI.GetValue("WindowData", "ExplorerMode"); if (tempStr == null || tempStr == "") { MessageBox.Show("缺少BaseUrl配置项!"); return; } // return explorerMode; if (tempStr == ExplorerMode.winMenu.ToString()) { explorerMode = ExplorerMode.winMenu; } else if (tempStr == ExplorerMode.winWeb.ToString()) { explorerMode = ExplorerMode.winWeb; } else { explorerMode = ExplorerMode.nodata; } } catch { MessageBox.Show("读取Config.ini文件错误!"); return; } try { contentMode = RI.GetValue("[WindowData]", "ContentMode"); if (contentMode == null || contentMode == "") { contentMode = "IE"; return; } // return explorerMode; } catch { // MessageBox.Show("读取Config.ini文件错误!"); return; } } else { MessageBox.Show("找不到Config.ini文件!"); return; } }
protected void setAutoStart() { if (File.Exists(Program.configFilePath)) { try { ReadINI RI = new ReadINI(Program.configFilePath); bool isAutoStart = Convert.ToBoolean(RI.GetValue("WindowData", "AutoStart")); if (isAutoStart) { Program.setAutoStart(); } else { Program.setNoAutoStart(); } } catch { Program.setAutoStart(); } } else { } }
public virtual String getConfig(string node, string key) { String tempStr = ""; if (File.Exists(Program.configFilePath)) { ReadINI RI = new ReadINI(Program.configFilePath); try { tempStr = RI.GetValue(node, key); } catch { MessageBox.Show("读取Config.ini文件错误!"); } } else { MessageBox.Show("找不到Config.ini文件!"); } return(tempStr); }
protected void mainFormLoad() { // string str1 = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName; //在应用程序选项卡中点击程序集信息,然后勾选“使程序集COM可见”。 // setIEcomp(); openWebFormDelegate = new openWebForm(this.openWebForm); if (File.Exists(Program.configFilePath)) { ReadINI RI = new ReadINI(Program.configFilePath); try { mainUrl = RI.GetValue("Basic", "BaseUrl"); if (mainUrl == null || mainUrl == "") { MessageBox.Show(Program.getMyTextClassByIndex(1)); this.Close(); } } catch { MessageBox.Show(Program.getMyTextClassByIndex(2)); this.Close(); } /* * try * { * mainTitleName = RI.GetValue("WindowData", "TitleName"); * * if (mainTitleName == null || mainTitleName == "") * { * mainTitleName = " "; * } * } * catch * { * }*/ try { webErrHtml = RI.GetValue("WindowData", "WebErrHtml"); if (webErrHtml == null || webErrHtml == "") { webErrHtml = Application.StartupPath + @"\html-cs\CS-error.html"; } else { webErrHtml = Application.StartupPath + webErrHtml; } } catch { } try { menuErrHtml = RI.GetValue("WindowData", "MenuErrHtml"); if (menuErrHtml == null || menuErrHtml == "") { menuErrHtml = Application.StartupPath + @"\html-cs\CS-menu-error.html"; } else { menuErrHtml = Application.StartupPath + menuErrHtml; } } catch { } try { webTimeOutMillisecond = Convert.ToInt32(RI.GetValue("WindowData", "WebTimeOutMillisecond")); } catch { } try { menuTimeOutMillisecond = Convert.ToInt32(RI.GetValue("WindowData", "MenuTimeOutMillisecond")); } catch { } } else { MessageBox.Show(Program.getMyTextClassByIndex(3)); this.Close(); } setAutoStart(); // this.Location = new Point(0 - this.Width, 0 - this.Height); // this.Hide(); if (isTest) { this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Sizable; } }