This commit is made due to BUG-1775. Although it might not fix it, it ensures that every window has an icon and only than when it loaded. Also added improved error handling.

This commit is contained in:
Robin 2015-04-17 11:06:57 +02:00
commit 7938ab5dad
29 changed files with 32 additions and 34 deletions

View file

@ -18,17 +18,20 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using System;
using System.Windows.Forms;
using GreenshotPlugin.Core;
using GreenshotPlugin.UnmanagedHelpers;
using Greenshot.IniFile;
using log4net;
namespace GreenshotPlugin.Controls {
/// <summary>
/// Extend this Form to have the possibility for animations on your form
/// </summary>
public class AnimatingForm : GreenshotForm {
private static readonly ILog LOG = LogManager.GetLogger(typeof(AnimatingForm));
private const int DEFAULT_VREFRESH = 60;
private int vRefresh = 0;
private Timer timer = null;
@ -110,7 +113,11 @@ namespace GreenshotPlugin.Controls {
/// <param name="sender"></param>
/// <param name="e"></param>
void timer_Tick(object sender, EventArgs e) {
Animate();
try {
Animate();
} catch (Exception ex) {
LOG.Warn("An exception occured while animating:", ex);
}
}
/// <summary>

View file

@ -131,6 +131,9 @@ namespace GreenshotPlugin.Controls {
}
protected override void OnLoad(EventArgs e) {
// Every GreenshotForm should have it's default icon
// And it might not ne needed for a Tool Window, but still for the task manager / switcher it's important
Icon = GreenshotResources.getGreenshotIcon();
if (!DesignMode) {
if (!applyLanguageManually) {
ApplyLanguage();
@ -413,7 +416,7 @@ namespace GreenshotPlugin.Controls {
if (section != null) {
IniValue iniValue = null;
if (!section.Values.TryGetValue(configBindable.PropertyName, out iniValue)) {
LOG.WarnFormat("Wrong property '{0}' configured for field '{1}'",configBindable.PropertyName,field.Name);
LOG.DebugFormat("Wrong property '{0}' configured for field '{1}'",configBindable.PropertyName,field.Name);
continue;
}

View file

@ -41,7 +41,6 @@ namespace GreenshotPlugin.Controls {
// The InitializeComponent() call is required for Windows Forms designer support.
//
InitializeComponent();
Icon = GreenshotResources.getGreenshotIcon();
checkBox_reduceColors.Checked = Settings.ReduceColors;
trackBarJpegQuality.Enabled = OutputFormat.jpg.Equals(outputSettings.Format);