/// <summary> /// 更新菜单基础部件 有则更新无则增加 /// </summary> /// <param name="menuItem">基础部件</param> public void UpdateMenuItem(IISetting menuItem) { if (_dictionaryMenuItems.ContainsKey(menuItem.Id)) { _dictionaryMenuItems[menuItem.Id] = menuItem; var args = new PublishEventArgs() { EventType = PublishEventType.Core, EventId = Services.EventIdAssign.SettingModuleComponentUpdate, }; args.AddParams(menuItem.Id); EventPublish.PublishEvent(args); } else { _dictionaryMenuItems.Add(menuItem.Id, menuItem); var args = new PublishEventArgs() { EventType = PublishEventType.Core, EventId = Services.EventIdAssign.SettingModuleComponentAdd, }; args.AddParams(menuItem.Id); EventPublish.PublishEvent(args); } }
/// <summary> /// 删除部件 /// </summary> /// <param name="menuItem">需要删除的部件</param> public void DeleteMenuItem(IISetting menuItem) { if (_dictionaryMenuItems.ContainsKey(menuItem.Id)) { _dictionaryMenuItems.Remove(menuItem.Id); var args = new PublishEventArgs() { EventType = PublishEventType.Core, EventId = Services.EventIdAssign.SettingModuleComponentDelete, }; args.AddParams(menuItem.Id); EventPublish.PublishEvent(args); } }
private void AddNode(IISetting keyValue) { if (keyValue.Key.Contains("Setting")) { //string path = // I36N .Services.I36N .ConvertByCodingOne(keyValue.Id.ToString(CultureInfo.InvariantCulture), "Null"); //if (path.Contains("Missing")) //{ string path = keyValue.PathSetting; string[] sp = path.Split('#'); if (sp.Length == 1) { this.ChildTreeItems.Add(new TreeNodeViewModel(keyValue.ViewId, sp[0])); } else { if (sp.Length < 2) { return; } foreach (var t in this.ChildTreeItems) { if (t.NodeName.Equals(sp[0].Trim())) { t.ChildTreeItems.Add(new TreeNodeViewModel(keyValue.ViewId, sp[1])); return; } } var f = new TreeNodeViewModel(0, sp[0].Trim()); this.ChildTreeItems.Add(f); f.ChildTreeItems.Add(new TreeNodeViewModel(keyValue.ViewId, sp[1])); } } }
/// <summary> /// 有则更新无则增加 /// </summary> /// <param name="menuItem">基础部件</param> public void AddMenuItem(IISetting menuItem) { UpdateMenuItem(menuItem); }
/// <summary> /// 获取是否已经包含该部件 /// </summary> /// <param name="menuItem">菜单</param> /// <returns></returns> public static bool ContainsComponent(IISetting menuItem) { return(_dictionaryMenuItems.ContainsKey(menuItem.Id)); }