/// <summary> /// Waits 3 seconds and then sends a blank recognition result. /// </summary> /// <param name="args">The Recognition arguments</param> /// <returns>A blank RecognitionResult</returns> public override RecognitionResult Recognize(RecognitionArgs args) { Console.WriteLine("Timeout Recognizer thread started, sleeping 3 seconds."); Thread.Sleep(3000); RecognitionResult result = new RecognitionResult(); result.UserTriggered = true; return(result); }
/// <summary> /// Sends the Sketch contained in this panel to the recognizer. /// TODO: currently has debug functionality; needs to set userTriggered properly /// </summary> public void TriggerRecognition() { RecognitionArgs args = new RecognitionArgs(); args.UserTriggered = true; args.Sketch = this.inkSketch.Sketch; RecognitionTriggerEventHandler triggerHandler = RecognitionTriggered; if (triggerHandler != null) { triggerHandler(this, args); } }
public override RecognitionResult Recognize(RecognitionArgs args) { Substroke[] substrokes = args.Sketch.Substrokes; RecognitionResult result = new RecognitionResult(); result.UserTriggered = true; result.Sketch = args.Sketch; Recognizers.Recognizer.Results results = classify.Recognize(substrokes); result.status = results.ToString(); System.Drawing.Color c = classify.ToColor(results); foreach (Substroke s in substrokes) { s.XmlAttrs.Color = c.ToArgb(); } return(result); }
/// <summary> /// Performs recognition on a given set of recognition arguments (e.g. a sketch). /// Subclassers of this class must implement this method; this is where actual /// recognition code should go. This method will run in its own thread; /// a new thread is started every time recognition is triggered. /// </summary> /// <param name="args">Arguments to the recognizer</param> /// <returns>The result of recognition</returns> public abstract RecognitionResult Recognize(RecognitionArgs args);
/// <summary> /// Handles recogntion trigger events. Forwards recognition arguments to the real recognizer. /// </summary> /// <param name="source">The source panel of this trigger event</param> /// <param name="ra">The recognition arguments to forward (e.g., the sketch to be recognized)</param> private void panel_RecognitionTriggered(SketchPanel source, RecognitionArgs ra) { FireRecognition frDelegate = new FireRecognition(this.Recognize); frDelegate.BeginInvoke(ra, this.processRecognitionResult, null); }