public void ShowForm(WinMenu menu) { Form form = null; if (string.IsNullOrEmpty(menu.PluginName) == false && string.IsNullOrEmpty(menu.ControllerName)==false) { string controllername = menu.ControllerName.Split(new char[] { '|' })[0]; string viewname = menu.ControllerName.Split(new char[] { '|' }).Length > 1 ? menu.ControllerName.Split(new char[] { '|' })[1] : null; if (controllername.Trim() == "") throw new Exception("菜单没有配置好!"); if (AppGlobal.appType == AppType.Winform) { #if WinformFrame WinformController basec = ControllerHelper.CreateController(menu.PluginName + "@" + controllername); if (string.IsNullOrEmpty(viewname)) form = (Form)basec.DefaultView; else form = (Form)basec.iBaseView[viewname]; #endif } else if (AppGlobal.appType == AppType.WCFClient) { #if WcfFrame EFWCoreLib.WcfFrame.ClientController.WcfClientController basec = EFWCoreLib.WcfFrame.ClientController.ControllerHelper.CreateController(menu.PluginName + "@" + controllername); if (string.IsNullOrEmpty(viewname)) form = (Form)basec.DefaultView; else form = (Form)basec.iBaseView[viewname]; #endif } } ShowForm(form, menu.Name, menu.MenuId.ToString()); }
//点击菜单 void btnmenu_Click(object sender, EventArgs e) { btnImage = sender; BaseItem baseItem = sender as BaseItem; if (baseItem.Tag.ToString() != "" && baseItem.Tag.GetType() != typeof(BaseModule)) { BaseMenu menu = (BaseMenu)baseItem.Tag; WinMenu winmenu = new WinMenu(); if (AppGlobal.appType == AppType.Winform) { winmenu.PluginName = menu.DllName; winmenu.ControllerName = menu.FunName; } else if (AppGlobal.appType == AppType.WCFClient) { if (!string.IsNullOrEmpty(menu.FunWcfName)) { winmenu.PluginName = menu.FunWcfName.Split('@')[0]; winmenu.ControllerName = menu.FunWcfName.Split('@')[1]; } } //else if (Program.clienttype == "WEBClient") //{ // winmenu.DllName = ""; // winmenu.FunName = ""; //} //winmenu.DllName = menu.DllName; //winmenu.FunName = menu.FunName; winmenu.IsOutlookBar = menu.MenuLookBar; winmenu.IsToolBar = menu.MenuToolBar; winmenu.Memo = menu.Memo; winmenu.MenuId = menu.MenuId; winmenu.ModuleId = menu.ModuleId; winmenu.Name = menu.Name; winmenu.PMenuId = menu.PMenuId; winmenu.SortId = menu.SortId; winmenu.UrlPath = InvokeController("GetWebserverUrl").ToString() + menu.UrlName; ShowForm(winmenu); } }