From e6d38040e01a7cfd770aeca6b6fa353c7cb7da8c Mon Sep 17 00:00:00 2001 From: Milan Hanajik Date: Mon, 13 Jun 2016 11:08:32 +0200 Subject: [PATCH] Previous results display after changing the window size uses a timer, ver.2.7.306 --- Results/Forms/BatchResultsDlg.cs | 54 ++++++++++++++----- Results/Properties/AssemblyInfo.cs | 4 +- TestBenchFramework/Properties/AssemblyInfo.cs | 4 +- 3 files changed, 46 insertions(+), 16 deletions(-) diff --git a/Results/Forms/BatchResultsDlg.cs b/Results/Forms/BatchResultsDlg.cs index 6ceff2e49..86e40de2a 100644 --- a/Results/Forms/BatchResultsDlg.cs +++ b/Results/Forms/BatchResultsDlg.cs @@ -16,6 +16,9 @@ namespace Results.Forms { static readonly ILog log = LogManager.GetLogger(typeof(BatchResultsDlg)); + DateTime lastRedraw; + DateTime lastSizeChange; + /// /// Public members /// @@ -48,16 +51,33 @@ namespace Results.Forms int lvHeight; + Timer timer; + + public BatchResultsDlg() { InitializeComponent(); Text = Strings.Results; + + lastSizeChange = DateTime.Now; + + // Create a timer with a ten second interval. + timer = new Timer(); + timer.Interval = 500; /// ms + timer.Tick += new EventHandler(OnTimer); + timer.Start(); } public void Display(Results.BatchResults results) { this.results = results; + + if (PopupResultsLeft != 0) Left = PopupResultsLeft; + if (PopupResultsTop != 0) Top = PopupResultsTop; + if (PopupResultsWidth != 0) Width = PopupResultsWidth; + if (PopupResultsHeight != 0) Height = PopupResultsHeight; + Redraw(); } @@ -67,15 +87,12 @@ namespace Results.Forms /// public void Redraw() { + lastRedraw = DateTime.Now; + this.SuspendLayout(); try { - if (PopupResultsLeft != 0) Left = PopupResultsLeft; - if (PopupResultsTop != 0) Top = PopupResultsTop; - if (PopupResultsWidth != 0) Width = PopupResultsWidth; - if (PopupResultsHeight != 0) Height = PopupResultsHeight; - /// Determine how many water meters were enabled for result evaluation and printing int enabledWMsCount = 0; for (int i = 0; i < results.WMPositionsCount; i++) @@ -353,13 +370,6 @@ namespace Results.Forms return lview; } - private void flowLayoutPanel_SizeChanged(object sender, EventArgs e) - { - PopupResultsWidth = Width; - PopupResultsHeight = Height; - Redraw(); - } - private void BatchResultsDlg_FormClosing(object sender, FormClosingEventArgs e) { PopupResultsLeft = Left; @@ -367,5 +377,25 @@ namespace Results.Forms PopupResultsWidth = Width; PopupResultsHeight = Height; } + + private void flowLayoutPanel_SizeChanged(object sender, EventArgs e) + { + lastSizeChange = DateTime.Now; + } + + private void OnTimer(object source, EventArgs e) + { + if (DateTime.Compare(lastSizeChange, lastRedraw) > 0) + { + /// The last size change was later then the last redraw + + DateTime now = DateTime.Now; + if (DateTime.Compare(lastSizeChange + new TimeSpan(0, 0, 1), now) < 0) + { + /// More then 1s since the last size change + Redraw(); + } + } + } } } diff --git a/Results/Properties/AssemblyInfo.cs b/Results/Properties/AssemblyInfo.cs index becfda56f..2760aaef6 100644 --- a/Results/Properties/AssemblyInfo.cs +++ b/Results/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.7.303.0")] -[assembly: AssemblyFileVersion("2.7.303.0")] +[assembly: AssemblyVersion("2.7.306.0")] +[assembly: AssemblyFileVersion("2.7.306.0")] diff --git a/TestBenchFramework/Properties/AssemblyInfo.cs b/TestBenchFramework/Properties/AssemblyInfo.cs index be0575045..bc59ba8f6 100644 --- a/TestBenchFramework/Properties/AssemblyInfo.cs +++ b/TestBenchFramework/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("2.7.305.1")] -[assembly: AssemblyFileVersion("2.7.305.1")] +[assembly: AssemblyVersion("2.7.306.1")] +[assembly: AssemblyFileVersion("2.7.306.1")]