@startuml PlantUMLApp.CreateMenuItems
title PlantUMLApp.CreateMenuItems
start
#LightSkyBlue:var mnuIdx = 0\nvar menuItems = new List<MenuItem> { CreateMenuSeparator(), new() { Key = $"{++mnuIdx}", Text = ToLabelText("Force", "Change force flag"), Action = (self) => ChangeForce(), }, new() { Key = $"{++mnuIdx}", Text = ToLabelText("Path-Depth", "Change max sub path depth"), Action = (self) => ChangeMaxSubPathDepth(), }, new() { Key = $"{++mnuIdx}", Text = ToLabelText("Generation-Depth", "Change max generation depth"), Action = (self) => ChangeMaxGenerationDepth(), }, new() { Key = $"{++mnuIdx}", Text = ToLabelText("Projects path", "Change projects path"), Action = (self) => { var savePath = ProjectsPath; ProjectsPath = SelectOrChangeToSubPath(ProjectsPath, MaxSubPathDepth + 1, [ SourcePath ]); if (savePath != ProjectsPath) { PageIndex = 0; } if (savePath == TargetPath) { TargetPath = ProjectsPath; } }, }, new() { Key = $"{++mnuIdx}", Text = ToLabelText("Target path", "Change target path"), Action = (self) => { var savePath = TargetPath; TargetPath = SelectOrChangeToSubPath(TargetPath, MaxSubPathDepth + 1, [ SourcePath ]); if (savePath != TargetPath) { PageIndex = 0; } }, }, CreateMenuSeparator(), new() { Key = $"{++mnuIdx}", Text = ToLabelText("Create", "Change create complete diagram"), Action = (self) => CreateCompleteDiagram = !CreateCompleteDiagram, }, new() { Key = $"{++mnuIdx}", Text = ToLabelText("Folder", "Change diagram folder"), Action = (self) => ChangeDiagramFolder(), }, new() { Key = $"{++mnuIdx}", Text = ToLabelText("Builder", "Change diagram builder"), Action = (self) => ChangeDiagramBuilder(), }, CreateMenuSeparator(), };
#LightYellow:if (mnuIdx % 10 != 0) then (<color:green>yes)
  #WhiteSmoke:mnuIdx += 10 - (mnuIdx % 10);
endif
#LightSkyBlue:var paths = new [] { ProjectsPath }.Union(TemplatePath.GetSubPaths(ProjectsPath, MaxSubPathDepth)) .Where(p => TemplatePath.ContainsFiles(p, "*.cs")) .OrderBy(p => p) .ToArray();
#WhiteSmoke:menuItems.AddRange(CreatePageMenuItems(ref mnuIdx, paths, (item, menuItem) => { var subPath = item.Replace(ProjectsPath, string.Empty); var targetPath = item.Replace(ProjectsPath, TargetPath); PrintHeader(); if (subPath.IsNullOrEmpty()) { subPath = $"{Path.DirectorySeparatorChar}{ProjectsPath.Split(Path.DirectorySeparatorChar).LastOrDefault()}"; } menuItem.Text = ToLabelText("Path", $"{subPath}"); menuItem.Tag = "paths"; menuItem.Action = (self) => CreateDiagram(self, Force); menuItem.Params = new() { { "sourcePath", item }, { "targetPath", targetPath } }; }));
#Lavender:return [.. menuItems.Union(CreateExitMenuItems())];
stop
@enduml
