Previous changes created problems with the context-menu, as it was still referencing an icon that we dispose at icon size change. This change introduces a PropertyChanged event object to the CoreConfiguration so those interested can register to changes (currently only the IconSize), and apply the correct menu image.

This commit is contained in:
RKrom 2014-11-11 14:13:13 +01:00
commit e0c9fc1f7b
5 changed files with 96 additions and 66 deletions

View file

@ -388,7 +388,8 @@ namespace Greenshot {
}
SoundHelper.Initialize();
MainForm.ResetImageScalingSize();
coreConfiguration.PropertyChanged += OnIconSizeChanged;
OnIconSizeChanged(this, new PropertyChangedEventArgs("IconSize"));
// Set the Greenshot icon visibility depending on the configuration. (Added for feature #3521446)
// Setting it to true this late prevents Problems with the context menu
@ -552,12 +553,14 @@ namespace Greenshot {
}
/// <summary>
/// Reset ImageScalingSize
/// Fix icon reference
/// </summary>
/// <returns>Used for fixing scaling issues</returns>
public static void ResetImageScalingSize() {
MainForm thisForm = MainForm.Instance;
thisForm.contextMenu.ImageScalingSize = coreConfiguration.IconSize;
/// <param name="sender"></param>
/// <param name="e"></param>
private void OnIconSizeChanged(object sender, PropertyChangedEventArgs e) {
if (e.PropertyName == "IconSize") {
contextMenu.ImageScalingSize = coreConfiguration.IconSize;
}
}
/// <summary>