示例#1
0
        private string CaptureCurrentWindow(string applicationName, string windowName)
        {
            var userpath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
            var path     = userpath + "/Captures/";
            var today    = DateTime.Now;
            var fileName = $"{_psName}_{today:yyyyMMddhhmmss}";

            Directory.CreateDirectory(path);

            return(ProcessInfo.CaptureActiveWindowScreenShot(path, fileName, applicationName, windowName));
        }
        private string CaptureCurrentWindow(string applicationName, string windowName)
        {
            var path     = this.userpath + "\\Captures\\";
            var today    = DateTime.Now;
            var fileName = $"{_psName}_{today:yyyyMMddhhmmss}";

            Directory.CreateDirectory(path);
            String screenshotFilepath = Path.GetFullPath(Path.Combine(path, $"{fileName}.jpeg"));

            this.screenshotFilepath = screenshotFilepath;
            this.screenshotStruct   = new ScreenshotStruct(fileName, screenshotFilepath, null);           //screenshot doesn't exist yet, no sense in converting it to base64 now

            Task <string> screenshotPathTask = Task <string> .Run(() => ProcessInfo.CaptureActiveWindowScreenShot(path, fileName, applicationName, windowName));

            return(screenshotPathTask.Result);
        }