void Start () { stageEnd_left = -30.0f; stageEnd_right = 30.0f; wait_for_start = true; firstTime = true; paused = false; GameObject mainCameraObj = GameObject.Find ("Camera"); GameObject healthBars = GameObject.Find ("HealthBars"); GameObject player1Obj = GameObject.Find ("Player1"); GameObject player2Obj = GameObject.Find ("Player2"); GameObject debugTextObj = GameObject.Find ("DebugText"); GameObject winTextObj = GameObject.Find ("WinText"); GameObject MIObj = GameObject.Find ("Info"); MI_gd = MIObj.GetComponent<MenuInfo> (); mainCamera = mainCameraObj.GetComponent<CameraController> (); healthbarcontroller = healthBars.GetComponent<HealthBarController> (); player1 = player1Obj.GetComponent<PlayerController> (); player2 = player2Obj.GetComponent<PlayerController> (); debugText = debugTextObj.GetComponent<DebugTextController> (); winText = winTextObj.GetComponent<Text> (); Quit = KeyCode.Escape; start_game = KeyCode.G; TogglePause = KeyCode.BackQuote; ToggleDebugText = KeyCode.Quote; winText.text = ""; winText.color = Color.white; }
public void Add(MenuInfo info) { using (EinsteinEntities entities = new EinsteinEntities()) { entities.MenuInfo.AddObject(info); entities.SaveChanges(); } }
public void Write(MenuInfo info, XmlWriter writer) { writer.WriteStartElement("Menu"); WriteBase(info, writer); foreach (var state in info.States) { WriteState(state, writer); } writer.WriteEndElement(); }
public IIncludedObject Load(Project project, XElement node) { var menu = new MenuInfo(); LoadBase(menu, node, project.BaseDir); foreach (var keyNode in node.Elements("State")) { menu.States.Add(LoadMenuState(keyNode, project.BaseDir)); } project.AddMenu(menu); return menu; }
public static List <ComboBoxItem> GetParentMenuByMenu(MenuInfo menu) { List <ComboBoxItem> items = new List <ComboBoxItem>(); Menu_DB _db = new Menu_DB(); using (SqlDataReader dr = _db.GetParentSelectMenu(menu)) { while (dr.Read()) { ComboBoxItem item = new ComboBoxItem(); item.ID = int.Parse(dr["ID"].ToString()); item.Name = dr["MenuName"].ToString(); items.Add(item); } } return(items); }
public int AddMenu(MenuInfo menu) { int i = 0; using (var s = new BlogDBContext()) { var a = new MenuInfo { MName = menu.MName, MUrl = menu.MUrl }; s.menus.Add(a); i = s.SaveChanges(); } return(i); //string sql = "insert into menuinfo values (" + menu.Mid + ",'" + menu.MName + "','" + menu.MUrl + "')"; //int i = _dBHelper.ExecuteNonQuery(sql); //return i; }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; if (context.Request.HttpMethod.ToUpper() == "POST") { MenuInfo.CreateMenuPage(); #region 处理消息 MsgHandler msg = new MsgHandler(); msg.ExecuteMessage(context.Request.InputStream); #endregion } else { ResponseServer(); } }
private void LoadAllChildMenuIncludeCheckBox(ref Ext.Net.TreeNode root, MenuInfo parent) { List <MenuInfo> MenuList = MenuController.GetInstance().GetMenus(parent.ID, false, false); foreach (MenuInfo item in MenuList) { Ext.Net.TreeNode node = new Ext.Net.TreeNode(item.MenuName, Icon.UserGray); root.Nodes.Add(node); node.Checked = ThreeStateBool.False; node.Expanded = false; node.NodeID = item.ID.ToString(); List <MenuInfo> MenuList2 = MenuController.GetInstance().GetMenus(item.ID, false, false); if (MenuList2.Count() != 0) { LoadAllChildMenuIncludeCheckBox(ref node, item); } } }
public ActionResult Main() { //string URL = ConfigurationManager.AppSettings["webAPIAddress"] + "SS0/User/Menu"; //string body = "ptoken=" + Session["Token"].ToString() + "&parent=41"; //URL = URL + "?" + body; //string Menu = GET_Return(URL); //MobileMenuInfo menuinfo = JsonConvert.DeserializeObject<MobileMenuInfo>(Menu); //List<MobileMenuInfo> menuchild = menuinfo.Children; //ViewData.Model = menuchild; //Session["MENUINFO"] = menuchild; //return View(); MenuInfo menuinfo = models.UserToken.Menu(Session["Token"].ToString(), "41"); MenuInfo[] menuchild = menuinfo.Children; Session["TITLENAME"] = "主页"; Session["MENUINFO"] = menuchild; return(View()); }
public ApiResult Update([FromUri] int tenant_id, [FromUri] string menu_id, [FromBody] MenuCreateArgument model) { var appaccount_id = ProviderGateway.AppAccountProvider.GetAppAccountId(tenant_id, model.appaccount_id, model.tag); var menuInfo = new MenuInfo { MenuId = menu_id, Name = model.name, TenantId = model.tenant_id, AppAccountId = appaccount_id, BeisenAppId = model.beisen_app_id, Url = model.url }; ProviderGateway.MenuProvider.Update(tenant_id, menuInfo); return(new ApiResult()); }
public ApiResult Create([FromBody] MenuCreateArgument model, [FromUri] int tenant_id, [FromUri] string appaccount_id = "", [FromUri] string tag = "") { var menuInfo = new MenuInfo { Name = model.name, TenantId = model.tenant_id, AppAccountId = _AppAccountId, BeisenAppId = model.beisen_app_id, Url = model.url }; var menuId = ProviderGateway.MenuProvider.Create(tenant_id, menuInfo); return(new MenuCreateResult { MenuId = menuId }); }
/// <summary> /// 获取指定菜单项的json信息 /// </summary> /// <param name="uname"></param> /// <returns></returns> public string GetUser(string uname) { string sql = "SELECT * FROM `web`.`菜单表` where 菜单名称='" + uname + "'"; DataTable dTable = data.GetTable(sql); MenuInfo menu = new MenuInfo(); menu.Id = dTable.Rows[0]["菜单号"].ToString(); menu.Name = dTable.Rows[0]["菜单名称"].ToString(); menu.ParentId = dTable.Rows[0]["父菜单号"].ToString(); menu.Num = dTable.Rows[0]["菜单序号"].ToString(); menu.Disc = dTable.Rows[0]["菜单描述"].ToString(); menu.Url = dTable.Rows[0]["URL"].ToString(); menu.Ico = dTable.Rows[0]["菜单图标"].ToString(); menu.Level = dTable.Rows[0]["菜单等级"].ToString(); return(JsonHelper <MenuInfo> .ObjectToJsonString(menu)); }
public void Initialize() { // Main module _adminScreenInfo = MenuInfo.Create(1, "Workplan", true, false, false, false); _screenFactoryRegistry.RegisterFactory(_adminScreenInfo.ScreenGuid, _forecastScreenFactory); _menuRegistry.RegisterMenuInfo(_adminScreenInfo); // Sub module Registration var submenuForecastRegistration = SubMenuInfo.Create("Registration", typeof(ForecastRegistrationRootView).Name, _adminScreenInfo); submenuForecastRegistration.IsActive = true; _adminScreenInfo.AddSubMenu(submenuForecastRegistration); // Sub module Overview var submenuForecastOverview = SubMenuInfo.Create("Overview", typeof(ForecastOverviewView).Name, _adminScreenInfo); _adminScreenInfo.AddSubMenu(submenuForecastOverview); }
public void Update(MenuInfo menuInfo) { var parms = new IDataParameter[] { GetParameter(PARM_PUBLISHMENT_SYSTEM_ID, EDataType.Integer, menuInfo.PublishmentSystemID), GetParameter(PARM_MENU_NAME, EDataType.NVarChar, 50, menuInfo.MenuName), GetParameter(PARM_MENU_TYPE, EDataType.VarChar, 50, EMenuTypeUtils.GetValue(menuInfo.MenuType)), GetParameter(PARM_KEYWORD, EDataType.NVarChar, 50, menuInfo.Keyword), GetParameter(PARM_URL, EDataType.VarChar, 200, menuInfo.Url), GetParameter(PARM_CHANNEL_ID, EDataType.Integer, menuInfo.ChannelID), GetParameter(PARM_CONTENT_ID, EDataType.Integer, menuInfo.ContentID), GetParameter(PARM_PARENT_ID, EDataType.Integer, menuInfo.ParentID), GetParameter(PARM_TAXIS, EDataType.Integer, menuInfo.Taxis), GetParameter(PARM_MENU_ID, EDataType.Integer, menuInfo.MenuID) }; ExecuteNonQuery(SQL_UPDATE, parms); }
/// <summary> /// 获取查询列表 /// </summary> /// <param name="keyWord"></param> /// <returns></returns> public List <MenuInfo> GetList() { using (DbContext db = new CRDatabase()) { var query = db.Set <CTMS_SYS_FUNCTION>().AsNoTracking() .Where(o => o.ISMENU && !o.ISDELETED && string.IsNullOrEmpty(o.PARENTID)) .OrderBy(m => m.SORT).ToList(); List <MenuInfo> list = new List <MenuInfo>(); foreach (CTMS_SYS_FUNCTION entity in query) { MenuInfo model = EntityToModel(entity); model.ChildrenList = GetChildrenList(model.ID); list.Add(model); } return(list); } }
/// <summary> /// 新增一条质检记录 /// </summary> /// <param name="qcRecord">质检实体</param> /// <returns></returns> public static bool InsertOneQCRecord(MenuInfo qcRecord) { bool rbool = true; using (DCCarManagementDataContext db = new DCCarManagementDataContext()) { try { rbool = LinQBaseDao.InsertOne(db, qcRecord); } catch { rbool = false; } finally { db.Connection.Close(); } } return(rbool); }
protected void btnSave_Click(object sender, EventArgs e) { MenuInfo menu = new MenuInfo(); menu.Name = txtName.Text; if (string.IsNullOrEmpty(ddlParentList.SelectedValue)) { menu.ParentId = null; } else { menu.ParentId = new Guid(ddlParentList.SelectedValue); } menu.Index = int.Parse(txtIndex.Text); menu.IsNewWindow = ckbIsOpenNewWindow.Checked; facade.AddMenu(menu); InitMenuTree(); }
/// <summary> /// 获取菜单 /// </summary> /// <param name="parentId"></param> /// <returns></returns> public List <MenuInfo> GetMenuList(int parentId) { List <MenuInfo> list = new List <MenuInfo>(); DataTable menuDt = RefProvider.BPMSServiceRefInstance.LogGetUserMenuList(); foreach (DataRow item in menuDt.Rows) { if (int.Parse(item["ParentId"].ToString()) == parentId) { MenuInfo menuInfo = new MenuInfo(); menuInfo.ID = int.Parse(item["ID"].ToString()); menuInfo.Name = item["Name"].ToString(); menuInfo.IconUrl = item["IconUrl"].ToString(); list.Add(menuInfo); } } return(list); }
private void btnDeleteMenu_Click(object sender, EventArgs e) { if (this.lvFunctions.SelectedItems.Count > 0) { Staff tag = this.lvStaff.SelectedItems[0].Tag as Staff; SysGrants sysGrant = new SysGrants(); for (int i = this.lvFunctions.SelectedItems.Count - 1; i >= 0; i--) { ListViewItem item = this.lvFunctions.SelectedItems[i]; if (item.Group == this.lvFunctions.Groups[0]) { MenuInfo menuInfo = item.Tag as MenuInfo; sysGrant.DeleteGrant(tag.StaffID, "Staff", menuInfo.MenuID, "gisPluge"); } this.lvFunctions.Items.Remove(item); } } }
//加载菜单的子菜单节点 private void loadSubMenu(TreeNode tnMenu, MenuInfo menu, IList <MenuInfo> appMenus) { if (menu.Level == 3) { return; } for (int i = 0; i < appMenus.Count; i++) { if (appMenus[i].ParentMenuID.Equals(menu.ID)) { TreeNode tnSubMenu = new TreeNode(appMenus[i].Name, appMenus[i].ID); tnSubMenu.ShowCheckBox = true; this.loadSubMenu(tnSubMenu, appMenus[i], appMenus); tnMenu.ChildNodes.Add(tnSubMenu); } } }
public void Update(MenuInfo menuInfo) { var parms = new IDataParameter[] { GetParameter(ParmPublishmentSystemId, EDataType.Integer, menuInfo.PublishmentSystemId), GetParameter(ParmMenuName, EDataType.NVarChar, 50, menuInfo.MenuName), GetParameter(ParmMenuType, EDataType.VarChar, 50, EMenuTypeUtils.GetValue(menuInfo.MenuType)), GetParameter(ParmKeyword, EDataType.NVarChar, 50, menuInfo.Keyword), GetParameter(ParmUrl, EDataType.VarChar, 200, menuInfo.Url), GetParameter(ParmChannelId, EDataType.Integer, menuInfo.ChannelId), GetParameter(ParmContentId, EDataType.Integer, menuInfo.ContentId), GetParameter(ParmParentId, EDataType.Integer, menuInfo.ParentId), GetParameter(ParmTaxis, EDataType.Integer, menuInfo.Taxis), GetParameter(ParmMenuId, EDataType.Integer, menuInfo.MenuId) }; ExecuteNonQuery(SqlUpdate, parms); }
public JsonResult UpdateMenu(string menuId, string menuName, int urlType, string url, string parentId) { switch (urlType) { case 1: url = "http://" + HttpContext.Request.Url.Host + "/m-" + PlatformType.WeiXin.ToString() + "/"; break; case 2: url = "http://" + HttpContext.Request.Url.Host + "/m-" + PlatformType.WeiXin.ToString() + "/vshop"; break; case 3: url = "http://" + HttpContext.Request.Url.Host + "/m-" + PlatformType.WeiXin.ToString() + "/category/Index"; break; case 4: url = "http://" + HttpContext.Request.Url.Host + "/m-" + PlatformType.WeiXin.ToString() + "/member/center"; break; case 5: url = "http://" + HttpContext.Request.Url.Host + "/m-" + PlatformType.WeiXin.ToString() + "/cart/cart"; break; default: break; } if ((!string.IsNullOrEmpty(url)) && (!url.Contains("http://"))) { throw new Himall.Core.HimallException("链接必须以http://开头"); } Result result = new Result(); var menuInfo = new MenuInfo(); menuInfo.Id = Convert.ToInt64(menuId); menuInfo.Title = menuName; menuInfo.UrlType = (MenuInfo.UrlTypes)urlType; menuInfo.Url = url; menuInfo.ParentId = Convert.ToInt64(parentId); _iWeixinMenuService.UpdateMenu(menuInfo); result.success = true; return(Json(result)); }
public void AddMenus(HttpContext context) { context.Response.ContentType = "application/json"; string s = "{\"status\":\"1\"}"; MenuInfo menu = new MenuInfo { Content = context.Request["Content"].Trim(), Name = context.Request["Name"].Trim(), Type = context.Request["Type"], Bind = 8 }; if (menu.Content.EndsWith("/getstorecard/")) { menu.Bind = 9; menu.Type = "click"; } if (context.Request["ParentMenuId"] != null) { menu.ParentMenuId = (context.Request["ParentMenuId"] == "") ? 0 : int.Parse(context.Request["ParentMenuId"]); } else { menu.ParentMenuId = 0; } if (VShopHelper.CanAddMenu(menu.ParentMenuId)) { if (VShopHelper.SaveMenu(menu)) { if (menu.ParentMenuId > 0) { MenuInfo info2 = VShopHelper.GetMenu(menu.ParentMenuId); info2.Bind = 0; info2.Content = ""; VShopHelper.UpdateMenu(info2); } s = "{\"status\":\"0\"}"; } } else { s = "{\"status\":\"2\"}"; } context.Response.Write(s); }
/// <summary> /// 获取查询列表 /// </summary> /// <param name="keyWord"></param> /// <returns></returns> public List <MenuInfo> GetList(string userID) { using (DbContext db = new CRDatabase()) { if (string.IsNullOrEmpty(userID)) { return(db.Set <CTMS_SYS_FUNCTION>().AsNoTracking() .Where(o => o.ISMENU && !o.ISDELETED && string.IsNullOrEmpty(o.PARENTID) && o.ISPUBLIC) .OrderBy(m => m.SORT).ToList() .Select(m => EntityToModel(m)) .ToList()); } var RoleIDList = db.Set <CTMS_SYS_USERROLE>() .AsNoTracking() .Where(o => !o.ISDELETED && o.USERID.Equals(userID)) .Select(o => o.ROLEID) .ToList(); var FunctionIDList = db.Set <CTMS_SYS_ROLEFUNCTION>() .AsNoTracking() .Where(o => !o.ISDELETED && RoleIDList.Contains(o.ROLEID)) .Select(o => o.FUNCTIONID).ToList(); var ParentFunctionIDList = db.Set <CTMS_SYS_FUNCTION>() .AsNoTracking() .Where(o => o.ISMENU && !o.ISDELETED && !string.IsNullOrEmpty(o.PARENTID) && FunctionIDList.Contains(o.FUNCTIONID)) .Select(o => o.PARENTID).ToList(); var query = db.Set <CTMS_SYS_FUNCTION>().AsNoTracking() .Where(o => o.ISMENU && !o.ISDELETED && (o.ISPUBLIC || FunctionIDList.Contains(o.FUNCTIONID) || ParentFunctionIDList.Contains(o.FUNCTIONID))) .OrderBy(m => m.SORT) .ToList(); List <MenuInfo> list = new List <MenuInfo>(); foreach (CTMS_SYS_FUNCTION entity in query.Where(o => string.IsNullOrEmpty(o.PARENTID))) { MenuInfo model = EntityToModel(entity); model.ChildrenList = query.Where(o => o.PARENTID != null && o.PARENTID.Equals(entity.FUNCTIONID)).Select(EntityToModel).ToList(); list.Add(model); } return(list); } }
/// <summary> /// Thêm mới menu /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void InsertMenu() { MenuInfo menuInfo = new MenuInfo() { MenuName = txtMenuName.Text, IsDeleted = false, Order = 1, ParentID = int.Parse(hdfParentID.Text), TabName = txtTabName.Text, CreatedBy = CurrentUser.ID, EdittedBy = CurrentUser.ID, Icon = txtIcon.Text, IsPanel = chkIsMenuPanel.Checked }; if (!string.IsNullOrEmpty(cbFile.SelectedItem.Value)) { string LinkUrl = cbFile.SelectedItem.Value.Replace("\\", "/"); menuInfo.LinkUrl = LinkUrl.Substring(LinkUrl.IndexOf("Modules/")); } else { menuInfo.LinkUrl = txtMenuLink.Text; } int menuID = MenuController.GetInstance().InsertMenu(menuInfo); if (menuID > 0) { string[] roleID = hdfRoleID.Text.Split(','); foreach (string item in roleID) { if (!string.IsNullOrEmpty(item)) { MenuController.GetInstance().AddRole(menuID, int.Parse(item), UsersController.GetInstance().GetCurrentUser().ID, false); } } Dialog.ShowNotification(GlobalResourceManager.GetInstance().GetLanguageValue("add_menu_successful")); } else { Dialog.ShowError(GlobalResourceManager.GetInstance().GetLanguageValue("error")); } }
public string GetMenuAsString(string UserId) { StringBuilder menuBuilder = new StringBuilder(); using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["DefaultConnection"].ToString())) { List <MenuInfo> menuList = new List <MenuInfo>(); SqlCommand cmd = new SqlCommand("usp_GetMenuData", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@UserId", UserId); con.Open(); SqlDataReader sdr = cmd.ExecuteReader(); while (sdr.Read()) { MenuInfo menu = new MenuInfo(); menu.Id = Convert.ToInt32(sdr["Id"].ToString()); menu.MenuName = sdr["MenuName"].ToString(); menu.MenuURL = sdr["MenuURL"].ToString(); menu.MenuParentID = Convert.ToInt32(sdr["MenuParentID"].ToString()); menuList.Add(menu); } menuBuilder.Append("<ul class=\"" + topUl + "\">"); foreach (var sMenu in menuList) { if (sMenu.MenuParentID == 0) { if (hasChild(sMenu, menuList)) { populateMultiLevelMenu(sMenu, menuList, menuBuilder); } else { menuBuilder.Append("<li> <a href=\"" + sMenu.MenuURL + "\">" + sMenu.MenuName + " <span class=\"" + sClass + "\"></span> </a> </li>"); } } } menuBuilder.Append("</ul>"); } return(menuBuilder.ToString()); }
/// <summary> /// Name DateFrom DateTo 三个条件为基础的条件,有其他条件可以在 相应的子类中扩展 /// </summary> /// <param name="pager"></param> /// <returns></returns> public ActionResult SearchMenu(MenuPager pager) { var sql = @"SELECT t1.[keyid] ,[C_Name] ,[C_Description] ,[C_ParentMenu] , ParentMenu ,[C_Controller] ,[C_Action] ,[C_CreatedDate] ,[C_UpdatedDate] FROM [DATA_MANAGE].[dbo].[tbl_Menu] t1 left join (select keyid, C_Name as ParentMenu from tbl_menu) as t2 on t1.C_parentMenu=t2.keyid"; var where = new StringBuilder(" where 1=1 "); if (!string.IsNullOrWhiteSpace(pager.Name)) { where.AppendLine("and Name like '%" + pager.Name + "%'"); } if (!string.IsNullOrWhiteSpace(pager.DateFrom)) { where.AppendLine(" and C_CreatedDate>'" + pager.DateFrom + "'"); } if (!string.IsNullOrWhiteSpace(pager.DateTo)) { where.AppendLine(" and C_CreatedDate<'" + pager.DateTo + "'"); } try { var service = Container.GetService <IMenuService>(); var menudtos = service.GetModelsByPage <MenuDto>(pager.pageSize, pager.pageIndex, sql + where); var menuinfos = MenuInfo.ConvertToMenuInfos(menudtos); var grid = new MenuGrid(); grid.rows = menuinfos; grid.total = service.GetTableCount(where.ToString()); return(Json(grid)); } catch (Exception ex) { ViewBag.Operation = ex.Message; return(View("Error")); } }
public string InsertMenu(MenuInfo menuinfo) { string operationType = ""; //DataAccess dataaccess = new DataAccess(); string sql = "select * from tbl_menu where name = '" + menuinfo.Name + "'"; Ds = dataaccess.ExecuteQuery(sql); /*Console.WriteLine(menuinfo.MenuId); * Console.WriteLine(menuinfo.Name); * Console.WriteLine(menuinfo.UnitPrice); * Console.WriteLine(menuinfo.CategoryName);*/ if (this.Ds.Tables[0].Rows.Count == 1) { sql = @"update tbl_menu set name = '" + menuinfo.Name + @"', unit_price = '" + menuinfo.UnitPrice + @"', category_name = '" + menuinfo.CategoryName + @"' where name = '" + menuinfo.Name + "'"; try { dataaccess.ExecuteUpdateQuery(sql); operationType = "Update Done"; } catch (Exception exc) { Console.Write(exc); } } else { dataaccess.InitiateProcedure("INSERT_INTO_MENU"); dataaccess.DbCommand.Parameters.AddWithValue("name", "varchar2").Value = menuinfo.Name; dataaccess.DbCommand.Parameters.AddWithValue("unit_price", "FLOAT").Value = menuinfo.UnitPrice; dataaccess.DbCommand.Parameters.AddWithValue("category_name", "VARCHAR2").Value = menuinfo.CategoryName; dataaccess.DbCommand.ExecuteNonQuery(); operationType = "Insert done"; } return(operationType); }
private void ObtenerDatos(int Id) { try { var ObjetoResultado = new Resultado <MenuInfo>(); var ObjetoMenu = new MenuInfo(); var NegMenu = new NegMenus(); ObjetoMenu.Id = Id; ObjetoResultado = NegMenu.Buscar(ObjetoMenu); if (ObjetoResultado.ResultadoGeneral == true) { ObjetoMenu = ObjetoResultado.Lista.FirstOrDefault(); if (ObjetoMenu != null) { LlenarFormulario(ObjetoMenu); } else { if (Constantes.ModoDebug == true) { Controles.MostrarMensajeError(ObjetoResultado.Mensaje); } else { Controles.MostrarMensajeError(ArchivoRecursos.ObtenerValorNodo(Constantes.MensajesUsuario.ErrorCargarEntidad.ToString() + "Menu")); } } } } catch (Exception Ex) { if (Constantes.ModoDebug == true) { Controles.MostrarMensajeError(Ex.Message); } else { Controles.MostrarMensajeError(ArchivoRecursos.ObtenerValorNodo(Constantes.MensajesUsuario.ErrorCargarEntidad.ToString() + "Menu")); } } }
private void btnAddMenu_Click(object sender, EventArgs e) { MenuInfo menu = VShopHelper.GetMenu(base.GetUrlIntParam("MenuId")); menu.Name = this.txtMenuName.Text; menu.Type = "click"; if (menu.ParentMenuId == 0) { menu.Type = "view"; } else if (string.IsNullOrEmpty(this.ddlType.SelectedValue) || (this.ddlType.SelectedValue == "0")) { this.ShowMsg("二级菜单必须绑定一个对象", false); return; } menu.Bind = Convert.ToInt32(this.ddlType.SelectedValue); BindType bindType = menu.BindType; switch (bindType) { case BindType.Key: menu.ReplyId = Convert.ToInt32(this.ddlValue.SelectedValue); break; case BindType.Topic: menu.Content = this.ddlValue.SelectedValue; break; default: if (bindType == BindType.Url) { menu.Content = this.txtUrl.Text.Trim(); } break; } if (VShopHelper.UpdateMenu(menu)) { base.Response.Redirect("ManageMenu.aspx"); } else { this.ShowMsg("添加失败", false); } }
public async Task <BaseResponse <string> > Post(MenuInfo menuInfo) { var data = new BaseResponse <string>(); try { var res = await _menuServices.AddMenu(menuInfo); if (res) { data.Msg = "添加成功"; } } catch (Exception ex) { throw; } return(data); }
private void Menu_listview_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e) { MenuInfo menuInfo = (MenuInfo)e.Item.Tag; int menuID = menuInfo.Menu_Id; string menuName = menuInfo.Name; float price = menuInfo.UnitPrice; //MessageBox.Show(menuInfo.Name+menuInfo.UnitPrice); if (this.menu_listview.SelectedItems.Count > 0) { ListViewItem listView = new ListViewItem(menuName); listView.SubItems.Add("1"); listView.SubItems.Add("" + price); listView.SubItems.Add("" + menuID); this.orderListView.Items.Add(listView); totalPrice += price; totalPriceLabel.Text = Convert.ToString(totalPrice); } }
public static TreeMode CreateMenu(MenuInfo node) { TreeMode treeNode = new TreeMode { id = node.MenuId, text = node.MenuName, icon = node.MenuIcon, url = node.MenuUrl }; if (node.MenuListSub != null) { foreach (var item in node.MenuListSub) { treeNode.children.Add(TreeMode.CreateMenu(item)); } } return(treeNode); }
private static MenuInfo TranslateMenuInfo(MenuEntity menuEntity) { MenuInfo menuInfo = new MenuInfo(); if (menuEntity != null) { menuInfo.MenuID = menuEntity.MenuID; menuInfo.MenuName = menuEntity.MenuName; menuInfo.PreFlag = menuEntity.PreFlag ?? ""; menuInfo.SufFlag = menuEntity.SufFlag ?? ""; menuInfo.Remark = menuEntity.Remark ?? ""; menuInfo.URL = menuEntity.URL; menuInfo.Status = menuEntity.Status; menuInfo.GroupCode = menuEntity.GroupCode; } return(menuInfo); }
private bool RefreshServiceNode(TreeNode tnChecked) { if (isLocal) { return(true); } MenuInfo menu = GetDetailRowModel(tnChecked); string strError = string.Empty; if (!Basic_Func.SaveUserGroupMenuToDB(menu, GetListRowModel(dgvList.CurrentCell.RowIndex), ref strError)) { return(Common.Common_Func.ErrorMessage(strError, "设置权限失败")); } else { return(true); } }
//========================================Main switch case for canvas changing public void SwitchMenu(MenuInfo.MenuStates toState) { //only runs if they are allowed to naviate the menus if (canNavigate) { switch (toState) { case MenuInfo.MenuStates.Main: //0 ExclusiveEnabled (mainCanvases, 0); GameManager.instance.MainMenuOpen (); break; case MenuInfo.MenuStates.Profiles: //1 ExclusiveEnabled (mainCanvases, 1); ProfileManager.instance.OnProfilesEnter (); break; case MenuInfo.MenuStates.Records: //2 ExclusiveEnabled (mainCanvases, 2); break; case MenuInfo.MenuStates.Session: //3 ExclusiveEnabled (mainCanvases, 3); SessionManager.instance.OnSessionButtonHit(); break; } c_MenuState = toState; UnityEngine.EventSystems.EventSystem.current.SetSelectedGameObject(defaultButtons[(int)toState]); } }
public void AddMenu(MenuInfo menu) { _menus.Add(menu); }
public void RemoveMenu(MenuInfo menu) { _menus.Remove(menu); }
private void btnCreateMenu_Click(object sender, EventArgs e) { MenuInfo productInfo = new MenuInfo("软件产品", new MenuInfo[] { new MenuInfo("病人资料管理系统", ButtonType.click, "patient"), new MenuInfo("客户关系管理系统", ButtonType.click, "crm"), new MenuInfo("酒店管理系统", ButtonType.click, "hotel"), new MenuInfo("送水管理系统", ButtonType.click, "water") }); MenuInfo frameworkInfo = new MenuInfo("框架产品", new MenuInfo[] { new MenuInfo("Win开发框架", ButtonType.click, "win"), new MenuInfo("WCF开发框架", ButtonType.click, "wcf"), new MenuInfo("混合式框架", ButtonType.click, "mix"), new MenuInfo("Web开发框架", ButtonType.click, "web"), new MenuInfo("代码生成工具", ButtonType.click, "database2sharp") }); MenuInfo relatedInfo = new MenuInfo("相关链接", new MenuInfo[] { new MenuInfo("公司介绍", ButtonType.click, "Event_Company"), new MenuInfo("官方网站", ButtonType.view, "http://www.iqidi.com"), new MenuInfo("提点建议", ButtonType.click, "Event_Suggestion"), new MenuInfo("联系客服", ButtonType.click, "Event_Contact"), new MenuInfo("发邮件", ButtonType.view, "http://mail.qq.com/cgi-bin/qm_share?t=qm_mailme&email=S31yfX15fn8LOjplKCQm") }); MenuJson menuJson = new MenuJson(); menuJson.button.AddRange(new MenuInfo[] { productInfo, frameworkInfo, relatedInfo }); //Console.WriteLine(menuJson.ToJson()); //if (MessageUtil.ShowYesNoAndWarning("您确认要创建菜单吗") == System.Windows.Forms.DialogResult.Yes) //{ // IMenuApi menuBLL = new MenuApi(); // CommonResult result = menuBLL.CreateMenu(token, menuJson); // Console.WriteLine("创建菜单:" + (result.Success ? "成功" : "失败:" + result.ErrorMessage)); //} }
private void LoadChildrenMenu(TreeNode parentNode, MenuInfo parentMenu, string space) { facade.LoadChildrenMenuList(parentMenu); foreach (MenuInfo menu in parentMenu.Children) { TreeNode node = new TreeNode(); node.Value = menu.Id.ToString(); node.Text = menu.Name; ddlParentList.Items.Add(new ListItem(space + menu.Name, menu.Id.ToString())); LoadChildrenMenu(node, menu, space + " "); parentNode.ChildNodes.Add(node); } }
private Image GetDefaultImage(MenuInfo info) { Image ret = null; if (info.ChildMenus.Count > 0 || info.Action == null) { ret = Feng.Windows.ImageResource.Get("Feng", "Icons.iconFolder.png").Reference; } else { ActionInfo actionInfo = ADInfoBll.Instance.GetActionInfo(info.Action.Name); if (actionInfo != null) { switch (actionInfo.ActionType) { case ActionType.Window: if (actionInfo.Window == null) { throw new ArgumentException("Action " + actionInfo.Name + "'s Window is not defind!"); } WindowInfo windowInfo = ADInfoBll.Instance.GetWindowInfo(actionInfo.Window.Name); if (windowInfo != null) { switch (windowInfo.WindowType) { case WindowType.Maintain: ret = Feng.Windows.ImageResource.Get("Feng", "Icons.applicationManagement.png").Reference; break; case WindowType.Transaction: case WindowType.TransactionBound: ret = Feng.Windows.ImageResource.Get("Feng", "Icons.iconAutoForm.png").Reference; break; case WindowType.Query: case WindowType.QueryBound: ret = Feng.Windows.ImageResource.Get("Feng", "Icons.iconReport.png").Reference; break; case WindowType.DatabaseReport: ret = Feng.Windows.ImageResource.Get("Feng", "Icons.iconReport.png").Reference; break; case WindowType.DataSetReport: ret = Feng.Windows.ImageResource.Get("Feng", "Icons.iconReport.png").Reference; break; case WindowType.SelectWindow: ret = Feng.Windows.ImageResource.Get("Feng", "Icons.iconAutoForm.png").Reference; break; case WindowType.DetailTransaction: ret = Feng.Windows.ImageResource.Get("Feng", "Icons.iconAutoForm.png").Reference; break; default: ret = Feng.Windows.ImageResource.Get("Feng", "Icons.iconAutoForm.png").Reference; break; } } break; case ActionType.Form: ret = Feng.Windows.ImageResource.Get("Feng", "Icons.iconConfigForm.png").Reference; break; case ActionType.Process: ret = Feng.Windows.ImageResource.Get("Feng", "Icons.iconProcess.png").Reference; break; case ActionType.Url: ret = Feng.Windows.ImageResource.Get("Feng", "Icons.iconExternalLink.png").Reference; break; } } } return ret; }
private void RemoveIfExistInHistory(MenuInfo menuInfo) { foreach (ToolStripMenuItem i in tsmHistory.DropDownItems) { if (menuInfo.Name == (i.Tag as MenuHistoryInfo).MenuName) { tsmHistory.DropDownItems.Remove(i); break; } } }
private void DoColorMenu(int winID) { float margin = FixPx(marginPx); float fontSize = FixPx(fontPx); float itemHeight = FixPx(itemHeightPx); Rect scrollRect = new Rect(margin, (itemHeight + margin) * 2, winRect.width - margin * 3, winRect.height - (itemHeight + margin) * 4); Rect conRect = new Rect(0, 0, scrollRect.width - 20, 0); Rect outRect = new Rect(margin, 0, winRect.width - margin * 2, itemHeight); GUIStyle lStyle = "label"; GUIStyle bStyle = "button"; GUIStyle tStyle = "toggle"; Color color = new Color(1f, 1f, 1f, 0.98f); lStyle.fontSize = FixPx(fontPx); lStyle.normal.textColor = color; bStyle.fontSize = FixPx(fontPx); bStyle.normal.textColor = color; tStyle.fontSize = FixPx(fontPx); tStyle.normal.textColor = color; GUI.Label(outRect, "強制カラーチェンジ:" + currentSlotname, lStyle); outRect.y += itemHeight + margin; List<Material> materialList = GetMaterials(currentSlotname); if (GUI.Button(outRect, "テクスチャ変更", bStyle)) { textureFile = new Dictionary<int, Dictionary<string, string>>(); for (int i = 0; i < materialList.Count(); i++) { textureFile.Add(i, new Dictionary<string, string>()); foreach (string propName in propNames) { textureFile[i].Add(propName, ""); } } menuType = MenuType.Texture; } outRect.y = 0; outRect.width -= margin * 2 + 20; if (materialList != null) { conRect.height += (itemHeight + margin) * materialList.Count * 31 + margin; scrollViewVector = GUI.BeginScrollView(scrollRect, scrollViewVector, conRect); for (int i = 0; i < materialList.Count(); i++) { Material material = materialList[i]; outRect.x = margin; GUI.Label(outRect, material.name, lStyle); outRect.x += margin; outRect.width = conRect.width - margin * 3; outRect.y += itemHeight + margin; int renderQueue = material.renderQueue; renderQueue = (int)drawModValueSlider(outRect, renderQueue, 0, 5000, String.Format("{0}:{1}", "RQ", material.renderQueue), lStyle); material.SetFloat("_SetManualRenderQueue", renderQueue); material.renderQueue = renderQueue; outRect.y += itemHeight + margin; GUI.Label(outRect, "Color", lStyle); outRect.y += itemHeight + margin; Color sColor = material.GetColor("_Color"); sColor.r = drawModValueSlider(outRect, sColor.r, 0f, 2f, String.Format("{0}:{1:F2}", "R", sColor.r), lStyle); outRect.y += itemHeight + margin; sColor.g = drawModValueSlider(outRect, sColor.g, 0f, 2f, String.Format("{0}:{1:F2}", "G", sColor.g), lStyle); outRect.y += itemHeight + margin; sColor.b = drawModValueSlider(outRect, sColor.b, 0f, 2f, String.Format("{0}:{1:F2}", "B", sColor.b), lStyle); outRect.y += itemHeight + margin; sColor.a = drawModValueSlider(outRect, sColor.a, 0f, 1f, String.Format("{0}:{1:F2}", "A", sColor.a), lStyle); outRect.y += itemHeight + margin; Color shadowColor = material.GetColor("_ShadowColor"); if (shadowColor != null) { GUI.Label(outRect, "Shadow Color", lStyle); outRect.y += itemHeight + margin; shadowColor.r = drawModValueSlider(outRect, shadowColor.r, 0f, 2f, String.Format("{0}:{1:F2}", "R", shadowColor.r), lStyle); outRect.y += itemHeight + margin; shadowColor.g = drawModValueSlider(outRect, shadowColor.g, 0f, 2f, String.Format("{0}:{1:F2}", "G", shadowColor.g), lStyle); outRect.y += itemHeight + margin; shadowColor.b = drawModValueSlider(outRect, shadowColor.b, 0f, 2f, String.Format("{0}:{1:F2}", "B", shadowColor.b), lStyle); outRect.y += itemHeight + margin; shadowColor.a = drawModValueSlider(outRect, shadowColor.a, 0f, 1f, String.Format("{0}:{1:F2}", "A", shadowColor.a), lStyle); outRect.y += itemHeight + margin; } Color outlineColor = material.GetColor("_OutlineColor"); if (outlineColor != null) { GUI.Label(outRect, "Outline Color", lStyle); outRect.y += itemHeight + margin; outlineColor.r = drawModValueSlider(outRect, outlineColor.r, 0f, 2f, String.Format("{0}:{1:F2}", "R", outlineColor.r), lStyle); outRect.y += itemHeight + margin; outlineColor.g = drawModValueSlider(outRect, outlineColor.g, 0f, 2f, String.Format("{0}:{1:F2}", "G", outlineColor.g), lStyle); outRect.y += itemHeight + margin; outlineColor.b = drawModValueSlider(outRect, outlineColor.b, 0f, 2f, String.Format("{0}:{1:F2}", "B", outlineColor.b), lStyle); outRect.y += itemHeight + margin; outlineColor.a = drawModValueSlider(outRect, outlineColor.a, 0f, 1f, String.Format("{0}:{1:F2}", "A", outlineColor.a), lStyle); outRect.y += itemHeight + margin; } Color rimColor = material.GetColor("_RimColor"); if (rimColor != null) { GUI.Label(outRect, "Rim Color", lStyle); outRect.y += itemHeight + margin; rimColor.r = drawModValueSlider(outRect, rimColor.r, 0f, 2f, String.Format("{0}:{1:F2}", "R", rimColor.r), lStyle); outRect.y += itemHeight + margin; rimColor.g = drawModValueSlider(outRect, rimColor.g, 0f, 2f, String.Format("{0}:{1:F2}", "G", rimColor.g), lStyle); outRect.y += itemHeight + margin; rimColor.b = drawModValueSlider(outRect, rimColor.b, 0f, 2f, String.Format("{0}:{1:F2}", "B", rimColor.b), lStyle); outRect.y += itemHeight + margin; rimColor.a = drawModValueSlider(outRect, rimColor.a, 0f, 1f, String.Format("{0}:{1:F2}", "A", rimColor.a), lStyle); outRect.y += itemHeight + margin; } float? shininess = material.GetFloat("_Shininess"); if (shininess != null) { GUI.Label(outRect, "Shininess", lStyle); outRect.y += itemHeight + margin; shininess = drawModValueSlider(outRect, (float)shininess, 0f, 10f, String.Format(" {0:F2}", (float)shininess), lStyle); outRect.y += itemHeight + margin; } float? outlineWidth = material.GetFloat("_OutlineWidth"); if (outlineWidth != null) { GUI.Label(outRect, "OutlineWidth", lStyle); outRect.y += itemHeight + margin; outlineWidth = drawModValueSlider(outRect, (float)outlineWidth, 0f, 0.1f, String.Format(" {0:F5}", (float)outlineWidth), lStyle); outRect.y += itemHeight + margin; } float? rimPower = material.GetFloat("_RimPower"); if (rimPower != null) { GUI.Label(outRect, "RimPower", lStyle); outRect.y += itemHeight + margin; rimPower = drawModValueSlider(outRect, (float)rimPower, 0f, 100f, String.Format(" {0:F2}", (float)rimPower), lStyle); outRect.y += itemHeight + margin; } float? rimShift = material.GetFloat("_RimShift"); if (rimShift != null) { GUI.Label(outRect, "RimShift", lStyle); outRect.y += itemHeight + margin; rimShift = drawModValueSlider(outRect, (float)rimShift, 0f, 5f, String.Format(" {0:F2}", (float)rimShift), lStyle); outRect.y += itemHeight + margin; } string sharderName = material.shader.name; try { Shader mShader = material.shader; if (!InitialShaders.ContainsKey(material.name)) { if (mShader.name == "Hidden/InternalErrorShader") { InitialShaders.Add(material.name, null); } else { InitialShaders.Add(material.name, mShader); } } if (sColor.a < 1f) { if (sharderName.Contains("Outline")) { Shader shader = Shader.Find(sharderName.Replace("Outline", "Trans")); if (shader == null) { shader = Shader.Find("CM3D2/Toony_Lighted_Trans"); } material.shader = shader; } } else { material.shader = InitialShaders[material.name]; } } catch (Exception e) { DebugLog(e.StackTrace); } material.SetColor("_Color", sColor); if (shadowColor != null) material.SetColor("_ShadowColor", shadowColor); if (outlineColor != null) material.SetColor("_OutlineColor", outlineColor); if (rimColor != null) material.SetColor("_RimColor", rimColor); if (shininess != null) material.SetFloat("_Shininess", (float)shininess); if (outlineWidth != null) material.SetFloat("_OutlineWidth", (float)outlineWidth); if (rimPower != null) material.SetFloat("_RimPower", (float)rimPower); if (rimShift != null) material.SetFloat("_RimShift", (float)rimShift); outRect.y += margin * 3; } GUI.EndScrollView(); } outRect.x = margin; outRect.y = winRect.height - (itemHeight + margin) * 2; outRect.width = winRect.width - margin * 2; if (GUI.Button(outRect, "menu/mate保存", bStyle)) { TBody body = maid.body0; List<TBodySkin> goSlot = body.goSlot; int index = (int)global::TBody.hashSlotName[Slotnames[currentSlotname]]; global::TBodySkin tBodySkin = goSlot[index]; GameObject obj = tBodySkin.obj; if (obj == null) { return; } MaidProp prop = maid.GetProp(Slotnames[currentSlotname].ToLower()); if (prop != null) { targetMenuInfo = new MenuInfo(); if (targetMenuInfo.LoadMenufile(prop.strFileName)) { showSaveDialog = true; } } } outRect.y += itemHeight + margin; if (GUI.Button(outRect, "閉じる", bStyle)) { menuType = MenuType.Main; } GUI.DragWindow(); }
private bool MenuWrite(string path, string filename, MenuInfo menu) { byte[] cd = null; Dictionary<string, string> materials = new Dictionary<string, string>(); try { using (AFileBase aFileBase = global::GameUty.FileOpen(filename)) { if (!aFileBase.IsValid()) { ErrorLog("アイテムメニューファイルが見つかりません。", filename); return false; } cd = aFileBase.ReadAll(); } } catch (Exception ex2) { ErrorLog("アイテムメニューファイルが読み込めませんでした。", filename, ex2.Message); return false; } try { //.menuの保存 using (MemoryStream headerMs = new MemoryStream()) using (MemoryStream dataMs = new MemoryStream()) using (BinaryWriter headerWriter = new BinaryWriter(headerMs)) using (BinaryWriter dataWriter = new BinaryWriter(dataMs)) { using (BinaryReader binaryReader = new BinaryReader(new MemoryStream(cd), Encoding.UTF8)) { string text = binaryReader.ReadString(); if (text != "CM3D2_MENU") { ErrorLog("例外: ヘッダーファイルが不正です。" + text); return false; } headerWriter.Write(text); int num = binaryReader.ReadInt32(); headerWriter.Write(num); string txtpath = binaryReader.ReadString(); int pos = txtpath.LastIndexOf("/"); if (pos >= 0) { txtpath = txtpath.Substring(0, pos + 1) + Path.GetFileNameWithoutExtension(filename) + ".txt"; } headerWriter.Write(txtpath); string name = binaryReader.ReadString(); headerWriter.Write(menu.name); string category = binaryReader.ReadString(); headerWriter.Write(category); string comment = binaryReader.ReadString(); headerWriter.Write(menu.setumei.Replace("\n", MenuInfo.RET)); int num2 = (int)binaryReader.ReadInt32(); bool materialWrited = false; bool addItemWrited = false; while (true) { byte b = binaryReader.ReadByte(); int size = (int)b; if (size == 0) { dataWriter.Write((char)0); break; } string[] param = new string[size]; for (int i = 0; i < size; i++) { param[i] = binaryReader.ReadString(); } if (param[0] == "name") { param[1] = menu.name; } else if (param[0] == "setumei") { param[1] = menu.setumei.Replace("\n", MenuInfo.RET); } else if (param[0] == "priority") { param[1] = "9999"; } else if (param[0] == "icons") { param[1] = menu.icons + MenuInfo.EXT_TEXTURE; } else if (param[0] == "マテリアル変更") { if (!materialWrited) { materialWrited = true; foreach (var mat in menu.materials) { dataWriter.Write(b); dataWriter.Write("マテリアル変更"); dataWriter.Write(mat[0]); dataWriter.Write(mat[1]); dataWriter.Write(mat[2] + MenuInfo.EXT_MATERIAL); } } continue; } else if (param[0] == "additem") { if (!addItemWrited) { addItemWrited = true; foreach (var mat in menu.addItems) { dataWriter.Write(b); dataWriter.Write("additem"); dataWriter.Write(mat[0] + MenuInfo.EXT_MODEL); dataWriter.Write(mat[1]); } } continue; } dataWriter.Write(b); for (int i = 0; i < size; i++) { dataWriter.Write(param[i]); } } } using (BinaryWriter writer = new BinaryWriter(File.OpenWrite(Path.Combine(path, menu.filename + MenuInfo.EXT_MENU)))) { writer.Write(headerMs.ToArray()); writer.Write((int)dataMs.Length); writer.Write(dataMs.ToArray()); } } } catch (Exception e) { Debug.Log(e); return false; } return true; }
private void AddToHistoryMenuItems(MenuInfo srcMenu) { if (tsmHistory.DropDownItems.Count > 10) { tsmHistory.DropDownItems.RemoveAt(tsmHistory.DropDownItems.Count - 1); } RemoveIfExistInHistory(srcMenu); ToolStripMenuItem menuItem = new ToolStripMenuItem(); StringBuilder sb = new StringBuilder(); MenuInfo i = srcMenu; sb.Append(i.Text); while (i.ParentMenu != null) { sb.Insert(0, " - "); sb.Insert(0, i.ParentMenu.Text); i = i.ParentMenu; } string hisMenuText = sb.ToString(); menuItem.Text = hisMenuText; menuItem.Click += new EventHandler(HistoryMenuItem_Click); //menuItem.Image = form.Icon; MenuHistoryInfo menuHistoryInfo = new MenuHistoryInfo(); menuHistoryInfo.Name = hisMenuText; menuHistoryInfo.MenuName = srcMenu.Name; menuItem.Tag = menuHistoryInfo; tsmHistory.DropDownItems.Insert(0, menuItem); SaveHistoryMenuItems(); }
private void ExecuteMenu(MenuInfo menuInfo) { ActionInfo actionInfo = menuInfo.Action; if (menuInfo.Action != null) { actionInfo = ADInfoBll.Instance.GetActionInfo(menuInfo.Action.Name); } if (actionInfo == null) { return; } //System.Threading.AutoResetEvent are = new System.Threading.AutoResetEvent(false); Feng.Async.AsyncHelper.Start(new Feng.Async.AsyncHelper.DoWork(delegate() { //System.Threading.Thread.Sleep(100000); Form form = ExecuteAction(actionInfo); //are.Set(); return form; }), new Feng.Async.AsyncHelper.WorkDone(delegate(object result) { Form form = result as Form; // �����Url��ִ��Process��, Form = null if (form != null) { form.TabStop = false; if (menuInfo.AsDialog) { form.ShowDialog(this); form.Dispose(); form = null; } MyChildForm childForm = form as MyChildForm; if (childForm != null) { if (childForm.Icon == null && !string.IsNullOrEmpty(menuInfo.ImageName)) { childForm.Icon = PdnResources.GetIconFromImage(Feng.Windows.ImageResource.Get("Icons." + menuInfo.ImageName + ".png").Reference); } ShowChildForm(childForm); } } })); //are.WaitOne(); }
private static void TestMenu(MenuInfo menuInfo) { if (menuInfo.Name.StartsWith("System") || menuInfo.Name.StartsWith("报表")) { return; } m_stringExceptionProcess.AddLog("Now execute menu of " + menuInfo.Name); if (menuInfo.ChildMenus.Count == 0) { if (menuInfo.Action != null) { ActionInfo actionInfo = ADInfoBll.Instance.GetActionInfo(menuInfo.Action.Name); TestAction(actionInfo); } } else { foreach (MenuInfo subMenu in menuInfo.ChildMenus) { TestMenu(subMenu); } } }
private string BuildSideMenuItem(int displayMode, MenuInfo objMenuInfo, string pageLink, string caption) { StringBuilder html = new StringBuilder(); string title = objMenuInfo.PageName; pageLink = pageLink.Replace("&", "-and-"); string image = appPath + "/PageImages/" + objMenuInfo.IconFile; string imageTag = objMenuInfo.IconFile != string.Empty ? "<img src=" + image + ">" : ""; string arrowStyle = objMenuInfo.ChildCount > 0 ? "<span class='sf-sub-indicator'> »</span>" : ""; string firstclass = string.Empty; string activeClass = objMenuInfo.PageName == PageName ? " sfActive" : ""; string isParent = objMenuInfo.ChildCount > 0 ? (objMenuInfo.Level == 1 ? "class='sfParent level1 " + activeClass + "'" : "class='sfParent " + activeClass + "'") : (objMenuInfo.Level == 1 ? "class='level1 " + activeClass + "'" : "class='" + activeClass + "'"); switch (displayMode) { case 0://image only if (caption == "1") { html.Append("<a "); html.Append(isParent); html.Append(" href='"); html.Append(pageLink); html.Append("'><span class='sfPageicon'>"); html.Append(imageTag); html.Append("</span>"); html.Append(arrowStyle); html.Append("</a>"); } else { html.Append("<a "); html.Append(isParent); html.Append(" href='"); html.Append(pageLink); html.Append("'><span class='sfPageicon'>"); html.Append(imageTag); html.Append("</span>"); html.Append(arrowStyle); html.Append("</a>"); } break; case 1://text only if (caption == "1") { html.Append("<a "); html.Append(isParent); html.Append(" href='"); html.Append(pageLink); html.Append("'>"); html.Append(arrowStyle); html.Append("<span class='sfPagename'>"); html.Append(title); html.Append("</span></a>"); } else { html.Append("<a "); html.Append(isParent); html.Append(" href='"); html.Append(pageLink); html.Append("'>"); html.Append(arrowStyle); html.Append("<span class='sfPagename'>"); html.Append(title.Replace("-", " ")); html.Append("</span></a>"); } break; case 2://text and image both if (caption == "1") { html.Append("<a "); html.Append(isParent); html.Append(" href='"); html.Append(pageLink); html.Append("'>"); html.Append(arrowStyle); html.Append("<span class='sfPagename'>"); html.Append(title); html.Append("</span></a>"); } else { html.Append("<a "); html.Append(isParent); html.Append(" href='"); html.Append(pageLink); html.Append("'>"); html.Append(arrowStyle); html.Append("<span class='sfPagename'>"); html.Append(GetSideMenuPadding(objMenuInfo.Level)); html.Append(title.Replace("-", " ")); html.Append("</span></a>"); } break; } return html.ToString(); }
// Use this for initialization void Start () { GameObject MIObj = GameObject.Find ("Info"); MI = MIObj.GetComponent<MenuInfo> (); DontDestroyOnLoad (MI); }
private List<MenuInfo> GetRibbonMenuTags() { List<MenuInfo> tags = new List<MenuInfo>(); foreach (var downloader in Downloader.GetAllDownloaders()) { var attributes = downloader.GetType().GetCustomAttributes(typeof(DownloaderAttribute),true); if (attributes != null) { foreach (DownloaderAttribute att in attributes) { var tag = tags.Find(p => p.TagName == att.MenuGroup); if(tag == null){ tag = new MenuInfo() ; tags.Add(tag); } tag.TagName = att.MenuGroup; global::System.Resources.ResourceManager resourceMan = new global::System.Resources.ResourceManager("ComicDownloader.Properties.Resources", typeof(Resources).Assembly); RibbonButton button = new RibbonButton() { Image = resourceMan.GetObject(att.Image32) as Image, Tag = downloader, //Text = downloader.Name }; button.Click += new EventHandler(delegate(object sender, EventArgs e) { var dl = ((RibbonButton)sender).Tag as Downloader; AddChildForm(dl.Name, dl); }); tag.Downloaders.Add(button); } } } return tags; }
private void CheckMenuAdded() { var menus = db.Menus.Where(t => t.ModuleId == this.ModuleId).ToList(); if (menus.Count == 0) { var menu = new MenuInfo(); menu.ModuleId = this.ModuleId; db.Menus.Add(menu); db.SaveChanges(); } }