Exemplo n.º 1
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);
        }
Exemplo n.º 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);
            }
        }
Exemplo n.º 3
0
        public static bool ShowAfterCaptureForm(TaskSettings taskSettings, out string fileName, Image img = null, string filePath = null)
        {
            fileName = null;

            if (taskSettings.AfterCaptureJob.HasFlag(AfterCaptureTasks.ShowAfterCaptureWindow))
            {
                AfterCaptureForm afterCaptureForm = null;

                try
                {
                    if (!string.IsNullOrEmpty(filePath))
                    {
                        afterCaptureForm = new AfterCaptureForm(filePath, taskSettings);
                    }
                    else
                    {
                        afterCaptureForm = new AfterCaptureForm(img, taskSettings);
                    }

                    if (afterCaptureForm.ShowDialog() == DialogResult.Cancel)
                    {
                        if (img != null)
                        {
                            img.Dispose();
                        }

                        return(false);
                    }

                    fileName = afterCaptureForm.FileName;
                }
                finally
                {
                    afterCaptureForm.Dispose();
                }
            }

            return(true);
        }
Exemplo n.º 4
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);
        }
Exemplo n.º 5
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;
        }
Exemplo n.º 6
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);
            }
        }
Exemplo n.º 7
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;
        }
Exemplo n.º 8
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);
            }
        }