示例#1
0
        private void TakeScreenshot()
        {
            Rectangle rect = Program.Settings.AutoCaptureRegion;

            if (!rect.IsEmpty)
            {
                TaskSettings taskSettings = TaskSettings.GetDefaultTaskSettings();
                if (this.TaskSettings != null)
                {
                    taskSettings = this.TaskSettings;
                }

                Image img = TaskHelpers.GetScreenshot(taskSettings).CaptureRectangle(rect);

                if (img != null)
                {
                    taskSettings.UseDefaultAfterCaptureJob             = false;
                    taskSettings.AfterCaptureJob                       = taskSettings.AfterCaptureJob.Remove(AfterCaptureTasks.AnnotateImage);
                    taskSettings.UseDefaultAdvancedSettings            = false;
                    taskSettings.AdvancedSettings.DisableNotifications = true;

                    UploadManager.RunImageTask(img, taskSettings, true, true);
                }
            }
        }
示例#2
0
        public static void AnnotateImageUsingShareX(string filePath, TaskSettings taskSettings = null)
        {
            Image result = RegionCaptureTasks.AnnotateImage(filePath, taskSettings.CaptureSettingsReference.SurfaceOptions);

            if (result != null)
            {
                UploadManager.RunImageTask(result, taskSettings);
            }
        }
示例#3
0
        public static void OpenImageCombiner(TaskSettings taskSettings = null)
        {
            if (taskSettings == null)
            {
                taskSettings = TaskSettings.GetDefaultTaskSettings();
            }

            ImageCombinerForm imageCombinerForm = new ImageCombinerForm(taskSettings.ToolsSettingsReference.ImageCombinerOptions);

            imageCombinerForm.ProcessRequested += img => UploadManager.RunImageTask(img, taskSettings);
            imageCombinerForm.Show();
        }
示例#4
0
        public static void OpenScrollingCapture(TaskSettings taskSettings = null, bool forceSelection = false)
        {
            if (taskSettings == null)
            {
                taskSettings = TaskSettings.GetDefaultTaskSettings();
            }

            ScrollingCaptureForm scrollingCaptureForm = new ScrollingCaptureForm(taskSettings.CaptureSettingsReference.ScrollingCaptureOptions, forceSelection);

            scrollingCaptureForm.ImageProcessRequested += img => UploadManager.RunImageTask(img, taskSettings);
            scrollingCaptureForm.Show();
        }
示例#5
0
 public static Image AnnotateImage(Image img, string imgPath)
 {
     return(ImageHelpers.AnnotateImage(img, imgPath, !Program.IsSandbox, Program.PersonalPath,
                                       x => Program.MainForm.InvokeSafe(() => ClipboardHelpers.CopyImage(x)),
                                       x => Program.MainForm.InvokeSafe(() => UploadManager.RunImageTask(x)),
                                       (x, filePath) => Program.MainForm.InvokeSafe(() => ImageHelpers.SaveImage(x, filePath)),
                                       (x, filePath) =>
     {
         string newFilePath = null;
         Program.MainForm.InvokeSafe(() => newFilePath = ImageHelpers.SaveImageFileDialog(x, filePath));
         return newFilePath;
     }));
 }
示例#6
0
        private static void AfterCapture(Image img, CaptureType captureType, TaskSettings taskSettings)
        {
            if (img != null)
            {
                if (taskSettings.GeneralSettings.PlaySoundAfterCapture)
                {
                    TaskHelpers.PlayCaptureSound(taskSettings);
                }

                if (taskSettings.ImageSettings.ImageEffectOnlyRegionCapture && !IsRegionCapture(captureType))
                {
                    taskSettings.AfterCaptureJob = taskSettings.AfterCaptureJob.Remove(AfterCaptureTasks.AddImageEffects);
                }

                UploadManager.RunImageTask(img, taskSettings);
            }
        }
示例#7
0
        private void TakeScreenshot()
        {
            if (!CaptureRectangle.IsEmpty)
            {
                Image img = Screenshot.CaptureRectangle(CaptureRectangle);

                if (img != null)
                {
                    TaskSettings taskSettings = TaskSettings.GetDefaultTaskSettings();
                    taskSettings.UseDefaultAfterCaptureJob             = false;
                    taskSettings.AfterCaptureJob                       = taskSettings.AfterCaptureJob.Remove(AfterCaptureTasks.AnnotateImage);
                    taskSettings.UseDefaultAdvancedSettings            = false;
                    taskSettings.AdvancedSettings.DisableNotifications = true;

                    UploadManager.RunImageTask(img, taskSettings);
                }
            }
        }
示例#8
0
        public static void OpenWebpageCapture(TaskSettings taskSettings = null)
        {
            if (taskSettings == null)
            {
                taskSettings = TaskSettings.GetDefaultTaskSettings();
            }

            WebpageCaptureForm webpageCaptureForm = new WebpageCaptureForm();

            webpageCaptureForm.OnImageUploadRequested += img => UploadManager.RunImageTask(img, taskSettings);
            webpageCaptureForm.OnImageCopyRequested   += img =>
            {
                using (img)
                {
                    ClipboardHelpers.CopyImage(img);
                }
            };
            webpageCaptureForm.Show();
        }
