コード例 #1
0
 private void OnTokenItemMatchingFinished(object sender, TokenMatchingFinishedArgs args)
 {
     if (TokenMatchingFinished != null)
     {
         TokenMatchingFinished(this, args);
     }
     SuspendByStep();
 }
コード例 #2
0
        private void OnControllerTokenMatchingFinished(object sender,
                                                       TokenMatchingFinishedArgs _args)
        {
            Application.Invoke(sender,
                               _args,
                               delegate(object resender, EventArgs a)
            {
                TokenMatchingFinishedArgs args = (TokenMatchingFinishedArgs)a;

                string tokenType = args.ExpectedType;

                if (args.MatchedToken != null)
                {
                    int idx = SearchToken(args.MatchedToken);
                    remainingItemsStore.IterNthChild(out selectedRemainingItem,
                                                     idx);
                    TreePath selectedPath =
                        remainingItemsStore.GetPath(selectedRemainingItem);

                    remainingItemsIconView.SelectPath(selectedPath);
                    remainingItemsIconView.ScrollToPath(selectedPath, 0.5f, 0f);

                    this.MarkImage(args.MatchedToken);

                    parsingTaskLabel.Markup =
                        String.Format("<b>Se encontró un item válido del tipo <i>{0}</i>, <i>{1}</i> entre los items restantes</b>",
                                      GLib.Markup.EscapeText(tokenType),
                                      GLib.Markup.EscapeText(args.MatchedToken.Text));

                    currentNode.AddMatchedToken(args.MatchedToken);
                    currentNode.Select();

                    remainingItemsStore.Remove(ref selectedRemainingItem);

                    TreeIter first;
                    if (remainingItemsStore.GetIterFirst(out first))
                    {
                        remainingItemsIconView.ScrollToPath(remainingItemsStore.GetPath(first));
                    }
                }
                else
                {
                    parsingTaskLabel.Markup =
                        String.Format("<b>No se encotró un item válido del tipo <i>{0}</i> entre los items restantes</b>",
                                      GLib.Markup.EscapeText(tokenType));
                }

                if (controller.StepMode != ControllerStepMode.UntilEnd)
                {
                    parsingNextButtonsAlign.Sensitive = true;
                }
            });
        }