Example #1
0
        /// <summary>
        /// Launches the <see cref="SequenceBeingMatched"/> event.
        /// </summary>
        /// <param name="joinedToken">
        /// A <see cref="Token"/>
        /// </param>
        /// <param name="matcherRule">
        /// A <see cref="LexicalRule"/>
        /// </param>
        /// <param name="found">
        /// If the token is a valid token.
        /// </param>
        protected void SequenceBeingMatchedInvoker(Token joinedToken,
                                                   LexicalRule matcherRule,
                                                   bool found)
        {
            if (this.SequenceBeingMatched != null)
            {
                SequenceBeingMatchedArgs args =
                    new SequenceBeingMatchedArgs(joinedToken, matcherRule, found);

                SequenceBeingMatched(this, args);
            }
        }
		/// <summary>
		/// Launches the <see cref="SequenceBeingMatched"/> event.
		/// </summary>
		/// <param name="joinedToken">
		/// A <see cref="Token"/>
		/// </param>
		/// <param name="matcherRule">
		/// A <see cref="LexicalRule"/>
		/// </param>
		/// <param name="found">
		/// If the token is a valid token.
		/// </param>
		protected void SequenceBeingMatchedInvoker(Token joinedToken,
		                                         LexicalRule matcherRule,
		                                         bool found)
		{
			if(this.SequenceBeingMatched !=null)
			{
				SequenceBeingMatchedArgs args = 
					new SequenceBeingMatchedArgs(joinedToken, matcherRule, found);
				
				SequenceBeingMatched(this, args);
			}
		}
		/// <summary>
		/// Handles the controller's SequenceBeingMatched event.
		/// </summary>
		/// <param name="sender">
		/// A <see cref="System.Object"/>
		/// </param>
		/// <param name="quenceBeingMatchedArgs">
		/// A <see cref="Se"/>
		/// </param>
		private void OnControllerSequenceBeingMatched(object sender, 
		                                              SequenceBeingMatchedArgs args)
		{
			Application.Invoke(sender,
			                   args,
			                   delegate(object resender, EventArgs _args)
			{
				SequenceBeingMatchedArgs a =  _args as SequenceBeingMatchedArgs;
			
			
				Gdk.Pixbuf sequenceImage = a.JoinedToken.Image.CreatePixbuf();
				
				Gdk.Pixbuf drawnImage = sequenceNodeImage.Copy();
				
				sequenceImage.CopyArea(0, 0, 
				                       sequenceImage.Width, sequenceImage.Height,
				                       drawnImage,
				                       0,0);
				
				sequenceMatchingImageArea.Image = drawnImage;
				
				TreeIter iter;
				tokenizingRulesTV.Model.GetIterFirst(out iter);
				
				TreePath path = tokenizingRulesTV.Model.GetPath(iter);
				
				tokenizingRulesTV.Selection.UnselectAll();
					
				string ruleName;
				do
				{
					ruleName = tokenizingRulesTV.Model.GetValue(iter,0) as string;
					
					if(ruleName == a.MatchingRule.Name)
					{
						tokenizingRulesTV.Selection.SelectPath(path);
						tokenizingRulesTV.ScrollToCell(path,
						                               tokenizingRulesTV.Columns[0],
						                               true,
						                               0.5f, 0);
						break;
					}
					
					path.Next();
						
					
				}while(tokenizingRulesTV.Model.GetIter(out iter, path));
				
				if(a.Found)
				{
					matchingResultLbl.Markup=
						String.Format("<b>Sí, se le asigna el item «{0}» a la secuencia actual</b>",
						              a.JoinedToken.Type);
				}
				else
				{
					matchingResultLbl.Markup=
						String.Format("<b>No, la regla actual no concuerda con la secuencia</b>");
				}
				
				// Activate the buttons if necessary.
				if(controller.StepMode == ControllerStepMode.StepByStep)
					tokenizingNextButtonsAlign.Sensitive = true;
			});
		}