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; }
private void DrawReactionInCanvas(BcsReactionNode firstReaction) { MainCanvas.Children.Clear(); var grid = GridHelper.CreateReactionGrid(firstReaction); Grid.SetColumn(grid, 1); MainCanvas.Children.Add(grid); }
protected override void VisitReaction(BcsReactionNode bcsReaction) { var item = new MenuItem() { Drawable = true, SyntaxTreeEntityId = bcsReaction.UniqueId, Title = $"Reaction: L={bcsReaction.LeftSideReactants.Count} {bcsReaction.ReactionDirection} R={bcsReaction.RightSideReactants.Count}" }; NodeCache.Add(bcsReaction.UniqueId, item); Root = item; }
protected override void VisitReaction(BcsReactionNode bcsReaction) { ResolveFromParent(bcsReaction); }
protected abstract void VisitReaction(BcsReactionNode bcsReaction);