Skip to content

Commit

Permalink
Control Type Parsing
Browse files Browse the repository at this point in the history
Improved parsing to identify components and containers
  • Loading branch information
modery committed Nov 15, 2022
1 parent 8114621 commit ac653ad
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion PowerDocu.AppDocumenter/AppParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,17 @@ private ControlEntity parseControl(List<JToken> properties)
}
}
controlEntity.Type = controlEntity.Properties.Where(e => e.expressionOperator == "Template")?.First().expressionOperands.Cast<Expression>().First(eo => eo.expressionOperator == "Name").expressionOperands[0].ToString();
//for containers, there are a few different types (Contaner, Horizontal Container, Vertical Container) which are defined by the "VariantName" property
if (controlEntity.Type.Equals("groupContainer"))
{
controlEntity.Type = controlEntity.Properties.First(o => o.expressionOperator.Equals("VariantName")).expressionOperands[0].ToString();
}
//components can safely be identified through the Id of the template
string controlId = controlEntity.Properties.Where(e => e.expressionOperator == "Template")?.First().expressionOperands.Cast<Expression>().First(eo => eo.expressionOperator == "Id").expressionOperands[0].ToString();
if (controlId.Equals("http://microsoft.com/appmagic/Component"))
{
controlEntity.Type = "component";
}
return controlEntity;
}

Expand Down Expand Up @@ -290,7 +301,6 @@ private void addScreenNavigation(ControlEntity controlEntity, string destination
private void CheckForVariables(ControlEntity controlEntity, string input)
{
//Reference: https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/working-with-variables#types-of-variables

string code = input.Replace("\n", "").Replace("\r", "");
MatchCollection matches;
//check for Global Variables
Expand Down

0 comments on commit ac653ad

Please sign in to comment.