Previous results display after changing the window size uses a timer, ver.2.7.306

This commit is contained in:
Milan Hanajik 2016-06-13 11:08:32 +02:00
parent cbf6b286db
commit e6d38040e0
3 changed files with 46 additions and 16 deletions

View File

@ -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
/// </summary>
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();
}
}
}
}
}

View File

@ -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")]

View File

@ -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")]