public static ChildPage LoadPage(string menuId) { try { List <Sys_Menu> MenuData = Provider.UserMenus; Sys_Menu sys_Menu = MenuData.Find(m => m.Menu_Id == menuId); if (sys_Menu == null) { return(null); } List <MyParameter> myParameters = new List <MyParameter>(); myParameters.Add("@Menu_Id", DbType.String, sys_Menu.Menu_Page, null); DataTable dt = BaseService.Open("SystemMenu_Single", myParameters); Sys_Page sys_Page = EntityHelper.GetEntity <Sys_Page>(dt); ChildPage childPage = LoadPage(sys_Page); childPage.Text = sys_Menu.Menu_Nick; childPage.SysMenu = sys_Menu; return(childPage); } catch (Exception ex) { throw ex; } finally { } }
public static ChildPage LoadPage(Sys_Menu sys_Menu) { try { ChildPage page = LoadPage(sys_Menu.Menu_Id); return(page); } catch (Exception ex) { throw ex; } finally { } }
public static ChildPage LoadPage(Sys_Page sys_Page) { try { if (sys_Page != null) { ChildPage myPage = null; if (!string.IsNullOrEmpty(sys_Page.Menu_Path) && !string.IsNullOrEmpty(sys_Page.Menu_Class)) { string sFile = Provider.StartupPath + sys_Page.Menu_Path; //本地文件自动查找文件 if (!sFile.Contains("://") && !File.Exists(sFile)) { sFile = SearchFile(Application.StartupPath, sys_Page.Menu_Path); } if (!File.Exists(sFile)) { throw new Exception($"未能找到菜单文件:{sys_Page.Menu_Path}"); } myPage = (ChildPage)ReflectionHelper.LoadForm(sFile, sys_Page.Menu_Class); } if (myPage == null) { myPage = new ChildPage(); } myPage.Name = sys_Page.Menu_Name; myPage.Text = sys_Page.Menu_Nick; myPage.SysPage = sys_Page; myPage.SysMenu = null; return(myPage); } return(null); } catch (Exception ex) { throw ex; } finally { } }
protected void InitializeService() { try { DataTable dt = BaseService.Open("SystemService_All", null); List <Sys_Service> sys_Services = EntityHelper.GetEntities <Sys_Service>(dt); foreach (Sys_Service svr in sys_Services) { Timer timer = new Timer(); int ti = 1000 * svr.Service_Unit * svr.Service_Interval; timer.Interval = ti > 0 ? ti : 1000; timer.Tick += delegate { //加载页面 if (!string.IsNullOrEmpty(svr.Service_Page)) { ChildPage cp = SharedFunc.LoadPage(svr.Service_Page); if (cp == null || cp.SysPage == null) { return; } switch ((Sys_Menu_Show)cp.SysPage.Menu_Show) { case Sys_Menu_Show.MdiChild: cp.MdiParent = this; cp.Show(); break; case Sys_Menu_Show.Dialog: cp.ShowDialog(); break; case Sys_Menu_Show.NewForm: cp.Show(); break; default: break; } } //执行WorkSet if (!string.IsNullOrEmpty(svr.Service_WorkSet)) { BaseService.Execute(svr.Service_WorkSet, null); } //执行文件 if (!string.IsNullOrEmpty(svr.Service_File)) { Process.Start(svr.Service_File, svr.Service_Parameter); } if (svr.Service_Once) { timer.Enabled = false; } }; timer.Enabled = true; } } catch (Exception ex) { throw ex; } }