private void urlTextbox_KeyDown(object sender, KeyEventArgs e) { // ReSharper disable once SwitchStatementMissingSomeCases switch (e.Key) { case Key.Return: { MainBrowser.Stop(); var result = ValidHttpUrl(urlTextbox.Text, out var uriResult); if (!result) { MainBrowser.Address = "https://google.com/search?q=" + urlTextbox.Text; } else { MainBrowser.Address = uriResult?.AbsoluteUri; } MainBrowser.Focus(); break; } case Key.Escape: MainBrowser.Focus(); break; } }