Beispiel #1
0
 public MainWindow()
 {
     InitializeComponent();
     Screenshoter = new Screenshoter();
     Video        = new VideoMaker();
     Timer        = new DispatcherTimer();
 }
Beispiel #2
0
 /// <summary>
 /// Creates screenshot of all available screens. <br/>
 /// If <paramref name="rectangle"/> is not null, returns image of this region.
 /// </summary>
 /// <param name="rectangle"></param>
 /// <param name="cancellationToken"></param>
 /// <returns></returns>
 public async Task <Bitmap> ShotAsync(
     Rectangle?rectangle = null,
     CancellationToken cancellationToken = default)
 {
     return(await Screenshoter.ShotAsync(rectangle, cancellationToken)
            .ConfigureAwait(false));
 }
Beispiel #3
0
 protected override async Task <bool> OnResultAsync()
 {
     using (var image = await Screenshoter.ShotVirtualDisplayAsync()) // TODO: shot main display ?
         using (var bitmap = new Bitmap(image))
         {
             return(Analyze(bitmap));
         }
 }
Beispiel #4
0
        public async Task AsyncMultiShotTest()
        {
            using var cancellationTokenSource = new CancellationTokenSource(TimeSpan.FromSeconds(30));
            var cancellationToken = cancellationTokenSource.Token;

            await Task.WhenAll(Enumerable
                               .Range(0, 10)
                               .Select(_ => Screenshoter.ShotAsync(cancellationToken: cancellationToken)));
        }
 public CheckAuthorAndTitleInYoutubeVideo(ScenarioContext scenarioContext)
 {
     if (scenarioContext == null)
     {
         throw new ArgumentNullException("scenarioContext");
     }
     this.scenarioContext = scenarioContext;
     screenshoter         = new Screenshoter(scenarioContext, BrowserContainer.GetBrowser(scenarioContext.ScenarioInfo.Title).Driver);
     page = new YouTubePage(BrowserContainer.GetBrowser(scenarioContext.ScenarioInfo.Title));
 }
Beispiel #6
0
    private void OnEnable()
    {
        lastTimeScale = null;
        t             = target as Screenshoter;

        list = new ReorderableList(serializedObject, serializedObject.FindProperty("resolutions"), false, false, true, true);
        list.drawElementCallback = (rect, index, isActive, isFocused) =>
        {
            DrawElement(list.serializedProperty.GetArrayElementAtIndex(index), rect, index, isActive, isFocused);
        };
        currentResolution = list.index = t.SelectedResolutionIndex();
    }
Beispiel #7
0
        public void InverseRectangleShotTest()
        {
            var bitmap = Screenshoter.Shot(Rectangle.FromLTRB(5278, 1426, 4509, 808));
            var path   = $"{Path.GetTempFileName()}.bmp";

            bitmap.Save(path);

            Process.Start(new ProcessStartInfo(path)
            {
                UseShellExecute = true,
            });
        }
Beispiel #8
0
        public void ShotTest()
        {
            var bitmap = Screenshoter.Shot();
            var path   = $"{Path.GetTempFileName()}.bmp";

            bitmap.Save(path);

            Process.Start(new ProcessStartInfo(path)
            {
                UseShellExecute = true,
            });
        }
Beispiel #9
0
 void Start()
 {
     if (Instance == null)
     {
         Instance = this;
         DontDestroyOnLoad(gameObject);
     }
     else
     {
         Destroy(gameObject);
     }
     CreateFolder();
 }
Beispiel #10
0
        public void ShotEachDisplayTest()
        {
            foreach (var rectangle in Screenshoter.GetPhysicalScreens())
            {
                var bitmap = Screenshoter.Shot(rectangle);
                var path   = $"{Path.GetTempFileName()}.bmp";

                bitmap.Save(path);

                Process.Start(new ProcessStartInfo(path)
                {
                    UseShellExecute = true,
                });
            }
        }
Beispiel #11
0
        public async Task AsyncShotTest()
        {
            using var cancellationTokenSource = new CancellationTokenSource(TimeSpan.FromSeconds(30));
            var cancellationToken = cancellationTokenSource.Token;

            var bitmap = await Screenshoter.ShotAsync(cancellationToken : cancellationToken);

            var path = $"{Path.GetTempFileName()}.bmp";

            bitmap.Save(path);

            Process.Start(new ProcessStartInfo(path)
            {
                UseShellExecute = true,
            });
        }
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();

        Screenshoter ScreenshoterScript = (Screenshoter)target;

        GUILayout.Space(20);
        if (GUILayout.Button("Take Screenshot"))
        {
            ScreenshoterScript.TakeEditorScreenshot();
        }
        if (GUILayout.Button("Open Folder"))
        {
            ScreenshoterScript.OpenFolder();
        }
        GUILayout.Space(10);
    }
Beispiel #13
0
        private void MakeScreenshot()
        {
            var screenPath = new Screenshoter(this.App.Pages.Driver).TakeScreenshot(
                TestContext.CurrentContext.Test.MethodName,
                TestContext.CurrentContext.TestDirectory + "\\Logs");

            if (!string.IsNullOrEmpty(screenPath))
            {
                //                this.App.Logger.Info("Screenshot {rp#file# " + screenPath + "}");

                //temporary to check screens from azure agent
                this.App.Logger.Info("Screenshot {" + screenPath + "}");

                Bridge.LogMessage(ReportPortal.Client.Models.LogLevel.Info, "Screenshot {rp#file#" + screenPath + "}");
            }
            else
            {
                this.App.Logger.Warn("Can't make screenshot");
            }
        }
Beispiel #14
0
 public void CloseApplication()
 {
     Screenshoter.TakeFullScreenshot();
     FApplication.Instance.CloseApplication();
 }
Beispiel #15
0
 public void TakeScreenshot()
 {
     Screenshoter.TakeScreenshot();
 }
Beispiel #16
0
 private void dispatcherTimer_Tick(object sender, EventArgs e)
 {
     Video.AddFrame(Screenshoter.TakeScreenshot(Screen.PrimaryScreen));
 }
Beispiel #17
0
 private static void ScreenshotersInit()
 {
     screenshoter = new Screenshoter();
 }