From 9c27c8b4f860571b7510ae45295464cd3bd438a0 Mon Sep 17 00:00:00 2001 From: morkt Date: Sat, 7 Jan 2017 04:30:34 +0400 Subject: [PATCH] (LookupItem): moved timestamp update to InputData class. --- GUI/MainWindow.xaml.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/GUI/MainWindow.xaml.cs b/GUI/MainWindow.xaml.cs index 50eb736f..36d00471 100644 --- a/GUI/MainWindow.xaml.cs +++ b/GUI/MainWindow.xaml.cs @@ -628,6 +628,15 @@ namespace GARbro.GUI Phrase.Clear (); Mismatch = false; } + + public void Update (int timestamp) + { + if (timestamp - LastTime >= TextLookupTimeout) + { + Reset(); + } + LastTime = timestamp; + } } const int TextLookupTimeout = 1000; // milliseconds @@ -653,11 +662,7 @@ namespace GARbro.GUI if (source == null) return; - if (timestamp - m_current_input.LastTime > TextLookupTimeout) - { - m_current_input.Reset(); - } - m_current_input.LastTime = timestamp; + m_current_input.Update (timestamp); if (m_current_input.Mismatch) return;