Made address bar of browser window react on enter key.
This commit is contained in:
parent
5c365f02b0
commit
7c3fddd060
2 changed files with 12 additions and 14 deletions
|
@ -18,7 +18,7 @@
|
||||||
<ColumnDefinition Width="Auto" />
|
<ColumnDefinition Width="Auto" />
|
||||||
<ColumnDefinition Width="Auto" />
|
<ColumnDefinition Width="Auto" />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<TextBox Grid.Column="0" x:Name="UrlTextBox" Margin="5,5,2.5,5" Height="20" HorizontalAlignment="Stretch" VerticalAlignment="Center" />
|
<TextBox Grid.Column="0" x:Name="UrlTextBox" Margin="5,5,2.5,5" Height="20" HorizontalAlignment="Stretch" VerticalContentAlignment="Center" />
|
||||||
<Button Grid.Column="1" x:Name="ReloadButton" Margin="2.5,5,2.5,5" HorizontalAlignment="Center" VerticalAlignment="Center">Reload</Button>
|
<Button Grid.Column="1" x:Name="ReloadButton" Margin="2.5,5,2.5,5" HorizontalAlignment="Center" VerticalAlignment="Center">Reload</Button>
|
||||||
<Button Grid.Column="2" x:Name="BackButton" Margin="2.5,5,2.5,5" HorizontalAlignment="Center" VerticalAlignment="Center">Back</Button>
|
<Button Grid.Column="2" x:Name="BackButton" Margin="2.5,5,2.5,5" HorizontalAlignment="Center" VerticalAlignment="Center">Back</Button>
|
||||||
<Button Grid.Column="3" x:Name="ForwardButton" Margin="2.5,5,5,5" HorizontalAlignment="Center" VerticalAlignment="Center">Forward</Button>
|
<Button Grid.Column="3" x:Name="ForwardButton" Margin="2.5,5,5,5" HorizontalAlignment="Center" VerticalAlignment="Center">Forward</Button>
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Input;
|
||||||
using SafeExamBrowser.Contracts.Configuration.Settings;
|
using SafeExamBrowser.Contracts.Configuration.Settings;
|
||||||
using SafeExamBrowser.Contracts.UserInterface;
|
using SafeExamBrowser.Contracts.UserInterface;
|
||||||
|
|
||||||
|
@ -63,12 +63,7 @@ namespace SafeExamBrowser.UserInterface
|
||||||
|
|
||||||
public void UpdateAddress(string url)
|
public void UpdateAddress(string url)
|
||||||
{
|
{
|
||||||
Dispatcher.Invoke(() =>
|
Dispatcher.Invoke(() => UrlTextBox.Text = url);
|
||||||
{
|
|
||||||
UrlTextBox.TextChanged -= UrlTextBox_TextChanged;
|
|
||||||
UrlTextBox.Text = url;
|
|
||||||
UrlTextBox.TextChanged += UrlTextBox_TextChanged;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateTitle(string title)
|
public void UpdateTitle(string title)
|
||||||
|
@ -76,11 +71,6 @@ namespace SafeExamBrowser.UserInterface
|
||||||
Dispatcher.Invoke(() => Title = title);
|
Dispatcher.Invoke(() => Title = title);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UrlTextBox_TextChanged(object sender, TextChangedEventArgs e)
|
|
||||||
{
|
|
||||||
AddressChanged?.Invoke(UrlTextBox.Text);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void InitializeBrowserWindow(IBrowserControl browserControl)
|
private void InitializeBrowserWindow(IBrowserControl browserControl)
|
||||||
{
|
{
|
||||||
if (browserControl is System.Windows.Forms.Control)
|
if (browserControl is System.Windows.Forms.Control)
|
||||||
|
@ -89,7 +79,7 @@ namespace SafeExamBrowser.UserInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
Closing += (o, args) => closing?.Invoke();
|
Closing += (o, args) => closing?.Invoke();
|
||||||
UrlTextBox.TextChanged += UrlTextBox_TextChanged;
|
UrlTextBox.KeyUp += UrlTextBox_KeyUp;
|
||||||
ReloadButton.Click += (o, args) => ReloadRequested?.Invoke();
|
ReloadButton.Click += (o, args) => ReloadRequested?.Invoke();
|
||||||
BackButton.Click += (o, args) => BackwardNavigationRequested?.Invoke();
|
BackButton.Click += (o, args) => BackwardNavigationRequested?.Invoke();
|
||||||
ForwardButton.Click += (o, args) => ForwardNavigationRequested?.Invoke();
|
ForwardButton.Click += (o, args) => ForwardNavigationRequested?.Invoke();
|
||||||
|
@ -97,6 +87,14 @@ namespace SafeExamBrowser.UserInterface
|
||||||
ApplySettings();
|
ApplySettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void UrlTextBox_KeyUp(object sender, KeyEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Key == Key.Enter)
|
||||||
|
{
|
||||||
|
AddressChanged?.Invoke(UrlTextBox.Text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void ApplySettings()
|
private void ApplySettings()
|
||||||
{
|
{
|
||||||
if (IsMainWindow && settings.FullScreenMode)
|
if (IsMainWindow && settings.FullScreenMode)
|
||||||
|
|
Loading…
Reference in a new issue