Ejemplo n.º 1
0
        public static Bitmap getScreenshot(string url, int width_Browser, int height_Browser,
                                           int width_Bitmap, int height_Bitmap)
        {
            Bitmap bitmap = null;
            var    thread = O2Thread.staThread(
                () =>
            {
                var browser            = new O2BrowserIE_Screenshot();
                browser.Width_Browser  = width_Browser;
                browser.Height_Browser = height_Browser;
                browser.Width_Bitmap   = width_Bitmap;
                browser.Height_Bitmap  = height_Bitmap;

                browser.fetchWebPage(url);
                bitmap = browser.GetBitmap();
            });
            var result = thread.Join(wait);

            if (result.isFalse())
            {
                "thread result: {0}".format(result).debug();
            }
            if (bitmap == null)
            {
                "in O2BrowserIE_Screenshot.getScreenshot, failed to get screenshot for: {0}".format(url).error();
            }
            return(bitmap);
        }
        public static Bitmap getScreenshot(string url, int width_Browser, int height_Browser ,
                                                       int width_Bitmap, int height_Bitmap)
        {
            Bitmap bitmap = null ;
            var thread = O2Thread.staThread(
                () =>
                {
                    var browser = new O2BrowserIE_Screenshot();
                    browser.Width_Browser = width_Browser;
                    browser.Height_Browser = height_Browser;
                    browser.Width_Bitmap = width_Bitmap;
                    browser.Height_Bitmap = height_Bitmap;

                    browser.fetchWebPage(url);
                    bitmap =  browser.GetBitmap();
                });
            var result = thread.Join(wait);
            if (result.isFalse())
                "thread result: {0}".format(result).debug();
            if (bitmap == null)
                "in O2BrowserIE_Screenshot.getScreenshot, failed to get screenshot for: {0}".format(url).error();
            return bitmap;
        }