public WebKitFrom(IMainFrm mainFrm, Iot_FunctionDefine funcDefine) : base(mainFrm) { InitializeComponent(); this.mainFrm = mainFrm; this.funName = funcDefine; this.Text = funcDefine.FunName; //登陆检查 if (LoginChecker.getInstance().Login(mainFrm)) { //登录成功 string strURL = string.Format("{0}/{1}", LoginChecker.getInstance().CompanyAccount.ServiceURL, funcDefine.URI); Uri url = new System.Uri(strURL, System.UriKind.Absolute); this.webKitBrowser1.Url = url; //加载 CreateDefineBar(); if (this.DefineBar != null) { this.DefineBar.BarName = "bar_" + funcDefine.FunName; this.DefineBar.Text = funcDefine.FunName; this.SetDock(); } } else { this.webKitBrowser1.Url = new System.Uri(string.Format("{0}/{1}", LoginChecker.getInstance().CompanyAccount.ServiceURL, "Fail.html"), System.UriKind.Absolute);; } //下面加载自定义bar工具条 }
public override List <MenuItem> getMenu() { List <MenuItem> listMenuItem = base.getMenu(); try { List <Iot_FunctionMenu> menus = MenuServiceBF.getInstance().getIMeterCheck.ReadFunctionMenu(); List <Iot_FunctionDefine> functions = MenuServiceBF.getInstance().getIMeterCheck.ReadFunctionDefine(); MenuItem item = null; foreach (Iot_FunctionMenu row in menus) { Iot_FunctionDefine fun = (from p in functions where p.RootID == row.RootID select p).SingleOrDefault(); //检查报表查看权限 if (fun != null && (Convert.ToInt32(fun.RightCode) == -1 || this._iMainFrm.IsExist(Convert.ToInt32(fun.RightCode)))) { //检查 item = new MenuItem(); item.Caption = row.MenuName; item.Name = row.MenuName; if (fun.URI != "") { //网页功能展示 item.MouseClicked = new WebShowFunction(this._iMainFrm, fun).OnEventHandler; } else { //本地功能实现 item.MouseClicked = new LocalFunction(this._iMainFrm, fun).OnEventHandler; } listMenuItem.Add(item); } } } catch (Exception e) { //加载菜单失败 System.Windows.Forms.MessageBox.Show(e.Message); } return(listMenuItem); }
public LocalFunction(IMainFrm mainFrm, Iot_FunctionDefine funcDefine) { this.mainFrm = mainFrm; this.funName = funcDefine; this.OnEventHandler = new EventHandler(itemMenu_OnClicked); }