/// <summary> /// Adds a new module to the navigation view. Called by the <see cref="ModuleNavigator"/>. /// </summary> /// <param name="moduleSettings">Module settings.</param> public void AddModule(ModuleSettings moduleSettings) { if (moduleSettings == null) { throw new ArgumentNullException(nameof(moduleSettings)); } var navigationPanelItem = new NavigationPanelItem { NavigationPanelItemName = moduleSettings.ModuleName, ImageLocation = moduleSettings.ModuleImagePath }; foreach (ModuleGroup moduleGroup in moduleSettings.ModuleGroups) { var navigationList = new NavigationList { NavigationListName = moduleGroup.ModuleGroupName }; foreach (ModuleGroupItem moduleGroupItem in moduleGroup.ModuleGroupItems) { var navigationListItem = new NavigationListItem { ItemName = moduleGroupItem.ModuleGroupItemName, ImageLocation = moduleGroupItem.ModuleGroupItemImagePath }; OnRegisterNavigation(navigationListItem); navigationList.NavigationListItems.Add(navigationListItem); var navigationSettings = new NavigationSettings { Title = moduleGroupItem.TargetViewTitle, View = moduleGroupItem.TargetView }; string navigationKey = $"{navigationPanelItem.NavigationPanelItemName}.{navigationList.NavigationListName}.{navigationListItem.ItemName}"; navigationListItem.Tag = navigationKey; NavigationSettingsList.Add(navigationKey, navigationSettings); } navigationPanelItem.NavigationList.Add(navigationList); } NavigationPanelItems.Add(navigationPanelItem); }
/// <summary> /// Adds a new module to the navigation view. Called by the <see cref="ModuleNavigator"/>. /// </summary> /// <param name="moduleSettings">Module settings.</param> public void AddModule(ModuleSettings moduleSettings) { var navigationPanelItem = new NavigationPanelItem { NavigationPanelItemName = moduleSettings.ModuleName, ImageLocation = moduleSettings.ModuleImagePath }; foreach (ModuleGroup moduleGroup in moduleSettings.ModuleGroups) { var navigationList = new NavigationList { NavigationListName = moduleGroup.ModuleGroupName }; foreach (ModuleGroupItem moduleGroupItem in moduleGroup.ModuleGroupItems) { var navigationListItem = new NavigationListItem { ItemName = moduleGroupItem.ModuleGroupItemName, ImageLocation = moduleGroupItem.ModuleGroupItemImagePath }; OnRegisterNavigation(navigationListItem); navigationList.NavigationListItems.Add(navigationListItem); var navigationSettings = new NavigationSettings { Title = moduleGroupItem.TargetViewTitle, View = moduleGroupItem.TargetView }; string navigationKey = string.Format("{0}.{1}.{2}", navigationPanelItem.NavigationPanelItemName, navigationList.NavigationListName, navigationListItem.ItemName); navigationListItem.Tag = navigationKey; NavigationSettingsList.Add(navigationKey, navigationSettings); } navigationPanelItem.NavigationList.Add(navigationList); } NavigationPanelItems.Add(navigationPanelItem); }