AmazonScrape.Scraper.DoEvents C# (CSharp) Method

DoEvents() public static method

Used to force the background worker to wait for a condition before proceeding.
public static DoEvents ( ) : void
return void
        public static void DoEvents()
        {
            try
            {
                DispatcherFrame frame = new DispatcherFrame();
                Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Background,
                    new DispatcherOperationCallback((f) =>
                    {
                        ((DispatcherFrame)f).Continue = false;
                        return null;
                    }), frame);
                Dispatcher.PushFrame(frame);
            }
            catch (OutOfMemoryException)
            {
                // TODO: If this Exception is ever hit, we want to handle it by
                // cancelling the search. See if there is a clean way of doing that.
                MessageBox.Show("Out of memory");
            }
        }