示例#9
0
        private void TakeScreenshot()
        {
            Rectangle rect = Program.Settings.AutoCaptureRegion;

            if (!rect.IsEmpty)
            {
                Bitmap bmp = TaskHelpers.GetScreenshot(TaskSettings).CaptureRectangle(rect);

                if (bmp != null)
                {
                    TaskSettings.UseDefaultAfterCaptureJob            = false;
                    TaskSettings.AfterCaptureJob                      = TaskSettings.AfterCaptureJob.Remove(AfterCaptureTasks.AnnotateImage);
                    TaskSettings.UseDefaultAdvancedSettings           = false;
                    TaskSettings.GeneralSettings.DisableNotifications = true;

                    UploadManager.RunImageTask(bmp, TaskSettings, true, true);
                }
            }
        }
示例#10
0
        private void AfterCapture(Image img, CaptureType captureType, TaskSettings taskSettings)
        {
            if (img != null)
            {
                if (taskSettings.GeneralSettings.PlaySoundAfterCapture)
                {
                    Helpers.PlaySoundAsync(Resources.CameraSound);
                }

                if (taskSettings.ImageSettings.ImageEffectOnlyRegionCapture && !IsRegionCapture(captureType))
                {
                    taskSettings.AfterCaptureJob = taskSettings.AfterCaptureJob.Remove(AfterCaptureTasks.AddImageEffects);
                }

                if (taskSettings.GeneralSettings.ShowAfterCaptureTasksForm)
                {
                    using (AfterCaptureForm afterCaptureForm = new AfterCaptureForm(img, taskSettings))
                    {
                        afterCaptureForm.ShowDialog();

                        switch (afterCaptureForm.Result)
                        {
                        case AfterCaptureFormResult.Continue:
                            taskSettings.AfterCaptureJob = afterCaptureForm.AfterCaptureTasks;
                            break;

                        case AfterCaptureFormResult.Copy:
                            taskSettings.AfterCaptureJob = AfterCaptureTasks.CopyImageToClipboard;
                            break;

                        case AfterCaptureFormResult.Cancel:
                            if (img != null)
                            {
                                img.Dispose();
                            }
                            return;
                        }
                    }
                }

                UploadManager.RunImageTask(img, taskSettings);
            }
        }
示例#11
0
        public static void AnnotateImageUsingShareX(Image img, string filePath, TaskSettings taskSettings = null)
        {
            if (img == null && File.Exists(filePath))
            {
                img = ImageHelpers.LoadImage(filePath);
            }

            if (img != null)
            {
                using (img)
                {
                    RegionCaptureTasks.AnnotateImage(img, filePath, taskSettings.CaptureSettingsReference.SurfaceOptions,
                                                     x => UploadManager.RunImageTask(x, taskSettings),
                                                     (x, newFilePath) => ImageHelpers.SaveImage(x, newFilePath),
                                                     (x, newFilePath) => ImageHelpers.SaveImageFileDialog(x, newFilePath),
                                                     x => ClipboardHelpers.CopyImage(x),
                                                     x => UploadManager.UploadImage(x),
                                                     x => PrintImage(x));
                }
            }
        }
示例#12
0
        private void AfterCapture(ImageInfo imageInfo, TaskSettings taskSettings)
        {
            if (imageInfo != null && imageInfo.Image != null)
            {
                if (taskSettings.GeneralSettings.PlaySoundAfterCapture)
                {
                    TaskHelpers.PlayCaptureSound(taskSettings);
                }

                if (taskSettings.AfterCaptureJob.HasFlag(AfterCaptureTasks.AnnotateImage) && !AllowAnnotation)
                {
                    taskSettings.AfterCaptureJob = taskSettings.AfterCaptureJob.Remove(AfterCaptureTasks.AnnotateImage);
                }

                if (taskSettings.ImageSettings.ImageEffectOnlyRegionCapture &&
                    this.GetType() != typeof(CaptureRegion) && this.GetType() != typeof(CaptureLastRegion))
                {
                    taskSettings.AfterCaptureJob = taskSettings.AfterCaptureJob.Remove(AfterCaptureTasks.AddImageEffects);
                }

                UploadManager.RunImageTask(imageInfo, taskSettings);
            }
        }
示例#13
0
        private static void AfterCapture(ImageInfo imageInfo, CaptureType captureType, TaskSettings taskSettings)
        {
            if (imageInfo != null && imageInfo.Image != null)
            {
                if (taskSettings.GeneralSettings.PlaySoundAfterCapture)
                {
                    TaskHelpers.PlayCaptureSound(taskSettings);
                }

                if (taskSettings.AdvancedSettings.UseShareXForAnnotation && taskSettings.AfterCaptureJob.HasFlag(AfterCaptureTasks.AnnotateImage) &&
                    captureType == CaptureType.Region)
                {
                    taskSettings.AfterCaptureJob = taskSettings.AfterCaptureJob.Remove(AfterCaptureTasks.AnnotateImage);
                }

                if (taskSettings.ImageSettings.ImageEffectOnlyRegionCapture && !IsRegionCapture(captureType))
                {
                    taskSettings.AfterCaptureJob = taskSettings.AfterCaptureJob.Remove(AfterCaptureTasks.AddImageEffects);
                }

                UploadManager.RunImageTask(imageInfo, taskSettings);
            }
        }
示例#14
0
 private void tsmiTestImageUpload_Click(object sender, EventArgs e)
 {
     UploadManager.RunImageTask(Resources.Test);
 }
示例#15
0
 public static Image AnnotateImage(Image img)
 {
     return(ImageHelpers.AnnotateImage(img, !Program.IsSandbox, Program.PersonalPath,
                                       x => Program.MainForm.InvokeSafe(() => ClipboardHelpers.CopyImage(x)),
                                       x => Program.MainForm.InvokeSafe(() => UploadManager.RunImageTask(x))));
 }