public List <Tab> GenerateByUI(Model model, IProgressMessage progress, IProgressIndicator hmProgress, bool showResultFields) { List <Tab> tabs = new List <Tab>(); try { DomainElementTypeCollection items = model.DomainDataSet.DomainDataSetType().DomainElementTypes(false); foreach (IDomainElementType domainElementType in items) { string name = domainElementType.ToString(); progress.Message = $"\n\n------------------------------------\nDomain element type: {name.ToUpper()}...\n\n"; Tab tab = new Tab("Element-" + model.DomainDataSet.DomainDataSetType().DomainElementType(domainElementType.Id).Label); tabs.Add(tab); FieldCollection fields = model.DomainDataSet.DomainElementManager(domainElementType.Id).SupportedFields(); if (showResultFields) { fields.AddRange(model.DomainDataSet.DomainElementManager(domainElementType.Id).SupportedResultFields()); } FieldTypeReporter reporter; string message = $"Working with the {name}..."; hmProgress.AddTask(message).Steps = fields.Count; hmProgress.IncrementTask(); hmProgress.BeginTask(fields.Count); foreach (IField field in fields) { hmProgress.IncrementStep(); reporter = new FieldTypeReporter(field); tab.Chidren.Add(reporter.ToJson()); progress.Message = reporter.ToString(); } hmProgress.EndTask(); } foreach (IdahoSupportElementTypes supportElementType in Enum.GetValues(typeof(IdahoSupportElementTypes))) { string name = supportElementType.ToString(); progress.Message = $"\n\n------------------------------------\nSupport element type: {name.ToUpper()}...\n\n"; Tab tab = new Tab("Support-" + model.DomainDataSet.DomainDataSetType().SupportElementType((int)supportElementType).Label); tabs.Add(tab); FieldCollection fields = model.DomainDataSet.SupportElementManager((int)supportElementType).SupportedFields(); FieldTypeReporter reporter; string message = $"Working with the {name}..."; hmProgress.AddTask(message).Steps = fields.Count; hmProgress.IncrementTask(); hmProgress.BeginTask(fields.Count); foreach (IField field in fields) { hmProgress.IncrementStep(); reporter = new FieldTypeReporter(field); tab.Chidren.Add(reporter.ToJson()); progress.Message = reporter.ToString(); } hmProgress.EndTask(); } /*foreach (IdahoAlternativeTypes alternativeType in Enum.GetValues(typeof(IdahoAlternativeTypes))) * { * * try * { * Tab tab = new Tab("Alternative-" + model.DomainDataSet.DomainDataSetType().AlternativeType((int)alternativeType).Label); * FieldCollection fields = model.DomainDataSet.AlternativeManager((int)alternativeType).SupportedFields(); * * string name = alternativeType.ToString(); * progress.Message = $"\n\n------------------------------------\nAlternative type: {name.ToUpper()}...\n\n"; * * tabs.Add(tab); * FieldTypeReporter reporter; * * string message = $"Working with the {name}..."; * hmProgress.AddTask(message).Steps = fields.Count; * hmProgress.IncrementTask(); * hmProgress.BeginTask(fields.Count); * * foreach (IField field in fields) * { * hmProgress.IncrementStep(); * reporter = new FieldTypeReporter(field); * tab.Chidren.Add(reporter.ToJson()); * progress.Message = reporter.ToString(); * } * hmProgress.EndTask(); * } * catch{} * * }*/ } finally { hmProgress.Done(); } return(tabs); }
public List <Tab> Generate(Model model, IProgressMessage progress, IProgressIndicator hmProgress) { List <Tab> tabs = new List <Tab>(); try { foreach (ModelingElementType modelingElementType in Enum.GetValues(typeof(ModelingElementType))) { progress.Message = $"\n\n------------------------------------\nModeling element type: {modelingElementType.ToString().ToUpper()}...\n\n"; Tab tab = new Tab(modelingElementType.ToString()); tabs.Add(tab); foreach (IFieldType fieldType in model.DomainDataSet.DomainDataSetType().ModelingElementType(modelingElementType).FieldTypes()) { ReportModelingElementFieldTypes(progress, tab, fieldType); } switch (modelingElementType) { case ModelingElementType.All: case ModelingElementType.EmbeddedStickyObject: case ModelingElementType.EngineeringLibrary: case ModelingElementType.Profile: case ModelingElementType.PrototypeDomainElement: break; case ModelingElementType.Alternative: ReportAlternativeFields(tab, model, progress, hmProgress); break; case ModelingElementType.CalculationOptions: ReportCalculationOptionsFields(tab, model, progress, hmProgress); break; case ModelingElementType.DomainElement: ReportDomainElementFields(tab, model, progress, hmProgress); break; case ModelingElementType.Scenario: ReportScenarioFields(tab, model, progress, hmProgress); break; case ModelingElementType.SelectionSet: ReportSelectionSets(tab, model, progress, hmProgress); break; case ModelingElementType.SupportElement: ReportSupportingElementFields(tab, model, progress, hmProgress); break; default: break; } } } finally { hmProgress.Done(); } return(tabs); }