Пример #1
0
 void DriverResultsTableUpdater_DatabaseModified(object sender, ResultsUpdatedEventArgs e)
 {
     this.session = e.session;
     if (SessionChanged != null)
     {
         SessionChanged(this, session);
     }
     GetResultsFromData(e.session);
 }
Пример #2
0
 void DriverResultsTableUpdater_DatabaseModified(object sender, ResultsUpdatedEventArgs e)
 {
     this.session = e.session;
     GetResultsFromData(e.session);
     if (ResultsModified != null)
     {
         ResultsModified(this, new EventArgs());
     }
 }
Пример #3
0
        /// <summary>
        /// OnInkAnalyzerResultsUpdated - A handler for InkAnalyzer.ResultsUpdated event
        /// which is called when BackgroundAnalyze completes
        /// </summary>
        private void OnInkAnalyzerResultsUpdated(object sender, ResultsUpdatedEventArgs e)
        {
            if (_feedbackAdorner != null)
            {
                //cause the feedback adorner to repaint itself
                _feedbackAdorner.InvalidateVisual();
            }

            // If the user has made edits while analysis was being performed, trigger
            // BackgroundAnalyze again to analyze these changes
            if (!_inkAnalyzer.DirtyRegion.IsEmpty)
            {
                _inkAnalyzer.BackgroundAnalyze();
            }
        }
Пример #4
0
        private void InkAnalyzer_ResultsUpdated(object sender, ResultsUpdatedEventArgs e)
        {
            running = false;

            InkUtils.MergeParagraphs(inkAnalyzer);

            if (processor < inkProcessors.Count)
            {
                InkProcessor proc = inkProcessors[processor];
                proc.process(inkAnalyzer);
                processor++;
                fireoff();
                return;
            }

            if (adds.Count > 0 || removes.Count > 0)
            {
                //Flush adds and removes
                while (adds.Count > 0)
                {
                    Stroke stroke = adds.Dequeue();
                    inkAnalyzer.AddStroke(stroke);
                }
                while (removes.Count > 0)
                {
                    Stroke stroke = removes.Dequeue();
                    inkAnalyzer.RemoveStroke(stroke);
                }
                fireoff();
                return;
            }

            if (PipelineComplete != null)
            {
                PipelineComplete(this, new EventArgs());
            }

            processor  = 0;
            processing = false;

            if (queued)
            {
                queued     = false;
                processor  = 0;
                processing = true;
                fireoff();
            }
        }
Пример #5
0
        private void InkAnalyzer_ResultsUpdated(object sender, ResultsUpdatedEventArgs e)
        {
            running = false;

            InkUtils.MergeParagraphs(inkAnalyzer);

            if (processor < inkProcessors.Count)
            {
                InkProcessor proc = inkProcessors[processor];
                proc.process(inkAnalyzer);
                processor++;
                fireoff();
                return;
            }

            if (adds.Count > 0 || removes.Count > 0)
            {
                //Flush adds and removes
                while (adds.Count > 0)
                {
                    Stroke stroke = adds.Dequeue();
                    inkAnalyzer.AddStroke(stroke);
                }
                while (removes.Count > 0)
                {
                    Stroke stroke = removes.Dequeue();
                    inkAnalyzer.RemoveStroke(stroke);
                }
                fireoff();
                return;
            }

            if (PipelineComplete != null)
            {
                PipelineComplete(this, new EventArgs());
            }

            processor = 0;
            processing = false;

            if (queued)
            {
                queued = false;
                processor = 0;
                processing = true;
                fireoff();
            }
        }
Пример #6
0
 private void M_analizer_ResultsUpdated(object sender, ResultsUpdatedEventArgs e)
 {
     if (e.Status.Successful)
     {
         ContextNodeCollection leaves = ((InkAnalyzer)sender).FindLeafNodes();
         foreach (ContextNode leaf in leaves)
         {
             if (leaf is InkWordNode)
             {
                 // Como palabra
                 InkWordNode t = leaf as InkWordNode;
                 Rect        l = t.Location.GetBounds();
                 ReconocerEntrada(t.GetRecognizedString());
             }
         }
         LimpiarCanvas();
     }
 }
        private void M_analyzer_ResultsUpdated(object sender, ResultsUpdatedEventArgs e)
        {
            if (e.Status.Successful)
            {
                ContextNodeCollection leaves = ((InkAnalyzer)sender).FindLeafNodes();
                foreach (ContextNode leaf in leaves)
                {
                    if (leaf is InkWordNode)
                    {
                        // Como palabra
                        InkWordNode t      = leaf as InkWordNode;
                        Rect        l      = t.Location.GetBounds();
                        var         result = recognizer.EvaluateString(t.GetRecognizedString());

                        if (textResult != "")
                        {
                            if (textResult[textResult.Length - 1] == '?')
                            {
                                textResult = textResult.Replace("?", result);
                            }
                            else
                            {
                                textResult += result;
                            }
                        }
                        else
                        {
                            textResult += result;
                        }

                        textBox.Text = textResult;
                    }
                    else
                    {
                        recognizer.MssgFeedback = "No se ha reconocido su trazo";
                    }
                    FeedbackText.Text = recognizer.MssgFeedback;
                }
                //textBox.ScrollToEnd();
                ResetCanvas();
            }
        }
Пример #8
0
    /// <summary>
    /// Analyzer.ResultsUpdated event handler.
    /// </summary>
    /// <param name="sender">InkAnalyzer that raises the
    /// event.</param>
    /// <param name="e">Event data</param>
    /// <remarks>This method checks each AnalysisHint for
    /// analyzed ink and then populated the TextBlock that
    /// corresponds to the area on the form.</remarks>
    void analyzer_ResultsUpdated(object sender, ResultsUpdatedEventArgs e)
    {
        string recoText;

        recoText = hintNodeTitle.GetRecognizedString();
        if (recoText != "")
        {
            xaml_blockTitle.Text = recoText;
        }

        recoText = hintNodeDirector.GetRecognizedString();
        if (recoText != "")
        {
            xaml_blockDirector.Text = recoText;
        }

        recoText = hintNodeStarring.GetRecognizedString();
        if (recoText != "")
        {
            xaml_blockStarring.Text = recoText;
        }

        recoText = hintNodeRating.GetRecognizedString();
        if (recoText != "")
        {
            xaml_blockRating.Text = recoText;
        }

        recoText = hintNodeYear.GetRecognizedString();
        if (recoText != "")
        {
            xaml_blockYear.Text = recoText;
        }

        recoText = hintNodeGenre.GetRecognizedString();
        if (recoText != "")
        {
            xaml_blockGenre.Text = recoText;
        }
    }
Пример #9
0
        void _inkAnalyzer_ResultsUpdated(object sender, ResultsUpdatedEventArgs e)
        {
            if (circuitInkCanvas.InkFeedbackAdorner != null)
            {
                //cause the feedback adorner to repaint itself
                circuitInkCanvas.InkFeedbackAdorner.InvalidateVisual();
            }

            // If the user has made edits while analysis was being performed, trigger
            // BackgroundAnalyze again to analyze these changes
            if (!circuitInkCanvas.InkAnalyzer.DirtyRegion.IsEmpty)
            {
                circuitInkCanvas.InkAnalyzer.BackgroundAnalyze();
            }
        }
Пример #10
0
        void m_analyzer_ResultsUpdated(object sender, ResultsUpdatedEventArgs e)
        {
            if (e.Status.Successful)
            {
                ContextNodeCollection nodes = ((InkAnalyzer)sender).FindLeafNodes();
                foreach (ContextNode node in nodes)
                {
                    if (node is InkWordNode)
                    {
                        InkWordNode t = node as InkWordNode;
                        String text = t.GetRecognizedString();
                        Rect l = t.Location.GetBounds();
                        Point a = new Point(l.Left + l.Width / 2, l.Top + l.Height / 2);
                        double de = l.Height;
                        Brush be = Brushes.Green;

                        switch (t.InkRecognitionConfidence)
                        {
                            case InkRecognitionConfidence.Intermediate:
                                be = Brushes.Yellow;
                                break;
                            case InkRecognitionConfidence.Poor:
                                be = Brushes.Red;
                                break;
                            case InkRecognitionConfidence.Unknown:
                                be = Brushes.Brown;
                                break;
                        }

                        if (text.IndexOf("=") != -1)
                        {
                            List<int> operatorLocations = new List<int>();
                            List<string> piece = new List<string>();
                            double result;

                            //grab all operation except =
                            for (int i = 0; i < text.Length; i++)
                            {
                                if (text.Substring(i, 1) == "+" || text.Substring(i, 1) == "-" || text.Substring(i, 1) == "x" || text.Substring(i, 1) == "*" || text.Substring(i, 1) == "/")
                                {
                                    operatorLocations.Add(i);
                                }
                            }

                            //Grab index of = sign in text, assuming there is only be 1
                            operatorLocations.Add(text.IndexOf("="));

                            //Grab first number
                            piece.Add( text.Substring(0, operatorLocations[0]));
                            //grab number after each operator
                            for (int i = 0; i < operatorLocations.Count - 1; i++)
                            {
                                piece.Add(text.Substring(operatorLocations[i] + 1, operatorLocations[i + 1] - (operatorLocations[i] + 1)));
                            }
                            for (int i = 0; i < operatorLocations.Count - 1; i++)
                            {
                                double tempResult = 0;
                                //operate
                                if (text.Substring(operatorLocations[i], 1) == "x" || text.Substring(operatorLocations[i], 1) == "*")
                                {
                                    tempResult = Convert.ToDouble(piece[i]) * Convert.ToDouble(piece[i+1]);
                                }
                                if (text.Substring(operatorLocations[i], 1) == "/")
                                {
                                    tempResult = Convert.ToDouble(piece[i]) / Convert.ToDouble(piece[i+1]);
                                }
                                //Rebuild string
                                if (text.Substring(operatorLocations[i], 1) == "x" || text.Substring(operatorLocations[i], 1) == "*" || text.Substring(operatorLocations[i], 1) == "/")
                                {
                                    int originalLength = text.Length;
                                    if ( i != 0 )
                                        text = text.Substring(0, operatorLocations[i - 1] + 1) + Convert.ToString(tempResult) + text.Substring(operatorLocations[i + 1]);
                                    else
                                        text = Convert.ToString(tempResult) + text.Substring(operatorLocations[i + 1]);
                                    piece.RemoveAt(i);
                                    piece.RemoveAt(i);
                                    operatorLocations.RemoveAt(i);
                                    for (int j = i; j < operatorLocations.Count; j++)
                                    {
                                        operatorLocations[j] -= originalLength - text.Length;
                                    }
                                    if (i != 0)
                                        if (piece.Count > i)
                                            piece.Insert(i, text.Substring(operatorLocations[i - 1] + 1, operatorLocations[i] - (operatorLocations[i - 1] + 1)));
                                        else
                                            piece.Add(text.Substring(operatorLocations[i - 1] + 1, operatorLocations[i] - (operatorLocations[i - 1] + 1)));
                                    else
                                        piece.Add(text.Substring(0, operatorLocations[0]));

                                    i--;
                                }

                            }
                            //find result
                            result = Convert.ToDouble(piece[0]);
                            for (int i = 0; i < operatorLocations.Count - 1; i++)
                            {
                                if (text.Substring(operatorLocations[i], 1) == "+")
                                {
                                    result += Convert.ToDouble(piece[i + 1]);
                                }
                                if (text.Substring(operatorLocations[i], 1) == "-")
                                {
                                    result -= Convert.ToDouble(piece[i + 1]);
                                }

                            }
                            //text += " " + Convert.ToString(result);
                            result = Math.Round(result, 3);
                            a = new Point(l.Right + ((l.Width / text.Length)), l.Top + l.Height / 2);
                            text = Convert.ToString(result);
                        }

                            myInkCanvas.Children.Remove(temp);
                            GistaFigure figure = new GistaFigure(text, a,de , be);
                            temp = figure;
                            myInkCanvas.Children.Add(figure);

                    }

                }
            }
        }
Пример #11
0
        void StatisticManager_ResultsUpdated(object sender, ResultsUpdatedEventArgs e)
        {
            ChampionshipStatistic newStatistic = StatisticManager.GetChampionships(e.results, PointSystem, DoublePoints);

            RunResultsComparison(e.results, e.session, Statistic, newStatistic);
        }
        void m_analyzer_ResultsUpdated(object sender, ResultsUpdatedEventArgs e)
        {
            if (e.Status.Successful)
            {
                ContextNodeCollection nodes = ((InkAnalyzer)sender).FindLeafNodes();

                foreach (ContextNode node in nodes)
                {
                    if (node is InkWordNode)
                    {
                        InkWordNode t = node as InkWordNode;

                        var num = t.GetRecognizedString();
                        int valor;
                        bool isNum = int.TryParse(num, out valor);

                        if (isNum)
                        {
                            valor = Convert.ToInt32(num);
                            if (valor > 0 && valor < 10)
                            {
                                _solicitudCambioNúmero(valor);
                            }

                        }

                    }
                    else
                    {
                        m_analyzer.RemoveStrokes(canvasDeTinta.Strokes);
                        canvasDeTinta.Strokes.Clear();
                    }
                    m_analyzer.RemoveStrokes(canvasDeTinta.Strokes);
                    canvasDeTinta.Strokes.Clear();
                }
            }
            m_analyzer.RemoveStrokes(canvasDeTinta.Strokes);
            canvasDeTinta.Strokes.Clear();
        }