public void AddItem(GUIContent content, bool on, MenuFunction func) { //var parent = FindParent( content.text ); var item = FindOrCreateItem(content.text); item.Set(true /*on*/, null, func); }
public PartialViewResult Child(MenuFunction itemMenu, List <MenuFunction> listMenu, List <MenuFunction> AllMenu) { ViewBag.ItemMenu = itemMenu; ViewBag.AllMenuPermisstion = AllMenu; return(PartialView(listMenu)); }
private static void SaveShortcuts(MainMenu.MenuItemCollection menuItems) { foreach (MenuItem menuItem in menuItems) { NuGenBaseMenuInformation menuInformation = menuItem.Tag as NuGenBaseMenuInformation; if (menuInformation != null) { MenuFunction menuFunction = menuInformation.MenuFunction; NuGenMenuFunctionShortcut menuFunctionShortcut = new NuGenMenuFunctionShortcut(); menuFunctionShortcut.MenuFunction = menuFunction; menuFunctionShortcut.Shortcut = menuItem.Shortcut; NuGenMenuFunctionShortcut existingShortcut = Instance.FindMenuFunctionShortcut(menuFunction); if (existingShortcut != null) { Instance.Shortcuts.Remove(existingShortcut); } Instance.Shortcuts.Add(menuFunctionShortcut); } if (menuItem.MenuItems != null && menuItem.MenuItems.Count > 0) { SaveShortcuts(menuItem.MenuItems); } } }
public int CompareTo(object obj) { int result = 0; if (obj == null) { result = 1; } else { NuGenMenuFunctionShortcut otherShortcut = obj as NuGenMenuFunctionShortcut; if (otherShortcut != null) { result = MenuFunction.CompareTo(otherShortcut.MenuFunction); if (result == 0) { result = Shortcut.CompareTo(otherShortcut.Shortcut); } } else { throw new ArgumentException("Incorrect argument type: " + obj.GetType().FullName, "obj"); } } return(result); }
public MenuItem(GUIContent _content, bool _separator, bool _on, MenuFunction _func) { content = _content; separator = _separator; on = _on; func = _func; }
public void Remove(MenuFunction function) { if (Context.Entry(function).State == EntityState.Detached) { context.MenuFunctions.Attach(function); } context.MenuFunctions.Remove(function); }
public MenuItem(GUIContent _content, bool _on, MenuFunction _menuFunc) { if (_content.text.Contains("/")) { _content.text = _content.text.Substring(_content.text.LastIndexOf("/") + 1); } content = _content; on = _on; menuFunc = _menuFunc; }
public ActionResult Create(MenuFunction obj, bool SaveAndCountinue = false, string group = "") { if (String.IsNullOrEmpty(obj.MenuName) || String.IsNullOrWhiteSpace(obj.MenuName)) { ModelState.AddModelError("", FunctionHelper.GetLocalizeDictionary("Home", "notification")["menu_Name"]); ViewBag.DDLMenu = GetMenuList(); ViewBag.IconList = ListViewCustom.GetListIcon("~/Templates/AwesomeIcon.xml"); ViewBag.DDLMenuType = FunctionHelper.MenuType(); ViewBag.GroupID = group; return(View(obj)); } //ViewBag ViewBag.DDLMenu = GetMenuList(); ViewBag.IconList = ListViewCustom.GetListIcon("~/Templates/AwesomeIcon.xml"); ViewBag.DDLMenuType = FunctionHelper.MenuType(); ViewBag.GroupID = group; if (ModelState.IsValid) { obj.Id = Common.GenerateId(); obj.ControllerName = obj.ControllerName != null ? obj.ControllerName : string.Format("controller_{0}", obj.Id); obj.ActionName = obj.ActionName != null ? obj.ActionName : string.Format("action_{0}", obj.Id); obj.Url = string.Format("/{0}/{1}", obj.ControllerName, obj.ActionName); obj.Deleted = false; bool isSuccess = _MenuFunctionService.Create(obj); if (isSuccess) { //For cache CacheLayer.ClearAll(); //Write report MessageReport report = new MessageReport(true, FunctionHelper.GetLocalizeDictionary("Home", "notification")["addSuccess"]); WriteLog.Write(report, GetCurrentUser.GetUser(), obj.Id, obj.MenuName, "MenuFunction"); if (SaveAndCountinue) { TempData["Success"] = FunctionHelper.GetLocalizeDictionary("Home", "notification")["addSuccess"]; return(RedirectToAction("Create", "MenuFunction", new { controllername = obj.ControllerName, parentid = obj.ParentId, menytype = obj.MenuType, grouplist = obj.MenuGroupListId, group = group, ordernu = obj.OrderNumber + 1 })); } else { return(RedirectToAction("Index", new { group = group })); } } else { ModelState.AddModelError("", FunctionHelper.GetLocalizeDictionary("Home", "notification")["ErMenu"]); return(View(obj)); } } return(View()); }
public void DataBreadCrumbs(MenuFunction model, List <MenuFunction> listBreadCrumb) { //Truy vấn ngược dần lên các cấp menu cha rồi đưa vào một tập hợp var parentMenu = _MenuFunctionRepository.GetById(model.ParentId); if (parentMenu != null) { listBreadCrumb.Add(parentMenu); // Gọi lại cho đến hết (parentId==0 là hết) DataBreadCrumbs(parentMenu, listBreadCrumb); } }
public void AddMenuItem(GUIContent content, bool on, MenuFunction menuFunc) { MenuItem parent = Addheiracrhy(content.text); if (parent != null) { parent.subItems.Add(new MenuItem(content, on, menuFunc)); } else { items.Add(new MenuItem(content, on, menuFunc)); } }
public void AddItem(GUIContent content, bool on, MenuFunction func) { string path; MenuItem parent = AddHierarchy(ref content, out path); if (parent != null) { parent.subItems.Add(new MenuItem(path, content, func)); } else { menuItems.Add(new MenuItem(path, content, func)); } }
/// <summary> /// 增加数据 /// </summary> /// <param name="adminId">管理员id</param> /// <param name="appId">公众号appid</param> /// <returns></returns> public WebResult <bool> CreateMenu(string token) { //提交的微信格式类集合 List <MenuButton> menuList = new List <MenuButton>(); var list = GetList(x => !x.IsDelete); //加载第一级菜单 List <MpMenu> firstLevelMenu = list.Where(x => string.IsNullOrEmpty(x.ParentID)).ToList(); if (firstLevelMenu != null && firstLevelMenu.Count > 0) { foreach (var item in firstLevelMenu) { MenuButton menu = new MenuButton(); //查找该菜单是否有子级菜单 List <MpMenu> childrenList = list.Where(x => x.ParentID == item.ID).ToList(); if (childrenList != null && childrenList.Count != 0) { //有菜单 加载二级菜单 menu = MpMenuConvertToWxMenu(item, true); menu.SubButtonList = ListMpMenuConvertToWxMenu(childrenList); } else { menu = MpMenuConvertToWxMenu(item, false); } menuList.Add(menu); } } //发送 MenuFunction fuc = new MenuFunction(); if (fuc.MenuDelete(token)["state"].ToString() == "success") { if (fuc.MenuCreate(token, menuList)["errcode"].ToString() != "0") { return(Result(true)); } else { return(Result(false)); } } else { return(Result(false, "提交菜单到微信服务器出错")); } }
public ActionResult Update(MenuFunction obj, string group = "") { //ViewBag ViewBag.IconList = ListViewCustom.GetListIcon("~/Templates/AwesomeIcon.xml"); ViewBag.DDLMenuType = FunctionHelper.MenuType(); ViewBag.DDLMenu = GetMenuList(); ViewBag.GroupID = group; ViewBag.urlValue = url; if (!ModelState.IsValid) { return(View(obj)); } var oldObj = _MenuFunctionService.getById(obj.Id); if (oldObj == null) { return(View(obj)); } oldObj.MenuName = obj.MenuName; oldObj.ParentId = obj.ParentId; oldObj.OrderNumber = obj.OrderNumber; oldObj.MenuType = obj.MenuType; oldObj.Icon = obj.Icon; oldObj.Active = obj.Active; oldObj.ControllerName = obj.ControllerName != null ? obj.ControllerName : string.Format("controller_{0}", obj.Id); oldObj.ActionName = obj.ActionName != null ? obj.ActionName : string.Format("action_{0}", obj.Id); oldObj.Url = string.Format("/{0}/{1}", obj.ControllerName, obj.ActionName); var report = _MenuFunctionService.Update(oldObj); if (report.isSuccess) { CacheLayer.ClearAll(); return(RedirectToAction("Index", new { group = group })); } else { ModelState.AddModelError("", "Có lỗi xảy ra trong quá trình khởi tạo."); return(View(oldObj)); } }
private NuGenMenuFunctionShortcut FindMenuFunctionShortcut(MenuFunction menuFunction) { NuGenMenuFunctionShortcut result = null; int index = 0; while (result == null && index < Shortcuts.Count) { NuGenMenuFunctionShortcut menuFunctionShortcut = Shortcuts[index++]; if (menuFunctionShortcut.MenuFunction == menuFunction) { result = menuFunctionShortcut; } } return(result); }
public MasterMenuView GetInfo(string code) { using (var ctx = new ConXContext()) { MenuFunction model = ctx.MenuFunctions .Where(z => z.menuFunctionId == code).SingleOrDefault(); return(new MasterMenuView { menuFunctionId = model.menuFunctionId, menuFunctionGroupId = model.menuFunctionGroupId, menuFunctionName = model.menuFunctionName, menuURL = model.menuURL, iconName = model.iconName, orderDisplay = model.orderDisplay }); } }
public bool CheckDupplicate(string code) { using (var ctx = new ConXContext()) { MenuFunction model = ctx.MenuFunctions .Where(x => (x.menuFunctionId == code)) .SingleOrDefault(); bool isDup = model != null; //if (model != null) //{ // MenuFunctionGroup oldModel = ctx.MenuFunctionGroups.Where(z => z.branchGroupId == id).SingleOrDefault(); // isDup = code != oldModel.branchGroupCode; //} return(isDup); } }
public ActionResult Update(MenuFunction obj, string group = "") { //ViewBag ViewBag.IconList = ListViewCustom.GetListIcon("~/Templates/AwesomeIcon.xml"); ViewBag.DDLMenuType = FunctionHelper.MenuType(); ViewBag.GroupID = group; if (String.IsNullOrEmpty(obj.MenuName) || String.IsNullOrWhiteSpace(obj.MenuName)) { ModelState.AddModelError("", FunctionHelper.GetLocalizeDictionary("Home", "notification")["menu_Name"]); ViewBag.DDLMenu = GetMenuList(); ViewBag.IconList = ListViewCustom.GetListIcon("~/Templates/AwesomeIcon.xml"); ViewBag.DDLMenuType = FunctionHelper.MenuType(); ViewBag.GroupID = group; return(View(obj)); } if (ModelState.IsValid) { obj.ControllerName = obj.ControllerName != null ? obj.ControllerName : string.Format("controller_{0}", obj.Id); obj.ActionName = obj.ActionName != null ? obj.ActionName : string.Format("action_{0}", obj.Id); obj.Url = string.Format("/{0}/{1}", obj.ControllerName, obj.ActionName); bool isSuccess = _MenuFunctionService.Update(obj); ViewBag.DDLMenu = GetMenuList(); if (isSuccess) { CacheLayer.ClearAll(); MessageReport report = new MessageReport(true, FunctionHelper.GetLocalizeDictionary("Home", "notification")["updateSuccess"]); WriteLog.Write(report, GetCurrentUser.GetUser(), obj.Id, obj.MenuName, "MenuFunction"); return(RedirectToAction("Index", new { group = group })); } else { ModelState.AddModelError("", FunctionHelper.GetLocalizeDictionary("Home", "notification")["ErMenu"]); return(View(obj)); } } return(View()); }
public void Update(MasterMenuView model) { using (var ctx = new ConXContext()) { using (TransactionScope scope = new TransactionScope()) { MenuFunction updateObj = ctx.MenuFunctions.Where(z => z.menuFunctionId == model.menuFunctionId).SingleOrDefault(); updateObj.menuFunctionId = model.menuFunctionId; updateObj.menuFunctionGroupId = model.menuFunctionGroupId; updateObj.menuFunctionName = model.menuFunctionName; updateObj.menuURL = model.menuURL; updateObj.iconName = model.iconName; updateObj.orderDisplay = model.orderDisplay; ctx.SaveChanges(); scope.Complete(); } } }
public ActionResult Create(MenuFunction obj, bool SaveAndCountinue = false) { //ViewBag ViewBag.DDLMenu = GetMenuList(); ViewBag.IconList = ListViewCustom.GetListIcon("~/Templates/AwesomeIcon.xml"); ViewBag.DDLMenuType = FunctionHelper.MenuType(); ViewBag.urlValue = url; if (!ModelState.IsValid) { return(View(obj)); } obj.Id = Common.GenerateId(); obj.ControllerName = obj.ControllerName != null ? obj.ControllerName : string.Format("controller_{0}", obj.Id); obj.ActionName = obj.ActionName != null ? obj.ActionName : string.Format("action_{0}", obj.Id); obj.Url = string.Format("/{0}/{1}", obj.ControllerName, obj.ActionName); obj.IsDeleted = false; var report = _MenuFunctionService.Create(obj); if (report.isSuccess) { //For cache CacheLayer.ClearAll(); if (SaveAndCountinue) { TempData["Success"] = report.Message; return(RedirectToAction("Create", "MenuFunction", new { controllername = obj.ControllerName, parentid = obj.ParentId, menytype = obj.MenuType, ordernu = obj.OrderNumber + 1 })); } return(RedirectToAction("Index")); } else { ModelState.AddModelError("", "Có lỗi xảy ra trong quá trình khởi tạo."); return(View(obj)); } }
public bool Create(MenuFunction obj) { bool isSuccess = false; try { _MenuFunctionRepository.Add(obj); Save(); isSuccess = true; //Update BreadCrumb UpdateBreadCrumb(obj, "add"); } catch (Exception ex) { isSuccess = false; throw ex; } return(isSuccess); }
//Hàm trả về string BreadCrumb khi đã tập hợp đc các menu cha bắt đầu từ menu truyền vào public MenuFunction ListBreadCrumb(MenuFunction model) { var listb = new List <MenuFunction>(); listb.Add(model); // add cấp nhỏ nhất DataBreadCrumbs(model, listb); var b = "/"; if (listb.Any()) { for (int i = listb.Count; i > 0; i--) { var m = listb[i - 1]; b += m.Id + "/"; } } //dùng new MenuFunction làm nơi chứa tạm dữ liệu tìm đc return(new MenuFunction { Breadcrumb = b, Dept = listb.Count }); }
public MessageReport Update(MenuFunction obj) { var report = new MessageReport(false, "Có lỗi xảy ra"); try { _MenuFunctionRepository.Update(obj); Save(); report = new MessageReport(true, "Cập nhật thành công"); //Update BreadCrumb UpdateBreadCrumb(obj, "update"); } catch (Exception ex) { report = new MessageReport(false, ex.Message); } return(report); }
// Used for initialization void Start () { _gameStateInstance = this; players = new List<Team>(); players.Add(new Team(bocceBallPrefabTeam1, "BLUE TEAM", blueTeamBanner)); players.Add(new Team(bocceBallPrefabTeam2, "RED TEAM", redTeamBanner)); currentTeam = players[0]; ballSet = new List<GameObject>(); GameObject.Instantiate(playerPrefab); // now that the player is created, store a reference to its MouseLook component mouseLook = (MouseLook)FindObjectOfType(typeof(MouseLook)); GameObject.Instantiate(guiPrefab); mouseLook.toggleMouseLock(); menuFunction = resetGame; gameMenuMessage = "Play Next Round"; gameState = State.Menu; }
public void Create(MasterMenuView model) { using (var ctx = new ConXContext()) { using (TransactionScope scope = new TransactionScope()) { MenuFunction newObj = new MenuFunction() { menuFunctionId = model.menuFunctionId, menuFunctionGroupId = model.menuFunctionGroupId, menuFunctionName = model.menuFunctionName, menuURL = model.menuURL, iconName = model.iconName, orderDisplay = model.orderDisplay }; ctx.MenuFunctions.Add(newObj); ctx.SaveChanges(); scope.Complete(); } } }
public MessageReport Create(MenuFunction obj) { var report = new MessageReport(false, "Có lỗi xảy ra"); try { _MenuFunctionRepository.Add(obj); Save(); report = new MessageReport(true, "Thêm mới thành công"); //Update BreadCrumb UpdateBreadCrumb(obj, "add"); } catch (Exception ex) { report = new MessageReport(false, ex.Message); } _LogService.WriteLog(report, "MenuFunction", obj.Id, ActionConfig.Create, user); return(report); }
private void UpdateShortcuts(MainMenu.MenuItemCollection menuItems) { foreach (MenuItem menuItem in menuItems) { NuGenBaseMenuInformation menuInformation = menuItem.Tag as NuGenBaseMenuInformation; if (menuInformation != null) { MenuFunction menuFunction = menuInformation.MenuFunction; NuGenMenuFunctionShortcut menuFunctionShortcut = FindMenuFunctionShortcut(menuFunction); if (menuFunctionShortcut != null) { menuItem.Shortcut = menuFunctionShortcut.Shortcut; } } if (menuItem.MenuItems != null && menuItem.MenuItems.Count > 0) { UpdateShortcuts(menuItem.MenuItems); } } }
public void AddItem(GUIContent content, bool on, MenuFunction func) { string path; MenuItem parent = AddHierarchy (ref content, out path); if (parent != null) parent.subItems.Add (new MenuItem (path, content, func)); else menuItems.Add (new MenuItem (path, content, func)); }
public MenuItem(string _path, GUIContent _content, MenuFunction _func) { path = _path; content = _content; func = _func; }
private NuGenMenuFunctionShortcut FindMenuFunctionShortcut(MenuFunction menuFunction) { NuGenMenuFunctionShortcut result = null; int index = 0; while (result == null && index < Shortcuts.Count) { NuGenMenuFunctionShortcut menuFunctionShortcut = Shortcuts[index++]; if (menuFunctionShortcut.MenuFunction == menuFunction) { result = menuFunctionShortcut; } } return result; }
// determineGameState returns the state of the game after checking the game state variables // returns States Pallino_Throw, Bocce_Throw, or Menu public State determineGameState() { State currentGameState; // If a pallino ball has not been set, then the state is activated to begin the game if (currentPallinoBall == null) { currentGameState = State.Pallino_Throw; gameStateMessage = currentTeam.teamName + "'s pallino throw"; } // If all the balls have been thrown for a round, an appriopriate menuFunction is set // in order to start the next round or game else if(ballsThrown >= Constants.NUMBER_OF_BALLS_PER_TEAM * 2) { // set the state to menu so that player can have a moment to look at the game results currentGameState = State.Menu; mouseLook.toggleMouseLock(); // add the round score to the in-team's score currentWinningTeam.totalScore += currentWinningTeam.currentScore; // if the team has reached the max score possible, end the game if (currentWinningTeam.totalScore >= Constants.MAX_SCORE) { currentGameState = State.Menu; gameStateMessage = currentWinningTeam.teamName + " Wins!!!!"; gameMenuMessage = "Play Next Game"; menuFunction = resetGame; } // if the max score has not been reached, switch to the next round else { currentGameState = State.Menu; gameStateMessage = currentWinningTeam.teamName + " wins this round"; gameMenuMessage = "Play Next Round"; menuFunction = resetRound; } }else // there are still bocce balls to be thrown { currentGameState = State.Bocce_Throw; } return currentGameState; }
// Add an item to the menu public void AddItem(GUIContent content, bool on, MenuFunction func) { menuItems.Add(new MenuItem(content, false, on, func)); }
public void Set(bool enabled, Texture2D icon, MenuFunction func) { this.enabled = enabled; this.icon = icon; this.func = func; }
public AdvancedGenericMenuItem(string name, bool enabled, Texture2D icon, MenuFunction func) : base(name) { Set(enabled, icon, func); }
public void AddItem(GUIContent content, bool on, MenuFunction func) { this.menuItems.Add(new MenuItem(content, false, on, func)); }
public void AddItem(string name, bool on, MenuFunction func) { AddItem(new GUIContent(name), on, func); }
public NuGenBaseMenuInformation(MenuFunction menuFunction) : this() { MenuFunction = menuFunction; }
public MenuItem (string path, GUIContent content, MenuFunction func) { Path = path; Content = content; Func = func; }