Пример #1
0
 public AsyncData(Bitmap masterImage, string masterName, Bitmap capturedImage, System.Threading.ManualResetEvent manualResetEvent, ImageComparisonSettings toleranceSettings, int index)
 {
     _manualResetEvent  = manualResetEvent;
     _capturedImage     = capturedImage;
     _masterImage       = masterImage;
     _masterName        = masterName;
     _result            = new ImageComparisonResult(index, manualResetEvent);
     _toleranceSettings = toleranceSettings;
 }
Пример #2
0
        /// <summary>
        /// Block the calling thread until all enqueued comparison are evaluated.
        /// </summary>
        /// <returns>Returns a collection of ImageComparisonResult containing the result of each comparison</returns>
        public static ImageComparisonResult[] WaitForAllEnqueuedCompare()
        {
            ImageComparisonResult[] retVal = new ImageComparisonResult[] { };

            WaitHandle[] waitHandles = AsyncHelper.WaitHandles;
            if (waitHandles.Length != 0)
            {
                // Wait for Enqueued operation to finish.
                WaitHandle.WaitAll(waitHandles);

                retVal = AsyncHelper.Results;
                AsyncHelper.ClearAll();
            }

            return(retVal);
        }