Exemple #1
0
        public async Task TakeScreenshotsAsync(CancellationToken?token = null, IProgress <TaskProgress> progress = null)
        {
            CreateEmptyDir();

            var results = new ScreenshotResults(_creationTimestamp);

            using (var ss = new Screenshotter(_project))
            {
                int i = 0;
                foreach (var uri in PageUris)
                {
                    if (token?.IsCancellationRequested == true)
                    {
                        throw new TaskCanceledException("The screenshotting task was canceled.");
                    }

                    var currentProgress = new TaskProgress(++i, PageUris.Count, uri.AbsoluteUri);
                    progress?.Report(currentProgress);
                    var result = new DeviceScreenshots(uri);
                    await ScreenshotPageAsAllDevices(ss, uri, result);

                    results.Screenshots.Add(result);
                }
            }

            string sessionLabel = Path.GetFileName(_screenshotDir);

            Store.SaveScreenshotManifest(sessionLabel, results);
            var completedProgress = new TaskProgress(PageUris.Count, PageUris.Count, "Completed");

            progress?.Report(completedProgress);
        }
Exemple #2
0
        private void Form_SessionSelected(object sender, EventArgs e)
        {
            string            key         = Form.SelectedSession;
            ScreenshotResults screenshots = _results[key];

            Form.ShowSessionScreenshots(screenshots);
        }