Fix toggle sidebar keybinding and disable content panel when laoding

This commit is contained in:
Stone_Red
2024-04-04 21:31:17 +02:00
parent bb78a4a067
commit e8d8745a2b
2 changed files with 9 additions and 3 deletions
@@ -188,6 +188,12 @@ public partial class MainWindowViewModel : ViewModelBase
private void FetchUrl() private void FetchUrl()
{ {
if (IsBusy)
{
WindowNotificationManager.Show(new Notification("Busy", "The browser is currently busy.", NotificationType.Warning));
return;
}
if (string.IsNullOrWhiteSpace(Url)) if (string.IsNullOrWhiteSpace(Url))
{ {
Content = DefaultContent; Content = DefaultContent;
+3 -3
View File
@@ -38,7 +38,7 @@
<KeyBinding Gesture="Alt+Right" Command="{Binding Forward}" /> <KeyBinding Gesture="Alt+Right" Command="{Binding Forward}" />
<KeyBinding Gesture="Ctrl+T" Command="{Binding NewTab}" /> <KeyBinding Gesture="Ctrl+T" Command="{Binding NewTab}" />
<KeyBinding Gesture="Ctrl+W" Command="{Binding CloseTab}" /> <KeyBinding Gesture="Ctrl+W" Command="{Binding CloseTab}" />
<KeyBinding Gesture="Alt+S" Command="{Binding ShowSidePanel}" /> <KeyBinding Gesture="Alt+S" Command="{Binding ToggleSidePanel}" />
</Window.KeyBindings> </Window.KeyBindings>
<Grid RowDefinitions="Auto, *, Auto"> <Grid RowDefinitions="Auto, *, Auto">
@@ -78,14 +78,14 @@
</Grid> </Grid>
<Border Grid.Row="2" BorderThickness="0 2 0 0" CornerRadius="0" BorderBrush="{DynamicResource SemiColorTertiary}"> <Border Grid.Row="2" BorderThickness="0 2 0 0" CornerRadius="0" BorderBrush="{DynamicResource SemiColorTertiary}">
<Grid ColumnDefinitions="Auto, Auto, Auto, Auto, *, Auto"> <Grid IsEnabled="{Binding !IsBusy}" ColumnDefinitions="Auto, Auto, Auto, Auto, *, Auto">
<Button Grid.Column="0" i:Attached.Icon="fa-solid fa-caret-left" IsEnabled="{Binding BackEnabled}" Command="{Binding Back}" /> <Button Grid.Column="0" i:Attached.Icon="fa-solid fa-caret-left" IsEnabled="{Binding BackEnabled}" Command="{Binding Back}" />
<Button Grid.Column="1" i:Attached.Icon="fa-solid fa-caret-right" IsEnabled="{Binding ForwardEnabled}" Command="{Binding Forward}" /> <Button Grid.Column="1" i:Attached.Icon="fa-solid fa-caret-right" IsEnabled="{Binding ForwardEnabled}" Command="{Binding Forward}" />
<Button Grid.Column="2" i:Attached.Icon="fa-solid fa-rotate-right" Command="{Binding Browse}" /> <Button Grid.Column="2" i:Attached.Icon="fa-solid fa-rotate-right" Command="{Binding Browse}" />
<Button Grid.Column="3" i:Attached.Icon="fa-solid fa-house" Command="{StaticResource HomeCommand}" /> <Button Grid.Column="3" i:Attached.Icon="fa-solid fa-house" Command="{StaticResource HomeCommand}" />
<Grid Grid.Column="4"> <Grid Grid.Column="4">
<TextBox x:Name="urlBar" IsVisible="{Binding !IsBusy}" Watermark="Search DuckDuckGo or type a URL" Text="{Binding Url}" BorderThickness="0"> <TextBox IsVisible="{Binding !IsBusy}" Watermark="Search DuckDuckGo or type a URL" Text="{Binding Url}" BorderThickness="0">
<TextBox.KeyBindings> <TextBox.KeyBindings>
<KeyBinding Gesture="Enter" Command="{Binding Browse}" /> <KeyBinding Gesture="Enter" Command="{Binding Browse}" />
</TextBox.KeyBindings> </TextBox.KeyBindings>