BUG-1700: Fixed issue with capturing IE, somehow the background color couldn't be retrieved the second time... a try-catch in the IEContainer.cs solves this.

This commit is contained in:
RKrom 2014-11-18 21:42:21 +01:00
commit 1582b01e03
3 changed files with 13 additions and 10 deletions

View file

@ -43,7 +43,7 @@ namespace Greenshot.Helpers {
/// </summary>
public static class IECaptureHelper {
private static ILog LOG = LogManager.GetLogger(typeof(IECaptureHelper));
private static CoreConfiguration configuration = IniConfig.GetIniSection<CoreConfiguration>();
private static readonly CoreConfiguration configuration = IniConfig.GetIniSection<CoreConfiguration>();
// Helper method to activate a certain IE Tab
public static void ActivateIETab(WindowDetails ieWindowDetails, int tabIndex) {
@ -96,7 +96,7 @@ namespace Greenshot.Helpers {
/// <summary>
/// Get Windows displaying an IE
/// </summary>
/// <returns>List<WindowDetails></returns>
/// <returns>IEnumerable WindowDetails</returns>
public static IEnumerable<WindowDetails> GetIEWindows() {
foreach (WindowDetails possibleIEWindow in WindowDetails.GetAllWindows()) {
if (possibleIEWindow.Text.Length == 0) {
@ -369,9 +369,8 @@ namespace Greenshot.Helpers {
// bitmap to return
Bitmap returnBitmap = null;
Size pageSize = Size.Empty;
try {
pageSize = PrepareCapture(documentContainer, capture);
Size pageSize = PrepareCapture(documentContainer, capture);
returnBitmap = capturePage(documentContainer, capture, pageSize);
} catch (Exception captureException) {
LOG.Error("Exception found, ignoring and returning nothing! Error was: ", captureException);

View file

@ -330,11 +330,14 @@ namespace Greenshot.Helpers.IEInterop {
public Color BackgroundColor {
get {
if (document2.bgColor != null) {
string bgColorString = (string)document2.bgColor;
int rgbInt = Int32.Parse(bgColorString.Substring(1), NumberStyles.HexNumber);
Color bgColor = Color.FromArgb(rgbInt >> 16, (rgbInt >> 8) & 255, rgbInt & 255);
return bgColor;
try {
string bgColor = (string)document2.bgColor;
if (bgColor != null) {
int rgbInt = Int32.Parse(bgColor.Substring(1), NumberStyles.HexNumber);
return Color.FromArgb(rgbInt >> 16, (rgbInt >> 8) & 255, rgbInt & 255);
}
} catch (Exception ex) {
LOG.Error("Problem retrieving the background color: ", ex);
}
return Color.White;
}

View file

@ -14,7 +14,8 @@ Changes:
* Optimized Greenshots update check to use even less traffic by checking the time-stamp of the update feed before downloading it.
Bugs Resolved:
* BUG-1686: Issues with the background if a filter (highlight etc) is used.
* BUG-1686: Shadow (drop shadow or torn edge) grows if a filter (highlight etc) is used and an element is moved around
* BUG-1700: IE capture only works once
1.2.2.43-380f581 RC2