Merge pull request #33 from Proopai/bugfix/32-preview-windows-resize-on-startup-incorrectly

preview windows resize on startup incorrectly
This commit is contained in:
Eric
2024-11-16 09:06:01 -06:00
committed by GitHub
4 changed files with 14 additions and 6 deletions

View File

@@ -56,6 +56,7 @@ namespace EveOPreview.Configuration.Implementation
this.MinimizeToTray = false; this.MinimizeToTray = false;
this.ThumbnailRefreshPeriod = 500; this.ThumbnailRefreshPeriod = 500;
this.ThumbnailResizeTimeoutPeriod = 500;
this.EnableCompatibilityMode = false; this.EnableCompatibilityMode = false;
@@ -130,6 +131,7 @@ namespace EveOPreview.Configuration.Implementation
public bool MinimizeToTray { get; set; } public bool MinimizeToTray { get; set; }
public int ThumbnailRefreshPeriod { get; set; } public int ThumbnailRefreshPeriod { get; set; }
public int ThumbnailResizeTimeoutPeriod { get; set; }
[JsonProperty("CompatibilityMode")] [JsonProperty("CompatibilityMode")]
public bool EnableCompatibilityMode { get; set; } public bool EnableCompatibilityMode { get; set; }
@@ -328,6 +330,7 @@ namespace EveOPreview.Configuration.Implementation
public void ApplyRestrictions() public void ApplyRestrictions()
{ {
this.ThumbnailRefreshPeriod = ThumbnailConfiguration.ApplyRestrictions(this.ThumbnailRefreshPeriod, 300, 1000); this.ThumbnailRefreshPeriod = ThumbnailConfiguration.ApplyRestrictions(this.ThumbnailRefreshPeriod, 300, 1000);
this.ThumbnailResizeTimeoutPeriod = ThumbnailConfiguration.ApplyRestrictions(this.ThumbnailResizeTimeoutPeriod, 200, 5000);
this.ThumbnailSize = new Size(ThumbnailConfiguration.ApplyRestrictions(this.ThumbnailSize.Width, this.ThumbnailMinimumSize.Width, this.ThumbnailMaximumSize.Width), this.ThumbnailSize = new Size(ThumbnailConfiguration.ApplyRestrictions(this.ThumbnailSize.Width, this.ThumbnailMinimumSize.Width, this.ThumbnailMaximumSize.Width),
ThumbnailConfiguration.ApplyRestrictions(this.ThumbnailSize.Height, this.ThumbnailMinimumSize.Height, this.ThumbnailMaximumSize.Height)); ThumbnailConfiguration.ApplyRestrictions(this.ThumbnailSize.Height, this.ThumbnailMinimumSize.Height, this.ThumbnailMaximumSize.Height));
this.ThumbnailOpacity = ThumbnailConfiguration.ApplyRestrictions((int)(this.ThumbnailOpacity * 100.00), 20, 100) / 100.00; this.ThumbnailOpacity = ThumbnailConfiguration.ApplyRestrictions((int)(this.ThumbnailOpacity * 100.00), 20, 100) / 100.00;

View File

@@ -19,7 +19,7 @@ namespace EveOPreview.Configuration
bool MinimizeToTray { get; set; } bool MinimizeToTray { get; set; }
int ThumbnailRefreshPeriod { get; set; } int ThumbnailRefreshPeriod { get; set; }
int ThumbnailResizeTimeoutPeriod { get; set; }
bool EnableCompatibilityMode { get; set; } bool EnableCompatibilityMode { get; set; }
double ThumbnailOpacity { get; set; } double ThumbnailOpacity { get; set; }

View File

@@ -12,7 +12,6 @@ namespace EveOPreview.View
public abstract partial class ThumbnailView : Form, IThumbnailView public abstract partial class ThumbnailView : Form, IThumbnailView
{ {
#region Private constants #region Private constants
private const int RESIZE_EVENT_TIMEOUT = 500;
private const double OPACITY_THRESHOLD = 0.9; private const double OPACITY_THRESHOLD = 0.9;
private const double OPACITY_EPSILON = 0.1; private const double OPACITY_EPSILON = 0.1;
#endregion #endregion
@@ -50,6 +49,7 @@ namespace EveOPreview.View
protected ThumbnailView(IWindowManager windowManager, IThumbnailConfiguration config, IThumbnailManager thumbnailManager) protected ThumbnailView(IWindowManager windowManager, IThumbnailConfiguration config, IThumbnailManager thumbnailManager)
{ {
this._config = config;
this.SuppressResizeEvent(); this.SuppressResizeEvent();
this.WindowManager = windowManager; this.WindowManager = windowManager;
@@ -73,7 +73,6 @@ namespace EveOPreview.View
this._overlay = new ThumbnailOverlay(this, this.MouseDown_Handler); this._overlay = new ThumbnailOverlay(this, this.MouseDown_Handler);
this._config = config;
SetDefaultBorderColor(); SetDefaultBorderColor();
this._thumbnailManager = thumbnailManager; this._thumbnailManager = thumbnailManager;
} }
@@ -453,7 +452,7 @@ namespace EveOPreview.View
{ {
// Workaround for WinForms issue with the Resize event being fired with inconsistent ClientSize value // Workaround for WinForms issue with the Resize event being fired with inconsistent ClientSize value
// Any Resize events fired before this timestamp will be ignored // Any Resize events fired before this timestamp will be ignored
this._suppressResizeEventsTimestamp = DateTime.UtcNow.AddMilliseconds(ThumbnailView.RESIZE_EVENT_TIMEOUT); this._suppressResizeEventsTimestamp = DateTime.UtcNow.AddMilliseconds(_config.ThumbnailResizeTimeoutPeriod);
} }
#region GUI events #region GUI events

View File

@@ -1,3 +1,9 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<configuration> <configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup></configuration> <startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
</startup>
<System.Windows.Forms.ApplicationConfigurationSection>
<add key="EnableWindowsFormsHighDpiAutoResizing" value="true" />
</System.Windows.Forms.ApplicationConfigurationSection>
</configuration>