コード例 #1
0
        public ScreenshotCore(ICefConfig cefConfig, ILoggingService loggingService)
        {
            this.cefConfig                   = cefConfig;
            this.loggingService              = loggingService;
            this.lastPaintTimeStamp          = DateTime.UtcNow;
            this.isDisposed                  = false;
            this.client                      = new ScreenshotCefClient(this, cefConfig.ScreenshotWidth, cefConfig.ScreenshotHeight, loggingService);
            this.initializedCompletionSource = new TaskCompletionSource <bool>();
            this.screenshotQueue             = new BlockingCollection <ScreenshotRequestContext>();

            this.buffer    = new byte[cefConfig.ScreenshotHeight * cefConfig.ScreenshotWidth * 4];
            bufferGcHandle = GCHandle.Alloc(buffer, GCHandleType.Pinned);

            this.screenshotWorkerCancellationSource = new CancellationTokenSource();
            Task.Factory.StartNew(() => ScreenshotWorker(this.screenshotWorkerCancellationSource.Token), TaskCreationOptions.LongRunning);
        }
コード例 #2
0
        public ScreenshotCore(ICefConfig cefConfig, ILoggingService loggingService)
        {
            this.cefConfig = cefConfig;
            this.loggingService = loggingService;
            this.lastPaintTimeStamp = DateTime.UtcNow;
            this.isDisposed = false;
            this.client = new ScreenshotCefClient(this, cefConfig.ScreenshotWidth, cefConfig.ScreenshotHeight, loggingService);
            this.initializedCompletionSource = new TaskCompletionSource<bool>();
            this.screenshotQueue = new BlockingCollection<ScreenshotRequestContext>();

            this.buffer = new byte[cefConfig.ScreenshotHeight * cefConfig.ScreenshotWidth * 4];
            bufferGcHandle = GCHandle.Alloc(buffer, GCHandleType.Pinned);

            this.screenshotWorkerCancellationSource = new CancellationTokenSource();
            Task.Factory.StartNew(() => ScreenshotWorker(this.screenshotWorkerCancellationSource.Token), TaskCreationOptions.LongRunning);
        }
コード例 #3
0
        public PageTrackerCefApp(ICefConfig cefConfig, ILoggingService loggingService)
        {
            this.loggingService = loggingService;
            this.isInitialized  = false;
            this.isDisposed     = false;

            this.browser = new Lazy <ScreenshotCore>(
                () =>
            {
                var cefWindowInfo = CefWindowInfo.Create();
                cefWindowInfo.SetAsWindowless(IntPtr.Zero, true);

                var webBrowser = new ScreenshotCore(cefConfig, loggingService);
                webBrowser.Create(cefWindowInfo).Wait();

                return(webBrowser);
            },
                false);
        }
コード例 #4
0
        public PageTrackerCefApp(ICefConfig cefConfig, ILoggingService loggingService)
        {
            this.loggingService = loggingService;
            this.isInitialized = false;
            this.isDisposed = false;

            this.browser = new Lazy<ScreenshotCore>(
                () =>
                {
                    var cefWindowInfo = CefWindowInfo.Create();
                    cefWindowInfo.SetAsWindowless(IntPtr.Zero, true);

                    var webBrowser = new ScreenshotCore(cefConfig, loggingService);
                    webBrowser.Create(cefWindowInfo).Wait();
                    
                    return webBrowser;
                },
                false);
        }
コード例 #5
0
 public SubProcessService(ICefConfig cefConfig, ILoggingService loggingService)
 {
     this.cef = new PageTrackerCefApp(cefConfig, loggingService);
 }
コード例 #6
0
 public PageTrackerService(ICefConfig cefConfig, ILoggingService loggingService)
 {
     this.loggingService = loggingService;
     this.cef            = new PageTrackerCefApp(cefConfig, loggingService);
     this.cef.Initialize(false);
 }
コード例 #7
0
 public PageTrackerService(ICefConfig cefConfig, ILoggingService loggingService)
 {
     this.loggingService = loggingService;
     this.cef = new PageTrackerCefApp(cefConfig, loggingService);
     this.cef.Initialize(false);
 }