private void InitPage3() { //初始化菜单 int count = int.Parse(ini.IniReadValue("webapp", "webcount", "5"));//默认5个系统 int gIndex = 1; while (gIndex <= count) { ScSystem si = null; if (gIndex <= 5) { si = ScSystem.GetScSystem(ini.IniReadValue("webapp", "weburl" + gIndex, ConfigureHelper.getDfltUrl(gIndex.ToString()))); } else { si = ScSystem.GetScSystem(ini.IniReadValue("webapp", "weburl" + gIndex, "")); } if (si != null) { sysList.Add(si); } gIndex++; } InitMenu(sysList); }
private void FillDataRow(ScSystem pSys) { DataGridViewRow row = new DataGridViewRow(); DataGridViewCheckBoxCell cbcell = new DataGridViewCheckBoxCell(); cbcell.Value = pSys.Deflt == "Y" ? true : false; row.Cells.Add(cbcell); DataGridViewTextBoxCell tbnmcell = new DataGridViewTextBoxCell(); tbnmcell.Value = pSys.Name; row.Cells.Add(tbnmcell); DataGridViewTextBoxCell tburlcell = new DataGridViewTextBoxCell(); tburlcell.Value = pSys.Url; row.Cells.Add(tburlcell); DataGridViewComboBoxCell comboxcell = new DataGridViewComboBoxCell(); comboxcell.Items.Add("IE7"); comboxcell.Items.Add("IE8"); comboxcell.Items.Add("IE9"); comboxcell.Items.Add("IE10"); comboxcell.Items.Add("IE11"); comboxcell.Items.Add("Chrome"); comboxcell.Value = string.IsNullOrEmpty(pSys.Viewmodel) ? "IE7" : pSys.Viewmodel; row.Cells.Add(comboxcell); row.Tag = pSys; dgv_sys.Rows.Add(row); }
private void FillData(ScSystem pSys) { dgv_sys.Rows.Clear(); foreach (ScSystem sys in sysList) { if (sys.Pid == pSys.Id || sys.Id == pSys.Id) { FillDataRow(sys); } } }
void tsmisub_Click(object sender, EventArgs e) { ToolStripMenuItem tsmi = sender as ToolStripMenuItem; ScSystem ss = tsmi.Tag as ScSystem; if (ss.Url.Substring(1, 1) == ":") { OpenLocalExe(ss.Url); } else { opeWeb(ss.Url, ss.Viewmodel); } }
private void updateListOrderSub(string pId, TreeNode nodes) { foreach (TreeNode node in nodes.Nodes) { ScSystem ss = node.Tag as ScSystem; ss.Id = nodeindex.ToString(); ss.Pid = pId; sysList.Add(ss); if (node.Nodes.Count > 0) { updateListOrderSub(ss.Id, node); } nodeindex++; } }
/// <summary> /// 更新节点排序 /// </summary> private void updateListOrder() { sysList = new List <ScSystem>(); nodeindex = 1; foreach (TreeNode node in tv_fav.Nodes[0].Nodes) { ScSystem ss = node.Tag as ScSystem; ss.Id = nodeindex.ToString(); ss.Pid = "0"; sysList.Add(ss); if (node.Nodes.Count > 0) { updateListOrderSub(ss.Id, node); } nodeindex++; } }
private void updateList(int rowindex, int colindex) { DataGridViewRow row = dgv_sys.Rows[rowindex]; ScSystem ssy = row.Tag as ScSystem; foreach (ScSystem ss in sysList) { if (ss.Id == ssy.Id) { ss.Deflt = bool.Parse(row.Cells[0].Value.ToString()) ? "Y" : "N"; ss.Name = (row.Cells[1].Value == null) ? "" : row.Cells[1].Value.ToString(); ss.Url = (row.Cells[2].Value == null)?"":row.Cells[2].Value.ToString(); ss.Viewmodel = (row.Cells[3].Value == null) ? "" : row.Cells[3].Value.ToString(); break; } } }
private void FillDir() { conf = ConfigureHelper.getInitConfigure(); cmb_updir.Items.Add("--上级目录--"); List <ScSystem> upDirDs = new List <ScSystem>(); ScSystem ssBlank = new ScSystem(); ssBlank.Name = ""; upDirDs.Add(ssBlank); foreach (ScSystem ss in conf.SysList) { if (ss.Pid == "0") { upDirDs.Add(ss); } } cmb_updir.DataSource = upDirDs; cmb_updir.DisplayMember = "Name"; cmb_updir.ValueMember = "Id"; cmb_updir.SelectedIndex = 0; }
private void btnSave_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(tb_name.Text.Trim())) { MessageBox.Show("网页名称不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } scs = new ScSystem(); scs.Deflt = cb_deflt.Checked ? "Y" : "N"; if (cb_deflt.Checked) { foreach (ScSystem ss in conf.SysList) { ss.Deflt = "N"; } } scs.Name = tb_name.Text.Trim(); scs.Url = tb_address.Text.Trim(); List <ScSystem> ssList = new List <ScSystem>(); if (cmb_updir.SelectedIndex == 0) { scs.Id = Convert.ToString(conf.SysList.Count + 1); scs.Pid = "0"; conf.SysList.Add(scs); ssList = conf.SysList; } else { string selPid = (cmb_updir.SelectedItem as ScSystem).Id; bool sFlag = false; int sysIndex = 1; for (int i = 0; i < conf.SysList.Count;) { if (conf.SysList[i].Id == selPid) { sFlag = true; conf.SysList[i].Id = Convert.ToString(sysIndex++); ssList.Add(conf.SysList[i]); if (i == conf.SysList.Count - 1) { scs.Id = Convert.ToString(sysIndex++); scs.Pid = ssList[ssList.Count - 1].Id; ssList.Add(scs); } } else if (sFlag && ((i + 1) >= conf.SysList.Count ? "-1" : conf.SysList[i + 1].Id) != selPid) { scs.Id = Convert.ToString(sysIndex++); scs.Pid = ssList[ssList.Count - 1].Id; ssList.Add(scs); conf.SysList[i].Id = Convert.ToString(sysIndex++); ssList.Add(conf.SysList[i]); sFlag = false; } else { conf.SysList[i].Id = Convert.ToString(sysIndex++); ssList.Add(conf.SysList[i]); } i++; } } //重置ID ConfigureHelper.SaveWebapp(ssList); MessageBox.Show("保存成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); this.DialogResult = DialogResult.OK; }
/// <summary> /// 获取系统初始化时的系统配置 /// </summary> /// <returns></returns> public static Configure getInitConfigure() { Configure conf = new Configure(); string sectionName = "window"; string file = System.AppDomain.CurrentDomain.BaseDirectory + "application.ini"; IniFileHelper ini = new IniFileHelper(file); conf.Main = ini.IniReadValue(sectionName, "main", "about:blank"); try { #region 默认窗体配配置 WindowSetting windowConf = new WindowSetting(); windowConf.Title = ini.IniReadValue(sectionName, "title", "杭州圣辰网络科技有限公司"); windowConf.Fixtitle = bool.Parse(ini.IniReadValue(sectionName, "fixtitle", "false")); windowConf.Width = int.Parse(ini.IniReadValue(sectionName, "width", "1024")); windowConf.Height = int.Parse(ini.IniReadValue(sectionName, "height", "768")); windowConf.Toolbar = bool.Parse(ini.IniReadValue(sectionName, "toolbar", "true")); windowConf.Statusbar = bool.Parse(ini.IniReadValue(sectionName, "statusbar", "true")); windowConf.Resizable = bool.Parse(ini.IniReadValue(sectionName, "resizable", "true")); windowConf.Fullscreen = bool.Parse(ini.IniReadValue(sectionName, "fullscreen", "false")); windowConf.Show_in_taskbar = bool.Parse(ini.IniReadValue(sectionName, "show_in_taskbar", "true")); windowConf.Frame = bool.Parse(ini.IniReadValue(sectionName, "frame", "true")); windowConf.Position = ini.IniReadValue(sectionName, "position", "center"); string min_width = ini.IniReadValue(sectionName, "min_width"); if (!string.IsNullOrEmpty(min_width)) { windowConf.Min_width = int.Parse(min_width); } string min_height = ini.IniReadValue(sectionName, "min_height"); if (!string.IsNullOrEmpty(min_height)) { windowConf.Min_height = int.Parse(min_height); } string max_width = ini.IniReadValue(sectionName, "max_width"); if (!string.IsNullOrEmpty(max_width)) { windowConf.Max_width = int.Parse(max_width); } string max_height = ini.IniReadValue(sectionName, "max_height"); if (!string.IsNullOrEmpty(max_height)) { windowConf.Max_height = int.Parse(max_height); } windowConf.Show = bool.Parse(ini.IniReadValue(sectionName, "show", "true")); windowConf.Kiosk = bool.Parse(ini.IniReadValue(sectionName, "kiosk", "false")); windowConf.Showerror = bool.Parse(ini.IniReadValue(sectionName, "showerror", "false")); conf.WindowConfig = windowConf; #endregion conf.Defaultsys = ini.IniReadValue("scwebapp", "defaultmain", "0"); conf.DefaultViewModel = ini.IniReadValue("scwebapp", "defaultviewmodel", Enum.GetName(typeof(ScWebBrowser.Constants.Browser_渲染模式), ScWebBrowser.Constants.Browser_渲染模式.IE7)); int count = int.Parse(ini.IniReadValue("webapp", "webcount", "5"));//默认5个系统 int gIndex = 1; while (gIndex <= count) { ScSystem si = null; if (gIndex <= 5) { si = ScSystem.GetScSystem(ini.IniReadValue("webapp", "weburl" + gIndex, getDfltUrl(gIndex.ToString()))); } else { si = ScSystem.GetScSystem(ini.IniReadValue("webapp", "weburl" + gIndex, "")); } if (si != null) { if (si.Deflt == "Y") { conf.MainUrl = ConfigureHelper.getWebUrl(conf.Main, si.Url); conf.DefaultViewModel = si.Viewmodel; } conf.SysList.Add(si); } gIndex++; } //如果系统没有默认访问的his系统,则访问首页 conf.MainUrl = string.IsNullOrEmpty(conf.MainUrl) ? getWebUrl(conf.Main, "") : conf.MainUrl; return(conf); }catch (Exception ex) { MessageBox.Show("解析配置文件失败!" + ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return(conf); } }
private static string getUrlText(ScSystem ss) { return(string.Format("{0}|{1}|{2}|{3}|{4}|{5}", ss.Id, ss.Pid, ss.Deflt, ss.Name, ss.Url, string.IsNullOrEmpty(ss.Viewmodel) ? "IE7" : ss.Viewmodel)); }