Skip to content

Commit

Permalink
Add ShowDevToolsCommand
Browse files Browse the repository at this point in the history
  • Loading branch information
Mzying2001 committed May 16, 2024
1 parent 5a9d98b commit 0caba46
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
14 changes: 14 additions & 0 deletions CefFlashBrowser.FlashBrowser/ChromiumWebBrowserEx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,32 @@ public override bool OnPreKeyEvent(IWebBrowser chromiumWebBrowser, IBrowser brow

public ICommand LoadUrlCommand { get; }
public ICommand CloseBrowserCommand { get; }
public ICommand ShowDevToolsCommand { get; }
public ICommand CloseDevToolsCommand { get; }

public ChromiumWebBrowserEx()
{
FocusHandler = new WpfFocusHandler();
KeyboardHandler = new WpfKeyboardHandler();
LoadUrlCommand = new DelegateCommand<string>(Load);
CloseBrowserCommand = new DelegateCommand<bool>(CloseBrowser);
ShowDevToolsCommand = new DelegateCommand(ShowDevTools);
CloseDevToolsCommand = new DelegateCommand(CloseDevTools);
}

public void CloseBrowser(bool forceClose)
{
GetBrowser().CloseBrowser(forceClose);
}

public void ShowDevTools()
{
GetBrowser().ShowDevTools();
}

public void CloseDevTools()
{
GetBrowser().CloseDevTools();
}
}
}
5 changes: 3 additions & 2 deletions CefFlashBrowser/Views/BrowserWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@
</ContextMenu>
</Window.Resources>


<Window.InputBindings>
<KeyBinding Key="Esc"
Command="{Binding ElementName=browser, Path=StopCommand}"/>
Expand All @@ -190,8 +191,7 @@
<KeyBinding Key="F11"
Command="{Binding ElementName=window, Path=ToggleFullScreenCommand}"/>
<KeyBinding Key="F12"
Command="{Binding ShowDevToolsCommand}"
CommandParameter="{Binding ElementName=browser}"/>
Command="{Binding ElementName=browser, Path=ShowDevToolsCommand}"/>
<KeyBinding Gesture="Ctrl+OemPlus"
Command="{Binding ElementName=browser, Path=ZoomInCommand}"/>
<KeyBinding Gesture="Ctrl+OemMinus"
Expand Down Expand Up @@ -223,6 +223,7 @@
Command="{Binding ElementName=browser, Path=ForwardCommand}"/>
</Window.InputBindings>


<Grid x:Name="mainGrid">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
Expand Down

0 comments on commit 0caba46

Please sign in to comment.