예제 #1
0
파일: TaskHelpers.cs 프로젝트: KoMiI/ShareX
        public static bool ShowAfterCaptureForm(TaskSettings taskSettings, Image img = null)
        {
            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(false);
                    }
                }
            }

            return(true);
        }
예제 #2
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);
            }
        }
예제 #3
0
        public static bool ShowAfterCaptureForm(TaskSettings taskSettings, out string fileName, Image img = null)
        {
            fileName = null;

            if (taskSettings.AfterCaptureJob.HasFlag(AfterCaptureTasks.ShowAfterCaptureWindow))
            {
                using (AfterCaptureForm afterCaptureForm = new AfterCaptureForm(img, taskSettings))
                {
                    if (afterCaptureForm.ShowDialog() == DialogResult.Cancel)
                    {
                        if (img != null)
                        {
                            img.Dispose();
                        }
                        return(false);
                    }

                    fileName = afterCaptureForm.FileName;
                }
            }

            return(true);
        }
예제 #4
0
        public static bool ShowAfterCaptureForm(TaskSettings taskSettings, Image img = null)
        {
            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 false;
                    }
                }
            }

            return true;
        }
예제 #5
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);
            }
        }
예제 #6
0
        public static bool ShowAfterCaptureForm(TaskSettings taskSettings, out string fileName, Image img = null)
        {
            fileName = null;

            if (taskSettings.GeneralSettings.ShowAfterCaptureTasksForm)
            {
                using (AfterCaptureForm afterCaptureForm = new AfterCaptureForm(img, taskSettings))
                {
                    if (afterCaptureForm.ShowDialog() == DialogResult.Cancel)
                    {
                        if (img != null) img.Dispose();
                        return false;
                    }

                    fileName = afterCaptureForm.FileName;
                }
            }

            return true;
        }
예제 #7
0
        private void AfterCapture(Image img, CaptureType captureType, TaskSettings taskSettings)
        {
            if (img != null)
            {
                if (taskSettings.ImageSettings.ImageEffectOnlyRegionCapture && !IsRegionCapture(captureType))
                {
                    taskSettings.AfterCaptureJob = taskSettings.AfterCaptureJob.Remove(AfterCaptureTasks.AddBorder, AfterCaptureTasks.AddShadow);
                }

                if (Program.Settings.ShowAfterCaptureTasksForm)
                {
                    using (AfterCaptureForm afterCaptureForm = new AfterCaptureForm(img, taskSettings.AfterCaptureJob))
                    {
                        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);
            }
        }