private void btnInspectWindow_Click(object sender, EventArgs e) { RegionCaptureOptions options = new RegionCaptureOptions() { DetectControls = false }; SelectHandle(options); }
public static void LoadProgramSettings() { Settings = ApplicationConfig.Load(ApplicationConfigFilePath); DefaultTaskSettings = Settings.DefaultTaskSettings; // TODO: Remove this next version if (Settings.IsUpgrade) { RegionCaptureOptions regionCaptureOptions = DefaultTaskSettings.CaptureSettings.SurfaceOptions; regionCaptureOptions.AnnotationOptions = new AnnotationOptions(); regionCaptureOptions.LastRegionTool = ShapeType.RegionRectangle; regionCaptureOptions.LastAnnotationTool = ShapeType.DrawingRectangle; } }
private bool SelectHandle(RegionCaptureOptions options) { SelectedWindow = null; SimpleWindowInfo simpleWindowInfo = RegionCaptureTasks.GetWindowInfo(options); if (simpleWindowInfo != null) { SelectedWindow = new WindowInfo(simpleWindowInfo.Handle); UpdateWindowInfo(); return(true); } return(false); }
private static void RunBackwardCompatibilityTasks() { if (Settings.IsUpgradeFrom("11.4.1")) { RegionCaptureOptions regionCaptureOptions = DefaultTaskSettings.CaptureSettings.SurfaceOptions; regionCaptureOptions.AnnotationOptions = new AnnotationOptions(); regionCaptureOptions.LastRegionTool = ShapeType.RegionRectangle; regionCaptureOptions.LastAnnotationTool = ShapeType.DrawingRectangle; } if (Settings.IsUpgradeFrom("11.5.0")) { if (File.Exists(ChromeHostManifestFilePath)) { IntegrationHelpers.CreateChromeExtensionSupport(true); } } }
private bool SelectHandle(bool isWindow) { RegionCaptureOptions options = new RegionCaptureOptions() { DetectControls = !isWindow }; SelectedWindow = null; SimpleWindowInfo simpleWindowInfo = RegionCaptureTasks.GetWindowInfo(options); if (simpleWindowInfo != null) { SelectedWindow = new WindowInfo(simpleWindowInfo.Handle); IsWindow = isWindow; UpdateWindowInfo(); return(true); } return(false); }
public static Bitmap AnnotateImage(Bitmap bmp, string filePath, TaskSettings taskSettings, bool taskMode = false) { if (bmp != null) { using (bmp) { RegionCaptureMode mode = taskMode ? RegionCaptureMode.TaskEditor : RegionCaptureMode.Editor; RegionCaptureOptions options = taskSettings.CaptureSettingsReference.SurfaceOptions; using (RegionCaptureForm form = new RegionCaptureForm(mode, options, bmp)) { form.ImageFilePath = filePath; form.SaveImageRequested += (output, newFilePath) => { using (output) { if (string.IsNullOrEmpty(newFilePath)) { string fileName = GetFilename(taskSettings, taskSettings.ImageSettings.ImageFormat.GetDescription(), output); newFilePath = Path.Combine(taskSettings.GetScreenshotsFolder(), fileName); } ImageHelpers.SaveImage(output, newFilePath); } return(newFilePath); }; form.SaveImageAsRequested += (output, newFilePath) => { using (output) { if (string.IsNullOrEmpty(newFilePath)) { string fileName = GetFilename(taskSettings, taskSettings.ImageSettings.ImageFormat.GetDescription(), output); newFilePath = Path.Combine(taskSettings.GetScreenshotsFolder(), fileName); } newFilePath = ImageHelpers.SaveImageFileDialog(output, newFilePath); } return(newFilePath); }; form.CopyImageRequested += output => { Option.MainForm.Invoke(() => { using (output) { ClipboardHelpers.CopyImage(output); } }); }; form.UploadImageRequested += output => { Option.MainForm.Invoke(() => { //UploadManager.UploadImage(output); }); }; form.PrintImageRequested += output => { Option.MainForm.Invoke(() => { using (output) { PrintImage(output); } }); }; form.ShowDialog(); switch (form.Result) { case RegionResult.Close: // Esc case RegionResult.AnnotateCancelTask: return(null); case RegionResult.Region: // Enter case RegionResult.AnnotateRunAfterCaptureTasks: return(form.GetResultImage()); case RegionResult.Fullscreen: // Space or right click case RegionResult.AnnotateContinueTask: return((Bitmap)form.Canvas.Clone()); } } } } return(null); }