SEBWIN-568: Implemented functionality to automatically reperform text search on browser navigation or reload.
This commit is contained in:
parent
930c07d193
commit
66445a117f
3 changed files with 25 additions and 4 deletions
|
@ -44,6 +44,7 @@ namespace SafeExamBrowser.Browser
|
|||
{
|
||||
internal class BrowserWindow : IApplicationWindow
|
||||
{
|
||||
private const string CLEAR_FIND_TERM = "thisisahacktoclearthesearchresultsasitappearsthatthereisnosuchfunctionalityincef";
|
||||
private const double ZOOM_FACTOR = 0.2;
|
||||
|
||||
private readonly AppConfig appConfig;
|
||||
|
@ -60,6 +61,7 @@ namespace SafeExamBrowser.Browser
|
|||
private readonly IText text;
|
||||
private readonly IUserInterfaceFactory uiFactory;
|
||||
|
||||
private (string term, bool isInitial, bool caseSensitive, bool forward) findParameters;
|
||||
private IBrowserWindow window;
|
||||
private double zoomLevel;
|
||||
|
||||
|
@ -278,6 +280,8 @@ namespace SafeExamBrowser.Browser
|
|||
window.UpdateTitle(address);
|
||||
TitleChanged?.Invoke(address);
|
||||
}
|
||||
|
||||
AutoFind();
|
||||
}
|
||||
|
||||
private void Control_LoadFailed(int errorCode, string errorText, bool isMainRequest, string url)
|
||||
|
@ -715,6 +719,11 @@ namespace SafeExamBrowser.Browser
|
|||
{
|
||||
if (settings.AllowFind)
|
||||
{
|
||||
findParameters.caseSensitive = caseSensitive;
|
||||
findParameters.forward = forward;
|
||||
findParameters.isInitial = isInitial;
|
||||
findParameters.term = term;
|
||||
|
||||
Control.Find(term, isInitial, caseSensitive, forward);
|
||||
}
|
||||
}
|
||||
|
@ -763,6 +772,14 @@ namespace SafeExamBrowser.Browser
|
|||
}
|
||||
}
|
||||
|
||||
private void AutoFind()
|
||||
{
|
||||
if (settings.AllowFind && !string.IsNullOrEmpty(findParameters.term) && !CLEAR_FIND_TERM.Equals(findParameters.term, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
Control.Find(findParameters.term, findParameters.isInitial, findParameters.caseSensitive, findParameters.forward);
|
||||
}
|
||||
}
|
||||
|
||||
private double CalculateZoomPercentage()
|
||||
{
|
||||
return (zoomLevel * 25.0) + 100.0;
|
||||
|
|
|
@ -33,6 +33,8 @@ namespace SafeExamBrowser.UserInterface.Desktop.Windows
|
|||
{
|
||||
internal partial class BrowserWindow : Window, IBrowserWindow
|
||||
{
|
||||
private const string CLEAR_FIND_TERM = "thisisahacktoclearthesearchresultsasitappearsthatthereisnosuchfunctionalityincef";
|
||||
|
||||
private readonly bool isMainWindow;
|
||||
private readonly BrowserSettings settings;
|
||||
private readonly IText text;
|
||||
|
@ -330,7 +332,7 @@ namespace SafeExamBrowser.UserInterface.Desktop.Windows
|
|||
|
||||
private void FindbarCloseButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
FindRequested?.Invoke("thisisahacktoclearthesearchresultsasitappearsthatthereisnosuchfunctionalityincef", true, false);
|
||||
FindRequested?.Invoke(CLEAR_FIND_TERM, true, false);
|
||||
Findbar.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
|
||||
|
@ -348,7 +350,7 @@ namespace SafeExamBrowser.UserInterface.Desktop.Windows
|
|||
{
|
||||
if (string.IsNullOrEmpty(FindTextBox.Text))
|
||||
{
|
||||
FindRequested?.Invoke("thisisahacktoclearthesearchresultsasitappearsthatthereisnosuchfunctionalityincef", true, false);
|
||||
FindRequested?.Invoke(CLEAR_FIND_TERM, true, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -32,6 +32,8 @@ namespace SafeExamBrowser.UserInterface.Mobile.Windows
|
|||
{
|
||||
internal partial class BrowserWindow : Window, IBrowserWindow
|
||||
{
|
||||
private const string CLEAR_FIND_TERM = "thisisahacktoclearthesearchresultsasitappearsthatthereisnosuchfunctionalityincef";
|
||||
|
||||
private readonly bool isMainWindow;
|
||||
private readonly ILogger logger;
|
||||
private readonly BrowserSettings settings;
|
||||
|
@ -234,7 +236,7 @@ namespace SafeExamBrowser.UserInterface.Mobile.Windows
|
|||
|
||||
private void FindbarCloseButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
FindRequested?.Invoke("thisisahacktoclearthesearchresultsasitappearsthatthereisnosuchfunctionalityincef", true, false);
|
||||
FindRequested?.Invoke(CLEAR_FIND_TERM, true, false);
|
||||
Findbar.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
|
||||
|
@ -252,7 +254,7 @@ namespace SafeExamBrowser.UserInterface.Mobile.Windows
|
|||
{
|
||||
if (string.IsNullOrEmpty(FindTextBox.Text))
|
||||
{
|
||||
FindRequested?.Invoke("thisisahacktoclearthesearchresultsasitappearsthatthereisnosuchfunctionalityincef", true, false);
|
||||
FindRequested?.Invoke(CLEAR_FIND_TERM, true, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue