示例#1
0
 public void AsyncTranslation_callback(IAsyncTranslation result)
 {
     if (PhraseRects.All(x => x.atrans.isDone == true))
     {
         SaveForStreaming();
     }
     pbxDisplay.Invalidate();
 }
示例#2
0
        // Find a phrase at a given point, for mouse collision etc.
        PhraseRect GetPhraseAtPoint(Point Location)
        {
            // It's important to select the last occurrance in the list, since that'll be the one most recently
            // added or clicked, thus it's on the top of the Z stack.
            if (PhraseRects.Count() < 1)
            {
                return(null);
            }
            List <PhraseRect> FoundRects = PhraseRects.FindAll(x => x.Location.Contains(Location));

            if (FoundRects.Count() < 1)
            {
                return(null);
            }
            return(FoundRects.Last());
        }
示例#3
0
        // Use the above code to generate phraserects
        public void MakeAutoPhrases()
        {
            if (PhraseRects.Count() > 0)
            {
                switch (MessageBox.Show("Do you want to clear phrases before running the autophraser?", "Existing phrases", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning))
                {
                case (DialogResult.Yes):
                    PhraseRects.Clear();
                    break;

                case (DialogResult.Cancel):
                    return;
                }
            }

            foreach (Rectangle rect in AutoPhraseRects(OCRResult.smallBoxes))
            {
                PhraseRects.Add(new PhraseRect(rect, OCRResult, PhraseRectMode.contains, this, AsyncTranslation_callback));
            }
        }
示例#4
0
 // Clear everything to prep for another snap
 void ClearAll()
 {
     OCRResult = null;
     PhraseRects.Clear();
     pbxDisplay.Invalidate();
 }
示例#5
0
 // Clear all phrases
 void ClearPhrases()
 {
     PhraseRects.Clear();
     pbxDisplay.Invalidate();
 }