//设置页按钮 private void ItemOption_ItemActivated_1(object sender, Qios.DevSuite.Components.QCompositeEventArgs e) { FormRunOption formRunOption = new FormRunOption(); string name = formRunOption.Name; //使用循环判断当前已经打开的窗体中是否有主页的窗体 foreach (DockContent item in idockPanel.Contents) { if (item.Name == name) { item.Activate(); return; } } //如果上面满足if条件的话,就会运行到return,直接跳出代码,不会再执行下面这两句代码 formRunOption.Show(idockPanel); }
private void FormMain_Load(object sender, EventArgs e) { //加载起始页窗体 FormRunOption formRunOption = new FormRunOption(); formRunOption.Show(idockPanel); if (FormLogin.if_online) { Lblmessage.Visible = true; setMessage("connecting..."); loadInfo(); if (ipAddress != null && userName != null && passward != null) { Thread thread = new Thread(delegate() { connectState = connToServer(); if (connectState == false) { message = "Sorry,failed to connect...retrying..."; setMessage(message); connectState = connToServer(); if (connectState == false) { MessageBox.Show("Please exit and login again."); } else { message = "Connected"; setMessage(message); ItemBegin.Enabled = true; } } else { message = "Connected"; setMessage(message); ItemBegin.Enabled = true; } }); thread.Start(); } } }
private void ItemOption_ItemActivated(object sender, Qios.DevSuite.Components.QCompositeEventArgs e) { FormRunOption formRunOption = new FormRunOption(); formRunOption.Show(); }
private void FormMain_Load(object sender, EventArgs e) { //加载起始页窗体 FormRunOption formRunOption = new FormRunOption(); formRunOption.Show(idockPanel); if (FormLogin.language == true) { XmlReader xmlReader = null; try { //加载xml文档 xmlReader = new XmlTextReader(Application.StartupPath + @"\xml\languageChinese.xml");//参数:存储的绝对路径 XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(xmlReader); XmlNode root = xmlDoc.DocumentElement; //获取根节点 XmlNode sysname = root.SelectSingleNode("//sysname"); if (sysname != null) { FormMain.TxtName = sysname.InnerText; } XmlNode menu = root.SelectSingleNode("//menu"); if (menu != null) { RibbonPage1.Text = menu.InnerText; } XmlNode logo = root.SelectSingleNode("//logo"); if (logo != null) { MainPanelImage.Title = logo.InnerText; } XmlNode panelHomepage = root.SelectSingleNode("//panelHomepage"); if (panelHomepage != null) { PanelHomepage.Title = panelHomepage.InnerText; } XmlNode itemOption = root.SelectSingleNode("//itemOption"); if (itemOption != null) { ItemOption.Title = itemOption.InnerText; } XmlNode itemCancel = root.SelectSingleNode("//itemCancel"); if (itemCancel != null) { ItemCancel.Title = itemCancel.InnerText; } XmlNode panelSave = root.SelectSingleNode("//panelSave"); if (panelSave != null) { PanelSave.Title = panelSave.InnerText; } XmlNode itemBegin = root.SelectSingleNode("//itemBegin"); if (itemBegin != null) { ItemBegin.Title = itemBegin.InnerText; } XmlNode itemAdd = root.SelectSingleNode("//itemAdd"); if (itemAdd != null) { ItemAdd.Title = itemAdd.InnerText; } XmlNode itemResult = root.SelectSingleNode("//itemResult"); if (itemResult != null) { ItemResult.Title = itemResult.InnerText; } XmlNode itemChart = root.SelectSingleNode("//itemChart"); if (itemChart != null) { ItemChart.Title = itemChart.InnerText; } XmlNode panelExcel = root.SelectSingleNode("//panelExcel"); if (panelExcel != null) { PanelExcel.Title = panelExcel.InnerText; } XmlNode itemExport = root.SelectSingleNode("//itemExport"); if (itemExport != null) { ItemExport.Title = itemExport.InnerText; } XmlNode itemPrint = root.SelectSingleNode("//itemPrint"); if (itemPrint != null) { ItemPrint.Title = itemPrint.InnerText; } XmlNode panelAbout = root.SelectSingleNode("//panelAbout"); if (panelAbout != null) { PanelAbout.Title = panelAbout.InnerText; } XmlNode itemAbout = root.SelectSingleNode("//itemAbout"); if (itemAbout != null) { ItemAbout.Title = itemAbout.InnerText; } XmlNode itemHelp = root.SelectSingleNode("//itemHelp"); if (itemHelp != null) { ItemHelp.Title = itemHelp.InnerText; } XmlNode panelExit = root.SelectSingleNode("//panelExit"); if (panelExit != null) { PanelExit.Title = panelExit.InnerText; } XmlNode itemExit = root.SelectSingleNode("//itemExit"); if (itemExit != null) { ItemExit.Title = itemExit.InnerText; } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { xmlReader.Close(); } } if (FormLogin.if_online) { Lblmessage.Visible = true; setMessage("connecting..."); loadInfo(); if (ipAddress != null && userName != null && passward != null) { Thread thread = new Thread(delegate() { connectState = connToServer(); if (connectState == false) { message = "Sorry,failed to connect...retrying..."; setMessage(message); connectState = connToServer(); if (connectState == false) { MessageBox.Show("Please exit and login again."); } else { message = "Connected"; setMessage(message); ItemBegin.Enabled = true; } } else { message = "Connected"; setMessage(message); ItemBegin.Enabled = true; } }); thread.Start(); } } }