Beispiel #1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            var c = new CaptureRegion(RegionCaptureType.Default);

            var taskSettings = TaskSettings.GetDefaultTaskSettings();

            taskSettings.GeneralSettings.PlaySoundAfterCapture           = false;
            taskSettings.GeneralSettings.PlaySoundAfterUpload            = false;
            taskSettings.GeneralSettings.PopUpNotification               = PopUpNotificationType.None;
            taskSettings.AdvancedSettings.RegionCaptureDisableAnnotation = true;

            c.Capture(taskSettings, true);
            var imageInfo = c.GetLastCapture();

            if (imageInfo != null && imageInfo.Image != null)
            {
                Msg.Text = $"捕获目标,W:{imageInfo.Image.Width},H:{imageInfo.Image.Height}";
            }
            else
            {
                Msg.Text = "放弃捕获";
            }
        }
Beispiel #2
0
        public void DoCapture(ScreenCaptureDelegate capture, CaptureType captureType, TaskSettings taskSettings = null, bool autoHideForm = true)
        {
            if (taskSettings == null)
            {
                taskSettings = TaskSettings.GetDefaultTaskSettings();
            }

            if (taskSettings.CaptureSettings.IsDelayScreenshot && taskSettings.CaptureSettings.DelayScreenshot > 0)
            {
                TaskEx.Run(() =>
                {
                    int sleep = (int)(taskSettings.CaptureSettings.DelayScreenshot * 1000);
                    Thread.Sleep(sleep);
                },
                           () =>
                {
                    DoCaptureWork(capture, captureType, taskSettings, autoHideForm);
                });
            }
            else
            {
                DoCaptureWork(capture, captureType, taskSettings, autoHideForm);
            }
        }