Inheritance: BcsExpressionNode
Ejemplo n.º 1
0
        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;
        }
Ejemplo n.º 2
0
 private void DrawReactionInCanvas(BcsReactionNode firstReaction)
 {
     MainCanvas.Children.Clear();
     var grid = GridHelper.CreateReactionGrid(firstReaction);
     Grid.SetColumn(grid, 1);
     MainCanvas.Children.Add(grid);
 }
Ejemplo n.º 3
0
        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;
        }
Ejemplo n.º 4
0
 protected override void VisitReaction(BcsReactionNode bcsReaction)
 {
     ResolveFromParent(bcsReaction);
 }
Ejemplo n.º 5
0
 protected abstract void VisitReaction(BcsReactionNode bcsReaction);