protected void btnSave_ServerClick(object sender, EventArgs e) { try { int menuID = CurrentSelectMenuID; SystemMenu systemMenu = systemMenuServiceInstance.FindById(menuID); if (systemMenu != null) { systemMenu.MenuName = this.txtMenuName.Text.Trim(); systemMenu.MenuDescription = this.txtMenuDescription.Value.Trim(); systemMenu.MenuUrl = this.txtMenuUrl.Text.Trim(); systemMenuServiceInstance.Update(systemMenu); if (systemMenu.ParentMenuID == null) { BindManageMenuTreeByApplicationIDAndSelectNodeID(this.ddlSelectApplication.SelectedValue, "0"); } else { BindManageMenuTreeByApplicationIDAndSelectNodeID(this.ddlSelectApplication.SelectedValue, menuID.ToString()); } this.lblMessage.Text = "更新菜单成功!"; } else { BindManageMenuTreeByApplicationIDAndSelectNodeID(this.ddlSelectApplication.SelectedValue, "0"); } } catch (Exception ex) { this.lblMessage.Text = "系统错误:" + ex.Message; this.btnSave.Disabled = true; } }
public MainForm() { InitializeComponent(); Log(1, this, () => $"{ApplName} {AssemblyVersion} on Windows {OSVersion}"); _systemMenu = new SystemMenu(this); _systemMenu.AddCommand(R.SysMenuItemAbout, onSysMenuAbout, true); _systemMenu.AddCommand(R.SysMenuItemSettings, onSysMenuBasicSettings, false); _systemMenu.AddCommand($"{R.SysMenuItemHelp}\tF1", onSysMenuHelp, false); _progress = new ProgressProcessor(progressBarPart, progressBarTrack, lblProgress); _pgaNaming = new PGANaming(Settings) { RefreshDelegate = propGridNaming.Refresh }; _converter = new AaxAudioConverter(Settings, Resources.Default); initRadionButtons(); _lvwColumnSorter = new ListViewColumnSorter { SortModifier = ListViewColumnSorter.ESortModifiers.SortByTagOrText }; listViewAaxFiles.ListViewItemSorter = _lvwColumnSorter; listViewAaxFiles.Sorting = SortOrder.Ascending; _interactionHandler = new InteractionCallbackHandler <EInteractionCustomCallback> (this, customInteractionHandler); }
public async Task <IActionResult> Edit(int id, [Bind("MenuID,MenuTag,Name,Parentid,Icon,Controller,Action,Target,Href,State,Sort")] SystemMenu systemMenu) { if (id != systemMenu.MenuID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(systemMenu); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SystemMenuExists(systemMenu.MenuID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(systemMenu)); }
/// <summary> /// 根据ID更新信息 /// </summary> /// Author : Napoleon /// Created : 2015-01-26 16:21:38 public ActionResult UpdateMenu(string id, string projectName, string parentId, string htmlId, string url, string icon, string sort, string remark) { SystemMenu menu = new SystemMenu(); menu.Id = id; menu.Name = projectName; menu.ParentId = parentId; menu.HtmlId = htmlId; menu.Url = url; menu.Icon = icon; menu.Sort = Convert.ToDecimal(sort); menu.Remark = remark; menu.Operator = PublicFields.UserCookie.ReadCookie <SystemUser>().UserName; int count = _menuService.UpdateMenu(menu); string status = "failue", msg, json; switch (count) { case -1: msg = "该菜单已经存在,请不要使用重复的菜单名!"; break; case 1: status = "success"; msg = "更新成功!"; break; default: msg = "更新失败!"; break; } json = PublicFunc.ModelToJson(status, msg); return(Content(json)); }
/// <summary> /// 新增菜单 /// </summary> /// Author : Napoleon /// Created : 2015-01-24 16:19:31 public ActionResult SaveMenu(string projectName, string projectId, string parentId, string htmlId, string url, string icon, string sort, string remark) { SystemMenu menu = new SystemMenu(); menu.ProjectId = projectId; menu.Id = CustomId.GetCustomId(); menu.ParentId = string.IsNullOrWhiteSpace(parentId) ? "0" : parentId; menu.Name = projectName; menu.HtmlId = htmlId; menu.Url = url; menu.Icon = icon; menu.Sort = Convert.ToDecimal(sort); menu.Remark = remark; menu.Operator = PublicFields.UserCookie.ReadCookie <SystemUser>().UserName; int count = _menuService.InsertMenu(menu); string status = "failue", msg, json; switch (count) { case -1: msg = "添加失败,该菜单名称已经存在,请不要重复添加!"; break; case 1: status = "success"; msg = "添加成功!"; break; default: msg = "添加失败!"; break; } json = PublicFunc.ModelToJson(status, msg); return(Content(json)); }
public void Init() { systemMenu = null; systemMenu = new SystemMenu(); systemMenu.Init(); Debug.Log("初始化"); }
//[HttpGet(nameof(SystemMenu))] //public IActionResult SystemMenu() //{ // List<SystemMenuEntity> systemMenuEntities = new List<SystemMenuEntity>(); // using (SystemMenuDbContext dbContext = new SystemMenuDbContext()) // { // systemMenuEntities = dbContext.SystemMenus.Where(s => s.id > 0).ToList(); // } // SystemMenu rootNode = new SystemMenu() // { // Id = 0, // Icon = "", // Href = "", // Title = "根目录", // }; // GetTreeNodeListByNoLockedDTOArray(systemMenuEntities.ToArray(), rootNode); // MenusInfoResultDTO menusInfoResultDTO = new MenusInfoResultDTO(); // menusInfoResultDTO.MenuInfo = rootNode.Child; // menusInfoResultDTO.LogoInfo = new LogoInfo(); // menusInfoResultDTO.HomeInfo = new HomeInfo(); // return new JsonResult(menusInfoResultDTO); //} /// <summary> /// 递归处理数据 /// </summary> /// <param name="systemMenuEntities"></param> /// <param name="rootNode"></param> public static void GetTreeNodeListByNoLockedDTOArray(SystemMenuEntity[] systemMenuEntities, SystemMenu rootNode) { if (systemMenuEntities == null || systemMenuEntities.Count() <= 0) { return; } var childreDataList = systemMenuEntities.Where(p => p.pid == rootNode.Id); if (childreDataList != null && childreDataList.Count() > 0) { rootNode.Child = new List <SystemMenu>(); foreach (var item in childreDataList) { SystemMenu treeNode = new SystemMenu() { Id = item.id, Icon = item.icon, Href = item.href, Title = item.title, }; rootNode.Child.Add(treeNode); } foreach (var item in rootNode.Child) { GetTreeNodeListByNoLockedDTOArray(systemMenuEntities, item); } } }
private void FormMain_Load(object sender, EventArgs e) { _dropFileHandler = new DropFileHandler(this); _systemMenu = new SystemMenu(this); // add an item to the system menu _systemMenu.AppendSeparator(); _systemMenu.AppendMenu(_InstallSysMenuId, "Add to Folder Context Menu"); _systemMenu.AppendMenu(_AboutSysMenuId, "About FindFiles..."); _systemMenu.SysCommandEvent += new SystemMenu.SysCommandEventHandler(_systemMenu_SysCommandEvent); // accept path as command line arg string[] args = Environment.GetCommandLineArgs(); if (args.Length > 1) { textPath.Text = args[1]; } // restore previous settings try { RegistryKey key = Registry.CurrentUser.CreateSubKey(@"Software\BrettRobichaud\FindFiles"); _includeAttributes = (FileAttributes)key.GetValue("IncludedAttributes", 32759); _excludeAttributes = (FileAttributes)key.GetValue("ExcludedAttributes", 0); } catch { } }
/// <summary> /// 添加新SystemMenu记录 /// </summary> /// <param name="model">SystemMenu实体对象</param> /// <returns>新插入数据的id</returns> public static int Insert(SystemMenu model, SqlConnection conn = null, SqlTransaction transaction = null) { var sql = new StringBuilder(); sql.Append("INSERT INTO [SystemMenu]([Name], [ParentId], [ActionRoute], [Icon], [Type], [Sort], [IsUse], [Remark], [CreatedTime])"); sql.Append(" OUTPUT INSERTED.[Id] "); sql.Append("VALUES(@Name, @ParentId, @ActionRoute, @Icon, @Type, @Sort, @IsUse, @Remark, @CreatedTime)"); var ret = 0; if (conn != null) { if (transaction == null) { throw new ArgumentNullException("transaction"); } ret = conn.ExecuteScalar <int>(sql.ToString(), model, transaction); } else { using (var conn1 = GetOpenConnection()) { ret = conn1.ExecuteScalar <int>(sql.ToString(), model); } } return(ret); }
public static Dictionary <string, List <SystemMenu> > GetSystemMenu() { Dictionary <string, List <SystemMenu> > Menu = new Dictionary <string, List <SystemMenu> >(); XmlDocument xDoc = new XmlDocument(); Assembly asm = Assembly.GetExecutingAssembly(); string fileName = System.IO.Path.GetDirectoryName(asm.Location) + "\\ui.xml"; xDoc.Load(fileName); XmlNode xNode = xDoc.SelectSingleNode("//configuration"); foreach (XmlNode item in xNode.SelectNodes("menu")) { List <SystemMenu> m = new List <SystemMenu>(); string name = item.Attributes["name"].InnerText; foreach (XmlNode sitem in item.SelectNodes("sub")) { SystemMenu sm = new SystemMenu(); sm.Title = sitem.InnerText; sm.Discription = sitem.Attributes["des"].InnerText; sm.URL = sitem.Attributes["url"].InnerText; //sm.IsDialog = Convert.ToBoolean( sitem.Attributes["isdialog"].InnerText); //sm.ParentURL = sitem.Attributes["parent"].InnerText; if ((Convert.ToUInt32(sitem.Attributes["role"].InnerText) & Convert.ToUInt32(CurUserInfo.UserRoleType)) != 0) { m.Add(sm); } } Menu.Add(name, m); } return(Menu); }
public RightClickTitleBarDialog(Form frm) { this.form = frm; try { m_SystemMenu = SystemMenu.FromForm(frm); m_SystemMenu.AppendSeparator(); if (FrameworkParams.isSupportDeveloper) m_SystemMenu.AppendMenu(m_FormInfo, MENU_TITLE_FORM_INFO_TEXT); if (this is IFormRefresh) { m_SystemMenu.AppendMenu(m_RefreshForm, MENU_TITLE_FORM_REFRESH_TEXT); } if (this is IFormFURL) { m_SystemMenu.AppendMenu(m_FURL, MENU_TITLE_FORM_FURL_TEXT); } m_SystemMenu.AppendSeparator(); } catch (NoSystemMenuException /* err */ ) { // Do some error handling } }
private void InitSystemMenu() { var systemMenu = new SystemMenu(this, this); var resizeMenuItem = systemMenu.CreateMenuItem("&Resize..."); resizeMenuItem.Clicked += delegate { new FormResizeWindow(this).ShowDialog(this); }; var alwaysOnTopMenuItem = systemMenu.CreateMenuItem("Always on &top"); alwaysOnTopMenuItem.Clicked += delegate { var alwaysOnTop = !alwaysOnTopMenuItem.Checked; TopMost = alwaysOnTop; alwaysOnTopMenuItem.Checked = alwaysOnTop; systemMenu.UpdateMenu(alwaysOnTopMenuItem); }; uint pos = 5; systemMenu.InsertSeparator(pos++); systemMenu.InsertMenu(pos++, resizeMenuItem); systemMenu.InsertMenu(pos++, alwaysOnTopMenuItem); }
private void GoToFrom(SystemMenu menu, object action) { if (menu != null) { IVX.Live.MainForm.UILogics.FormBase f = c.GetContentPage(menu.URL); if (f == null) { return; } //if (menu.IsDialog) //{ // f.WindowState = FormWindowState.Normal; // //f.Size = this.Size; // f.StartPosition = FormStartPosition.CenterParent; // f.ShowDialog(); //} //else { f.MdiParent = this; //this.ActivateMdiChild(f); labelX2.Text = "当前位置:" + menu.Title; m_currentForm = menu; f.Size = new Size(this.Width - panelEx4.Width, panelEx4.Height + 20); f.Show(); f.Activate(); if (action != null) { f.DoAction(action); } } //if (!string.IsNullOrEmpty(menu.ParentURL)) //{ // IVX.Live.MainForm.UILogics.FormBase f1 = c.GetContentPage(menu.ParentURL); // f1.MdiParent = this; // this.ActivateMdiChild(f1); // f1.Show(); // f1.UpdateUI(); //} string parentMenu = ""; Dictionary <string, List <SystemMenu> > dt = Framework.Environment.GetSystemMenu(); foreach (var item in dt) { foreach (SystemMenu it in item.Value) { if (it.URL == menu.URL) { parentMenu = item.Key; break; } } if (!string.IsNullOrEmpty(parentMenu)) { break; } } if (!string.IsNullOrEmpty(parentMenu)) { sideBar1.GetItem("sideBarPanelItem" + parentMenu).Expanded = true; } } }
private List <SystemMenu> GetMainList(SystemMenu mainMenu) { List <SystemMenu> subList; switch (mainMenu.MenuID) { case 1000: subList = new List <SystemMenu>(); subList.Add(new SystemMenu(10000, "系统应用管理", this.ResolveUrl("~/Module/FrameWork/SystemApplicationManage/ApplicationManage/ListPage.aspx"), "", true)); subList.Add(new SystemMenu(10000, "系统角色管理", this.ResolveUrl("~/Module/FrameWork/SystemApplicationManage/RoleManage/ListPage.aspx"), "", true)); subList.Add(new SystemMenu(10000, "系统菜单管理", this.ResolveUrl("~/Module/FrameWork/SystemApplicationManage/MenuManage/ListPage.aspx"), "", true)); subList.Add(new SystemMenu(10000, "系统字典管理", this.ResolveUrl("~/Module/FrameWork/SystemApplicationManage/DictionaryManage/ListPage.aspx"), "", true)); subList.Add(new SystemMenu(10000, "系统事件查看", this.ResolveUrl("~/Module/FrameWork/SystemApplicationManage/LogEventView/ListPage.aspx"), "", true)); subList.Add(new SystemMenu(10000, "系统用户管理", this.ResolveUrl("~/Module/FrameWork/SystemApplicationManage/DictionaryManage/WebForm1.aspx"), "", true)); subList.Add(new SystemMenu(10000, "系统部门管理", this.ResolveUrl("~/Module/FrameWork/SystemApplicationManage/DepartmentManage/ListPage.aspx"), "", true)); subList.Add(new SystemMenu(10000, "系统用户组管理", this.ResolveUrl("~/Module/FrameWork/SystemApplicationManage/UserGroupManage/ListPage.aspx"), "", true)); subList.Add(new SystemMenu(10000, "短消息中心", this.ResolveUrl("~/Module/FrameWork/SystemApplicationManage/ShortMessageManage/ListPage.aspx"), "", true)); break; case 2000: subList = new List <SystemMenu>(); subList.Add(new SystemMenu(10000, "测试数据", this.ResolveUrl("~/Module/FrameWork/SystemApplicationManage/ApplicationManage/WebForm1.aspx"), "", true)); break; default: subList = new List <SystemMenu>(); subList.Add(new SystemMenu(10000, "测试数据", this.ResolveUrl("#"), "", true)); break; } return(subList); }
public ActionResult Create([FromForm] SaveMenuModel model) { // TODO: Add insert logic here //查询是否存在该菜单 if (SystemMenuHelper.Exists(p => p.Name == model.ControllName && p.ActionRoute == model.ControllUrl)) { return(Json(ResponseHelper.Error("该菜单已经存在了!"))); } var MenuModel = new SystemMenu { ActionRoute = model.ControllUrl.ToLower(), CreatedTime = DateTime.Now, Icon = model.Icon, IsUse = Convert.ToBoolean(model.Status), Name = model.ControllName, ParentId = Convert.ToInt32(model.ParentCode), Remark = model.Remark, Sort = model.Sort, Type = model.ControllType }; var menuId = SystemMenuHelper.Insert(MenuModel); //给系统预留角色把权限绑上 RoleAuthMappingHelper.Insert(new RoleAuthMapping { CreatedTime = DateTime.Now, MenuId = menuId, RoleId = 1 }); if (CacheUser.UId == "1") { CacheUser.AuthMenu.Add(menuId); HttpContext.Session.SetString("UserInfo", JsonConvert.SerializeObject(CacheUser)); } return(Json(ResponseHelper.Success("ok"))); }
/// <summary> /// 初始化菜单递归 /// </summary> /// <param name="xml"></param> private void init_list(XElement xml) { foreach (var item in xml.Elements()) { if (item.Attribute("Code") != null && item.Attribute("Code").Value != "") { string code = item.Attribute("Code").Value; SystemMenu _menu = _SystemMenuService.GetWhere(m => m.Code.ToLower() == code.ToLower()).FirstOrDefault(); if (_menu != null) { //修改 init(item, _menu); _SystemMenuService.Edit(_menu); } else { //添加 _menu = new SystemMenu(); init(item, _menu); _SystemMenuService.Add(_menu); } _SystemMenuService.Save(); init_list(item); } } }
private void GoToFrom(SystemMenu menu, object action) { if (menu != null) { IVX.Live.MainForm.UILogics.FormBase f = c.GetContentPage(menu.URL); if (f == null) { return; } //if (menu.IsDialog) //{ // f.WindowState = FormWindowState.Normal; // //f.Size = this.Size; // f.StartPosition = FormStartPosition.CenterParent; // f.ShowDialog(); //} //else { f.MdiParent = this; //this.ActivateMdiChild(f); m_currentForm = menu; f.Show(); f.Activate(); if (action != null) { f.DoAction(action); } } } }
/// <summary> /// 保存菜单权限配置 /// </summary> /// <param name="roleid">角色ID</param> /// <param name="arrayMune">菜单集合</param> /// <returns></returns> public ActionResult SaveRoleMenu(string roleid, List <RoleMenuOrButtonModel> arrayMune)//string roleid, IList<RoleMenuModel> menuArray { try { SystemRole role = _SystemRoleService.GetKey(roleid); List <SystemMenu> menuList = _SystemMenuService.GetAll().ToList(); if (role != null) { role.Menu.Clear(); //arrayMune若为null则实例化一个空对象 foreach (RoleMenuOrButtonModel model in arrayMune == null ? new List <RoleMenuOrButtonModel>() : arrayMune) { Predicate <SystemMenu> match = delegate(SystemMenu m) { if (m.Id == model.Menu) { return(true); } else { return(false); } }; SystemMenu menu = menuList.Find(match); //_SystemMenuService.GetKey(model.Menu); role.Menu.Add(menu); } _SystemRoleService.Edit(role); _SystemRoleService.Save(); return(Json(new { Code = 1, msg = "保存成功" }, JsonRequestBehavior.AllowGet)); } return(Json(new { Code = -1, msg = "保存失败" }, JsonRequestBehavior.AllowGet)); } catch (Exception error) { return(Json(new { Code = -1, msg = "保存失败:" + error.Message }, JsonRequestBehavior.AllowGet)); } }
public async Task <IActionResult> OnPostSaveAsync() { if (!ModelState.IsValid) { return(ModelState.ToJsonResult()); } var entity = await _db.Menus .Where(x => x.Id == this.Id) .SingleOrDefaultAsync(); if (entity == null) { entity = new SystemMenu { Id = this.Id ?? Guid.NewGuid(), CreatedBy = this.User.Identity.Name, CreatedDate = DateTime.Now, }; _db.Add(entity); } entity.Name = this.Data.Name; entity.ParentId = this.Data.ParentId; entity.UpdatedBy = this.User.Identity.Name; entity.UpdatedDate = DateTime.Now; await _db.SaveChangesAsync(); return(new SuccessResult()); }
public SystemMenu FindNextMenu(SystemMenu systemMenu) { if (systemMenu == null) { throw new ArgumentNullException("systemMenu", "systemMenu not allow null."); } DetachedCriteria menuCriteria = DetachedCriteria.For(typeof(SystemMenu)); //同一子菜单下 if (systemMenu.ParentMenuID == null) { menuCriteria.Add(SystemMenuDao.PROPERTY_PARENTMENUID.IsNull()); } else { menuCriteria.Add(SystemMenuDao.PROPERTY_PARENTMENUID.Eq(systemMenu.ParentMenuID)); } //Order大于当前菜单 menuCriteria.Add(SystemMenuDao.PROPERTY_MENUORDER.Gt(systemMenu.MenuOrder)); //最小序号的菜单 menuCriteria.AddOrder(SystemMenuDao.PROPERTY_MENUORDER.Asc()); List <SystemMenu> listMenu = this.FindListByDetachedCriteriaQuery(menuCriteria); if (listMenu.Count <= 0) { return(null); } else { return(listMenu[0]); } }
/// <summary> /// /// </summary> /// <param name="request"></param> /// <param name="cancellationToken"></param> /// <returns></returns> public async Task <HandleResultDto> Handle(CreateMenuCommand request, CancellationToken cancellationToken) { if (string.IsNullOrEmpty(request.Id)) { var menu = new SystemMenu(request.Name, request.Code, request.Address, request.Icon, request.MenuType, request.ParentId); await _systemMenuRepository.AddAsync(menu, cancellationToken); } else { var menu = await _systemMenuRepository.GetAsync(request.Id, cancellationToken); if (menu != null) { menu.UpdateMenu(request.Name, request.Code, request.Address, request.Icon, request.MenuType, request.ParentId); await _systemMenuRepository.UpdateAsync(menu, cancellationToken); } } await _systemMenuRepository.UnitOfWork.SaveEntitiesAsync(cancellationToken); return(new HandleResultDto { State = 1 }); }
public JsonResult SaveSystemMenu(string menu, string menucode) { JavaScriptSerializer serializer = new JavaScriptSerializer(); SystemMenu model = serializer.Deserialize <SystemMenu>(menu); bool flag = false; if (!string.IsNullOrEmpty(model.MenuCode)) { flag = ManageSystemBusiness.UpdateSystemMenu(model); } else { if (string.IsNullOrEmpty(model.PCode)) { model.PCode = "100000000"; } model.MenuCode = menucode; model.Type = 2; flag = ManageSystemBusiness.AddSystemMenu(model); } JsonDictionary.Add("Result", flag?1:0); return(new JsonResult() { Data = JsonDictionary, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); }
protected void btnDelete_ServerClick(object sender, EventArgs e) { try { int menuID = CurrentSelectMenuID; int parentMenuID = 0; SystemMenu systemMenu = systemMenuServiceInstance.FindById(menuID); if (systemMenu != null) { if (systemMenu.ParentMenuID != null) { parentMenuID = systemMenu.ParentMenuID.MenuID; } systemMenuServiceInstance.Delete(systemMenu); BindManageMenuTreeByApplicationIDAndSelectNodeID(this.ddlSelectApplication.SelectedValue, parentMenuID.ToString()); this.lblMessage.Text = "删除菜单成功!"; } else { BindManageMenuTreeByApplicationIDAndSelectNodeID(this.ddlSelectApplication.SelectedValue, "0"); } } catch (Exception ex) { this.lblMessage.Text = "系统错误:" + ex.Message; this.btnSave.Disabled = true; } }
protected void btnReSorted_ServerClick(object sender, EventArgs e) { try { int menuID = CurrentSelectMenuID; if (menuID > 0) { SystemMenu systemMenu = systemMenuServiceInstance.FindById(menuID); systemMenuServiceInstance.ReSortedSubmenu(systemMenu); BindManageMenuTreeByApplicationIDAndSelectNodeID(this.ddlSelectApplication.SelectedValue, menuID.ToString()); } else { systemMenuServiceInstance.ReSortedSubmenu(null); BindManageMenuTreeByApplicationIDAndSelectNodeID(this.ddlSelectApplication.SelectedValue, "0"); } this.lblMessage.Text = "菜单重新排序成功!"; } catch (Exception ex) { this.lblMessage.Text = "系统错误:" + ex.Message; this.btnSave.Disabled = true; } }
public Menu(IBaseService <SystemMenu> service, SystemMenu menu) { Id = menu.Id; Name = menu.Name; Url = menu.Url; Icon = menu.Icon; _service = service; }
protected void LeftMenu_ItemDataBound(object sender, RepeaterItemEventArgs e) { SystemMenu mainMenu = (SystemMenu)e.Item.DataItem; Repeater LeftSubID = (Repeater)e.Item.FindControl("LeftMenu_Sub"); LeftSubID.DataSource = GetMainList(mainMenu); LeftSubID.DataBind(); }
void EnableCancel() { if (!btnCancel.Enabled) { SystemMenu.EnableCloseButton(this); } btnCancel.Enabled = true; }
void DisableCancel() { if (btnCancel.Enabled) { SystemMenu.DisableCloseButton(this); } btnCancel.Enabled = false; }
//Planete actuelle void Start() { Init(); generationGalaxy(); mainMenuAnim = MainMenu.GetComponent <Animator>(); systemMenuAnim = SystemMenu.GetComponent <Animator>(); planetMenuAnim = PlanetMenu.GetComponent <Animator>(); }
public MainForm() { InitializeComponent(); // Create instance and connect it with the Form systemMenu = new SystemMenu(this); // Define commands and handler methods // (Deferred until HandleCreated if it's too early) // IDs are counted internally, separator is optional systemMenu.AddCommand("&About…", OnSysMenuAbout, true); }
public async Task <IActionResult> Edit(NullableIdInput input) { SystemMenu menu = new SystemMenu(); if (!input.Id.IsNullOrEmptyGuid()) { menu = await _systemMenuLogic.GetById(input.Id); } return(View(menu)); }
/// <summary> /// 保存模块数据 /// </summary> /// <param name="entity">模块实体</param> public ActionResult Save(SystemMenu entity) { var hasResult = service.Exists(entity); if (hasResult.Failure) { return Json(hasResult); } var result = entity.Id == 0 ? service.Insert(entity) : service.Update(entity); return JsonText(new JsonMessage(result)); }
public FormMasterData(ImageList slotItemImageList) { InitializeComponent(); lvShip.ListViewItemSorter = Comparer<MasterData.Ship.ShipMasterLVItem>.Default; lvSlotItem.ListViewItemSorter = Comparer<MasterData.Item.SlotItemMasterLVItem>.Default; lvSType.ListViewItemSorter = Comparer<MasterData.Ship.ShipTypeLVItem>.Default; lvSlotItem.SmallImageList = slotItemImageList; var sm = new SystemMenu(this); sm.InsertMenuItem(2, "ウィンドウ復帰", 6); }
// Retrieves a new object from a Form object public static SystemMenu FromForm(Form Frm) { SystemMenu cSysMenu = new SystemMenu(); cSysMenu.m_SysMenu = apiGetSystemMenu(Frm.Handle, 0); if (cSysMenu.m_SysMenu == IntPtr.Zero) { // Throw an exception on failure return null; } return cSysMenu; }
// Retrieves a new object from a Form object public static SystemMenu FromForm(Form form) { SystemMenu systemMenu = new SystemMenu(); systemMenu.hSystemMenu = apiGetSystemMenu(form.Handle, 0); if (systemMenu.hSystemMenu == IntPtr.Zero) { // Throw an exception on failure throw new NoSystemMenuException(); } return systemMenu; }
public MainWindow() { InitializeComponent(); // Locate startLabel to the center of the screen UpdateStartLabel(); sMenu = SystemMenu.FromForm(this); sMenu.AppendSeparator(); sMenu.AppendMenu(11, "Показать меню"); sMenu.AppendMenu(22, "Скрыть меню"); }
public static SystemMenu GetSystemMenu(string menuCode) { SystemMenu item = new SystemMenu(); DataTable dt = SystemDAL.BaseProvider.GetSystemMenu(menuCode); if (dt.Rows.Count > 0) { item.FillData(dt.Rows[0]); if (!string.IsNullOrEmpty(item.PCode)) item.PCodeName = GetSystemMenu(item.PCode).Name; } return item; }
/// <summary> /// 根据Id查询 /// </summary> /// <param name="id">id</param> /// Author : Napoleon /// Created : 2015-01-24 15:11:11 public SystemMenu GetMenu(string id) { SystemMenu menu = new SystemMenu(); try { string sql = "SELECT ProjectId,Id,Name,ParentId,HtmlId,Url,Icon,Sort,Remark,Operator FROM dbo.System_Menu WHERE Id=@Id order by Sort"; menu = DbHelper.GetEnumerable<SystemMenu>(sql, new { @Id = id }); } catch (Exception exception) { Log4Dao.InsertLog4(exception.Message); } return menu; }
public static List<SystemMenu> GetSystemMenus() { List<SystemMenu> list = new List<SystemMenu>(); DataTable dt = SystemDAL.BaseProvider.GetSystemMenus(); SystemMenu model; foreach (DataRow item in dt.Rows) { model = new SystemMenu(); model.FillData(item); if (!string.IsNullOrEmpty(model.PCode)) model.PCodeName = GetSystemMenu(model.PCode).Name; list.Add(model); } return list; }
public ActionResult MenuDetail(string id) { var model = new SystemMenu(); var menuCode = string.Empty; var pCodeName=string.Empty; if (!string.IsNullOrEmpty(id)) { model = ManageSystemBusiness.GetSystemMenu(id); menuCode = model.MenuCode; pCodeName = model.PCodeName; } ViewBag.Model = model; ViewBag.MenuCode = menuCode; ViewBag.PCodeName = pCodeName; ViewBag.Layer = 1; ViewBag.PCode = string.Empty; return View(); }
public ActionResult AddSubMenu(string id) { var model = new SystemMenu(); var menuCode = string.Empty; var pCode = string.Empty; var pCodeName = string.Empty; var layer = 0; model = ManageSystemBusiness.GetSystemMenu(id); pCode = model.MenuCode; pCodeName = model.Name; layer = model.Layer+1; ViewBag.PCode = pCode; ViewBag.PCodeName = pCodeName; ViewBag.Layer = layer; ViewBag.Model = new SystemMenu(); ViewBag.MenuCode = menuCode; return View("MenuDetail"); }
/// <summary> /// 添加菜单列表 /// </summary> /// <param name="dbContext">DbContext</param> /// <param name="parentMenu">父级菜单名</param> /// <param name="menus">菜单名列表</param> public static void AppendSystemMenus(WarehouseEntryDbContext dbContext, string parentMenu, List<string> menus) { if (dbContext == null) { throw new ArgumentNullException("dbContext"); } if (menus == null) { throw new ArgumentNullException("menus"); } if (menus.Any(string.IsNullOrWhiteSpace)) { throw new InvalidEnumArgumentException("menus"); } SystemMenu parentDataMenu = null; if (!string.IsNullOrWhiteSpace(parentMenu)) { parentDataMenu = dbContext.SystemMenu.FirstOrDefault(m => m.MenuName == parentMenu); } if (parentDataMenu == null) { parentDataMenu = new SystemMenu { MenuName = parentMenu, Enabled = true }; } List<SystemMenu> dataMenus = dbContext.SystemMenu.Where(m => menus.Contains(m.MenuName)).ToList(); foreach (SystemMenu dataMenu in dataMenus) { menus.Remove(dataMenu.MenuName); } dbContext.SystemMenu.AddRange(menus.Select(m => new SystemMenu { ParentMenu = parentDataMenu, MenuName = m, Enabled = true })); dbContext.SaveChanges(); }
public FormLog(LogManager.LogManager logManager) { InitializeComponent(); //非表示でもウィンドウハンドルを生成させる。さもなくば、Invokeが失敗する IntPtr wndHandle = Handle; lvBattle.DoubleBuffer(true); lvItem.DoubleBuffer(true); lvMaterials.DoubleBuffer(true); lvMission.DoubleBuffer(true); lvShip.DoubleBuffer(true); chartMaterial.DataSource = logManager.InitMaterialDataTable(); chartMaterial.DataBind(); /* フォームは開かれていないのでLoadは呼ばれないが、 * フォームが開かれる前にログ追加が行われるとデータの順番が腐る */ if (!Properties.Settings.Default.LogFormBounds.IsEmpty) Bounds = Properties.Settings.Default.LogFormBounds; lvBattle.LoadColumnWithOrder(Properties.Settings.Default.LogBattleColumnWidth); lvItem.LoadColumnWithOrder(Properties.Settings.Default.LogItemColumnWidth); lvMaterials.LoadColumnWithOrder(Properties.Settings.Default.LogMaterialColumnWidth); lvMission.LoadColumnWithOrder(Properties.Settings.Default.LogMissionColumnWidth); lvShip.LoadColumnWithOrder(Properties.Settings.Default.LogShipColumnWidth); logManager.AttachLogControls(lvShip, lvItem, lvBattle, lvMission, lvMaterials,chartMaterial,this); _logManager = logManager; Text += string.Format("(Store:{0})", logManager.LogStore.StoreType); var sm = new SystemMenu(this); sm.InsertMenuItem(3, "ウィンドウ復帰", 6); }
/// <summary> /// 添加系统菜单 /// </summary> /// <param name="entity">系统菜单实体</param> public BoolMessage Insert(SystemMenu entity) { try { repos.Insert(entity); return BoolMessage.True; } catch (Exception e) { return new BoolMessage(false, e.Message); } }
/// <summary> /// 更新菜单 /// </summary> /// <param name="menu">The menu.</param> /// Author : Napoleon /// Created : 2015-01-26 16:06:40 public int UpdateMenu(SystemMenu menu) { int count; try { string sql = "UPDATE dbo.System_Menu SET Name=@name,ParentId=@parentId,HtmlId=@htmlId,Url=@url,Icon=@icon,Sort=@sort,Remark=@remark,Operator=@operator WHERE Id=@id"; count = DbHelper.ExecuteSql(sql, menu); } catch (Exception exception) { count = -1; Log4Dao.InsertLog4(exception.Message); } return count; }
/// <summary> /// 新增菜单 /// </summary> /// <param name="menu">The menu.</param> /// Author : Napoleon /// Created : 2015-01-26 14:18:32 public int InsertMenu(SystemMenu menu) { int i; try { string sql = "INSERT INTO dbo.System_Menu (ProjectId ,Id ,Name ,ParentId,HtmlId ,Url ,Icon, Sort ,Remark ,Operator) VALUES(@ProjectId,@Id,@Name,@ParentId,@HtmlId,@Url,@Icon,@Sort,@Remark,@Operator)"; i = DbHelper.ExecuteSql(sql, menu); } catch (Exception exception) { i = -1; Log4Dao.InsertLog4(exception.Message); } return i; }
private void AddSysMenuItems() { _systemMenu = new SystemMenu(Handle); var popMen = _systemMenu.CreatePopupMenuItem(); for (var i = 0; i <= Screen.AllScreens.Length - 1; i++) { SysMenSubItems[i] = 200 + i; _systemMenu.AppendMenuItem(popMen, SystemMenu.Flags.MF_STRING, new IntPtr(SysMenSubItems[i]), Language.strScreen + " " + Convert.ToString(i + 1)); } _systemMenu.InsertMenuItem(_systemMenu.SystemMenuHandle, 0, SystemMenu.Flags.MF_POPUP | SystemMenu.Flags.MF_BYPOSITION, popMen, Language.strSendTo); _systemMenu.InsertMenuItem(_systemMenu.SystemMenuHandle, 1, SystemMenu.Flags.MF_BYPOSITION | SystemMenu.Flags.MF_SEPARATOR, IntPtr.Zero, null); }
public static bool AddSystemMenu(SystemMenu systemMenu) { return SystemDAL.BaseProvider.AddSystemMenu(systemMenu.MenuCode,systemMenu.Name,systemMenu.Controller,systemMenu.View,systemMenu.PCode,systemMenu.Sort,systemMenu.Layer,systemMenu.Type); }
private void CustomizeMenu(bool updateMenuChecked) { // Reset current system menu SystemMenu.ResetSystemMenu(this); // Add custom menuitems to system menu systemMenu = SystemMenu.FromForm(this); //systemMenu.AppendSeparator(); if (updateMenuChecked) { systemMenu.InsertMenu(0, ItemFlags.mfChecked, UpdateCheckMenuId, "Automatic Update Check Enabled"); timerUpdateCheck.Enabled = true; } else { systemMenu.InsertMenu(0, ItemFlags.mfUnchecked, UpdateCheckMenuId, "Automatic Update Check Enabled"); } RegistryKey rk = Registry.CurrentUser.CreateSubKey(@"Software\SystemRestoreExplorer"); if (rk != null) { rk.SetValue("AutomaticUpdateCheckEnabled", updateCheckEnabled, RegistryValueKind.DWord); } systemMenu.InsertMenu(0, AboutMenuId, "About"); systemMenu.InsertSeparator(2); }
/// <summary> /// 新增菜单 /// </summary> /// Author : Napoleon /// Created : 2015-01-24 16:19:31 public ActionResult SaveMenu(string projectName, string projectId, string parentId, string htmlId, string url, string icon, string sort, string remark) { SystemMenu menu = new SystemMenu(); menu.ProjectId = projectId; menu.Id = CustomId.GetCustomId(); menu.ParentId = string.IsNullOrWhiteSpace(parentId) ? "0" : parentId; menu.Name = projectName; menu.HtmlId = htmlId; menu.Url = url; menu.Icon = icon; menu.Sort = Convert.ToDecimal(sort); menu.Remark = remark; menu.Operator = PublicFields.UserCookie.ReadCookie<SystemUser>().UserName; int count = _menuService.InsertMenu(menu); string status = "failue", msg, json; switch (count) { case -1: msg = "添加失败,该菜单名称已经存在,请不要重复添加!"; break; case 1: status = "success"; msg = "添加成功!"; break; default: msg = "添加失败!"; break; } json = PublicFunc.ModelToJson(status, msg); return Content(json); }
private void InitSystemMenu() { var systemMenu = new SystemMenu(this, this); var resizeMenuItem = systemMenu.CreateMenuItem("&Resize..."); resizeMenuItem.Clicked += delegate { new FormResizeWindow(this).ShowDialog(this); }; var alwaysOnTopMenuItem = systemMenu.CreateMenuItem("Always on &top"); alwaysOnTopMenuItem.Clicked += delegate { var alwaysOnTop = !alwaysOnTopMenuItem.Checked; TopMost = alwaysOnTop; alwaysOnTopMenuItem.Checked = alwaysOnTop; systemMenu.UpdateMenu(alwaysOnTopMenuItem); }; uint pos = 5; systemMenu.InsertSeparator(pos++); systemMenu.InsertMenu(pos++, resizeMenuItem); systemMenu.InsertMenu(pos++, alwaysOnTopMenuItem); }
private void frmMain_Load(object sender, EventArgs e) { try { setTitle(null, null); this._systemMenu = new SystemMenu(this); this._systemMenu.AppendSeparator(); this._showHideMainMenuLineItem = this._systemMenu.AppendNewItem("", (s, args) => { this._model.Settings.ShowMainMenu = !this._model.Settings.ShowMainMenu; UpdateMainMenuVisibility(this._model.Settings, null); }); UpdateShowHideMainMenuLineItem(); if (this.isDisableMainMenu) { this._model.Settings.ShowMainMenu = false; UpdateMainMenuVisibility(this._model.Settings, true); } RestoreSizeAndLocation(this._model.Settings); this._model.SettingsChanged += (o, args) => ApplySettings(); if (strServerName != null && strTemplate != null && strDatabaseType != null) { // log.DebugFormat( // "strServerName:'{0}';strTemplate:'{1}';strDatabaseType:'{2}'", // strServerName ?? "<Null>", // strTemplate ?? "<Null>", // strDatabaseType ?? "<Null>" // ); InstanceInfo instanceInfo = new InstanceInfo { Authentication = new AuthenticationInfo { IsWindows = true, Password = string.Empty, Username = string.Empty }, Instance = strServerName, IsEnabled = true, Name = strServerName, IsODBC = false, DbType = strDatabaseType }; ConnectionGroupInfo connectionGroupInfo = new ConnectionGroupInfo(); connectionGroupInfo.Connections.Add(instanceInfo); string strTemplateFileName = Path.GetFileName(strTemplate); string strFullPathToTemplateFile = Path.GetFullPath(strTemplate); string strTemplateDir = Path.GetDirectoryName(strTemplate); if (string.IsNullOrEmpty(strTemplateDir)) { strTemplateDir = Program.Model.Settings.TemplateDirectory; strFullPathToTemplateFile = Path.GetFullPath(strTemplateDir + "\\" + strTemplate); connectionGroupInfo.IsExternal = false; } else { connectionGroupInfo.IsExternal = true; } connectionGroupInfo.IsDirectConnection = true; connectionGroupInfo.TemplateDir = strTemplateDir; connectionGroupInfo.TemplateFileName = strTemplateFileName; connectionGroupInfo.Name = strServerName; var targetTab = GetTargetTab(connectionGroupInfo.Name + "{" + connectionGroupInfo.TemplateFileName + "}"); Template selectedTemplate = TemplateNodesLoader.GetTemplateByFile(strFullPathToTemplateFile); targetTab.SelectedTemplate = selectedTemplate; targetTab.OpenConnection(connectionGroupInfo); } } catch (Exception ex) { log.Error(ex); } }
public static bool UpdateSystemMenu(SystemMenu systemMenu) { return SystemDAL.BaseProvider.UpdateSystemMenu(systemMenu.MenuCode, systemMenu.Name, systemMenu.Controller, systemMenu.View, systemMenu.Sort); }
// Retrieves a new object from a Form object public static SystemMenu FromForm(Form Frm) { SystemMenu cSysMenu = new SystemMenu(); cSysMenu.m_SysMenu = GetSystemMenu(Frm.Handle, false); if (cSysMenu.m_SysMenu == IntPtr.Zero) { return null; } return cSysMenu; }
internal SystemMenuItem(string text, SystemMenu menu) { base.Text = text; _menu = menu; if (text == "-") _flags = SEPERATOR_FLAG; }
/// <summary> /// 检测是否存在指定系统菜单 /// </summary> /// <param name="entity">系统菜单实体</param> /// <returns>存在返回true</returns> public BoolMessage Exists(SystemMenu entity) { var has = repos.Exists(p => p.Code == entity.Code && p.Id != entity.Id); return has ? new BoolMessage(false, "指定的菜单编码已经存在") : BoolMessage.True; }
/// <summary> /// 根据ID更新信息 /// </summary> /// Author : Napoleon /// Created : 2015-01-26 16:21:38 public ActionResult UpdateMenu(string id, string projectName, string parentId, string htmlId, string url, string icon, string sort, string remark) { SystemMenu menu = new SystemMenu(); menu.Id = id; menu.Name = projectName; menu.ParentId = parentId; menu.HtmlId = htmlId; menu.Url = url; menu.Icon = icon; menu.Sort = Convert.ToDecimal(sort); menu.Remark = remark; menu.Operator = PublicFields.UserCookie.ReadCookie<SystemUser>().UserName; int count = _menuService.UpdateMenu(menu); string status = "failue", msg, json; switch (count) { case -1: msg = "该菜单已经存在,请不要使用重复的菜单名!"; break; case 1: status = "success"; msg = "更新成功!"; break; default: msg = "更新失败!"; break; } json = PublicFunc.ModelToJson(status, msg); return Content(json); }
public MainForm() { Instance = this; InitializeComponent(); // Set the XML file's build action to "Embedded Resource" and "Never copy" for this to work. Tx.LoadFromEmbeddedResource("Unclassified.LogSubmit.LogSubmit.txd"); TxDictionaryBinding.AddTextBindings(this); // Initialise views logSelectionView = new LogSelectionView(); // Read configuration file string configFile = Path.Combine( Path.GetDirectoryName(Application.ExecutablePath), "submit.config"); try { ConfigReader config = new ConfigReader(configFile); config.Read(); } catch (Exception ex) { logSelectionView.SetConfigError(ex); } // Initialise more views timeSelectionView = new TimeSelectionView(); notesView = new NotesView(); compressView = new CompressView(); transportView = new TransportView(); transportProgressView = new TransportProgressView(); views.Add(logSelectionView); views.Add(timeSelectionView); views.Add(notesView); views.Add(compressView); views.Add(transportView); views.Add(transportProgressView); // Other initialisation Icon = Icon.ExtractAssociatedIcon(Application.ExecutablePath); UIPreferences.UpdateFormFont(this, Font, SystemFonts.MessageBoxFont); USizeGrip.AddToForm(this); systemMenu = new SystemMenu(this); systemMenu.AddCommand(Tx.T("menu.about"), OnSysMenuAbout, true); progressPanel = new Panel(); progressPanel.Left = 0; progressPanel.Top = 0; progressPanel.Width = 0; progressPanel.Height = 2; //progressPanel.BackColor = SystemColors.Highlight; progressPanel.BackColor = Color.Gray; Controls.Add(progressPanel); progressPanel.BringToFront(); // Parse command line arguments CommandLineReader cmdLine = new CommandLineReader(); fromErrorDlgOption = cmdLine.RegisterOption("errordlg"); fromShortcutOption = cmdLine.RegisterOption("shortcut"); logPathOption = cmdLine.RegisterOption("logpath", 1); endTimeOption = cmdLine.RegisterOption("endtime", 1); try { cmdLine.Parse(); } catch (Exception ex) { MessageBox.Show( Tx.T("msg.command line error", "msg", ex.Message), Tx.T("msg.title.error"), MessageBoxButtons.OK, MessageBoxIcon.Error); } SharedData.Instance.FromErrorDialog = fromErrorDlgOption.IsSet; SharedData.Instance.FromShortcut = fromShortcutOption.IsSet; if (logPathOption.IsSet) { try { logSelectionView.SetLogBasePath(logPathOption.Value); } catch { MessageBox.Show( Tx.T("msg.logpath parameter invalid", "value", logPathOption.Value), Tx.T("msg.title.error"), MessageBoxButtons.OK, MessageBoxIcon.Error); logSelectionView.ResetLogBasePath(); logSelectionView.FindLogBasePath(); } } else { logSelectionView.FindLogBasePath(); } if (endTimeOption.IsSet) { try { appStartTime = DateTime.Parse(endTimeOption.Value); SharedData.Instance.LastLogUpdateTime = appStartTime; } catch { MessageBox.Show( Tx.T("msg.endtime parameter invalid", "value", endTimeOption.Value), Tx.T("msg.title.error"), MessageBoxButtons.OK, MessageBoxIcon.Error); } } // Set start view SetView(logSelectionView, true); }