/// <summary> /// Capture one Bitmap. /// </summary> /// <param name="region"></param> public async void CaptureImage(Rectangle region) { var stream = new MemoryStream(); var bitmap = CaptureService.CaptureBitmap(region); bitmap.Save(stream, SettingsService.Current.ImageFormat); // Copy bitmap to the clipboard if (!SettingsService.Current.NoImageCopy) { CopyImage(bitmap); } // Generate filename and start the upload(s) var url = await UploadAll(stream, SettingsService.Current.SafeImageExt); // Try to copy URL if (SettingsService.Current.NoImageCopy) { CopyUrl(url); } bitmap.Dispose(); stream.Dispose(); Complete(url != null); // Exits the application }
/// <summary> /// Refresh the background if transparency is disabled. /// </summary> private void RefreshBackground() { if (!SettingsService.Current.NoTransparency) { return; } var bitmap = CaptureService.CaptureBitmap(new Rectangle(PointToScreen(Location), ClientSize)); BackgroundImage = bitmap; Opacity = 1.0D; }