public static Grid CreateReactionGrid(BcsReactionNode reaction)
{
var grid = new Grid
{
Background = Brushes.Brown
};
foreach (var reactant in reaction.LeftSideReactants)
{
AddColumnControlToGrid(grid, CreateReactantGrid(reactant));
if (reaction.LeftSideReactants.IndexOf(reactant) != reaction.LeftSideReactants.Count - 1)
{
AddReactionSymbolColumn(grid, "+");
}
}
string reactionMark = reaction.ReactionDirection == ReactionDirectionType.Both ? "<=>" : (reaction.ReactionDirection == ReactionDirectionType.Left ? "<=" : "=>");
AddReactionSymbolColumn(grid, reactionMark);
foreach (var reactant in reaction.RightSideReactants)
{
AddColumnControlToGrid(grid, CreateReactantGrid(reactant));
if (reaction.RightSideReactants.IndexOf(reactant) != reaction.RightSideReactants.Count - 1)
{
AddReactionSymbolColumn(grid, "+");
}
}
return grid;
}