<commit_before>﻿<UserControl x:Class="CefSharp.Wpf.Example.Views.BrowserTabView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:cefSharp="clr-namespace:CefSharp.Wpf;assembly=CefSharp.Wpf" xmlns:local="clr-namespace:CefSharp.Wpf.Example.ViewModels"
             mc:Ignorable="d"
             d:DesignWidth="640"
             d:DesignHeight="480"
             d:DataContext="{d:DesignInstance local:BrowserTabViewModel}">
    <UserControl.Resources>
        <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
    </UserControl.Resources>
    <Grid>
        <DockPanel>
            <DockPanel VerticalAlignment="Top"
                       DockPanel.Dock="Top">
                <Button Height="23"
                        Width="75"
                        Command="{Binding HomeCommand}">Home</Button>
                <Button Height="23"
                        Width="75"
                        Command="{Binding WebBrowser.BackCommand}">Back</Button>
                <Button Height="23"
                        Width="75"
                        Command="{Binding WebBrowser.ForwardCommand}">Forward</Button>
                <Button Height="23"
                        Width="75"
                        Command="{Binding WebBrowser.ReloadCommand}">Reload</Button>
                <Button Height="23"
                        Name="goStopButton"
                        Width="75"
                        DockPanel.Dock="Right"
                        Command="{Binding GoCommand}">Go</Button>
                <TextBox Height="23"
                         Text="{Binding AddressEditable, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                         GotKeyboardFocus="OnTextBoxGotKeyboardFocus"
                         GotMouseCapture="OnTextBoxGotMouseCapture">
                    <TextBox.InputBindings>
                        <KeyBinding Key="Enter"
                                    Command="{Binding GoCommand}" />
                    </TextBox.InputBindings>
                </TextBox>
            </DockPanel>
            <StackPanel DockPanel.Dock="Right"
                        Margin="6,3"
                        Visibility="{Binding ShowSidebar, Converter={StaticResource BooleanToVisibilityConverter}}">
                <GroupBox Header="Tweak WPF Rendering">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>
                        <Label Grid.Row="0"
                               Grid.Column="0"
                               Content="Angle:" />
                        <Slider Grid.Row="0"
                                Grid.Column="1"
                                Name="angleSlider"
                                Minimum="-180"
                                Maximum="180" />
                        <Label Grid.Row="1"
                               Grid.Column="0"
                               Content="Watermark Opacity:" />
                        <Slider Grid.Row="1"
                                Grid.Column="1"
                                Name="opacitySlider"
                                Minimum="0"
                                Maximum="1"
                                TickFrequency="0.01"
                                Value="0.95" />
                    </Grid>
                </GroupBox>
                <GroupBox Header="Execute Javascript (asynchronously)">
                    <Grid Width="300">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="75" />
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>
                        <TextBox x:Name="ExecuteJavascriptTextBox"
                                 Grid.Row="0"
                                 AcceptsReturn="True"
                                 Margin="6"
                                 Text="$('#modify-me').text('See how easy that was?')">
                            <TextBox.InputBindings>
                                <KeyBinding Key="Enter"
                                            Modifiers="Control"
                                            Command="{Binding ExecuteJavaScriptCommand}"
                                            CommandParameter="{Binding Text, RelativeSource={RelativeSource AncestorType=TextBox}}" />
                            </TextBox.InputBindings>
                        </TextBox>
                        <Button Grid.Row="1"
                                HorizontalAlignment="Left"
                                Margin="6,0,6,6"
                                Padding="5,2"
                                Content="Run"
                                Command="{Binding ExecuteJavaScriptCommand}"
                                CommandParameter="{Binding Text, ElementName=ExecuteJavascriptTextBox}" />
                    </Grid>
                </GroupBox>
                <GroupBox Header="Execute Javascript (synchronously)">
                    <Grid Width="300">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="75" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>
                        <TextBox x:Name="EvaluateJavascriptTextBox"
                                 Grid.Row="0"
                                 Margin="6"
                                 AcceptsReturn="True"
                                 Text="bound.myProperty = 0">
                            <TextBox.InputBindings>
                                <KeyBinding Key="Enter"
                                            Modifiers="Control"
                                            Command="{Binding EvaluateJavaScriptCommand}"
                                            CommandParameter="{Binding Text, RelativeSource={RelativeSource AncestorType=TextBox}}" />
                            </TextBox.InputBindings>
                        </TextBox>
                        <Button Grid.Row="1"
                                HorizontalAlignment="Left"
                                Margin="6,0"
                                Padding="5,2"
                                Content="Run"
                                Command="{Binding EvaluateJavaScriptCommand}"
                                CommandParameter="{Binding Text, ElementName=EvaluateJavascriptTextBox}" />
                        <TextBlock Grid.Row="2"
                                   Margin="6">Result:</TextBlock><commit_msg>Update execute script example to be more complex<commit_after>﻿<UserControl x:Class="CefSharp.Wpf.Example.Views.BrowserTabView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:cefSharp="clr-namespace:CefSharp.Wpf;assembly=CefSharp.Wpf" xmlns:local="clr-namespace:CefSharp.Wpf.Example.ViewModels"
             mc:Ignorable="d"
             d:DesignWidth="640"
             d:DesignHeight="480"
             d:DataContext="{d:DesignInstance local:BrowserTabViewModel}">
    <UserControl.Resources>
        <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
    </UserControl.Resources>
    <Grid>
        <DockPanel>
            <DockPanel VerticalAlignment="Top"
                       DockPanel.Dock="Top">
                <Button Height="23"
                        Width="75"
                        Command="{Binding HomeCommand}">Home</Button>
                <Button Height="23"
                        Width="75"
                        Command="{Binding WebBrowser.BackCommand}">Back</Button>
                <Button Height="23"
                        Width="75"
                        Command="{Binding WebBrowser.ForwardCommand}">Forward</Button>
                <Button Height="23"
                        Width="75"
                        Command="{Binding WebBrowser.ReloadCommand}">Reload</Button>
                <Button Height="23"
                        Name="goStopButton"
                        Width="75"
                        DockPanel.Dock="Right"
                        Command="{Binding GoCommand}">Go</Button>
                <TextBox Height="23"
                         Text="{Binding AddressEditable, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                         GotKeyboardFocus="OnTextBoxGotKeyboardFocus"
                         GotMouseCapture="OnTextBoxGotMouseCapture">
                    <TextBox.InputBindings>
                        <KeyBinding Key="Enter"
                                    Command="{Binding GoCommand}" />
                    </TextBox.InputBindings>
                </TextBox>
            </DockPanel>
            <StackPanel DockPanel.Dock="Right"
                        Margin="6,3"
                        Visibility="{Binding ShowSidebar, Converter={StaticResource BooleanToVisibilityConverter}}">
                <GroupBox Header="Tweak WPF Rendering">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>
                        <Label Grid.Row="0"
                               Grid.Column="0"
                               Content="Angle:" />
                        <Slider Grid.Row="0"
                                Grid.Column="1"
                                Name="angleSlider"
                                Minimum="-180"
                                Maximum="180" />
                        <Label Grid.Row="1"
                               Grid.Column="0"
                               Content="Watermark Opacity:" />
                        <Slider Grid.Row="1"
                                Grid.Column="1"
                                Name="opacitySlider"
                                Minimum="0"
                                Maximum="1"
                                TickFrequency="0.01"
                                Value="0.95" />
                    </Grid>
                </GroupBox>
                <GroupBox Header="Execute Javascript (asynchronously)">
                    <Grid Width="300">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="75" />
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>
                        <TextBox x:Name="ExecuteJavascriptTextBox"
                                 Grid.Row="0"
                                 AcceptsReturn="True"
                                 Margin="6"
                                 Text="$('#modify-me').text('See how easy that was?')">
                            <TextBox.InputBindings>
                                <KeyBinding Key="Enter"
                                            Modifiers="Control"
                                            Command="{Binding ExecuteJavaScriptCommand}"
                                            CommandParameter="{Binding Text, RelativeSource={RelativeSource AncestorType=TextBox}}" />
                            </TextBox.InputBindings>
                        </TextBox>
                        <Button Grid.Row="1"
                                HorizontalAlignment="Left"
                                Margin="6,0,6,6"
                                Padding="5,2"
                                Content="Run"
                                Command="{Binding ExecuteJavaScriptCommand}"
                                CommandParameter="{Binding Text, ElementName=ExecuteJavascriptTextBox}" />
                    </Grid>
                </GroupBox>
                <GroupBox Header="Execute Javascript (synchronously)">
                    <Grid Width="300">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="75" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>
                        <TextBox x:Name="EvaluateJavascriptTextBox"
                                 Grid.Row="0"
                                 Margin="6"
                                 AcceptsReturn="True"
                                 Text="bound.subObject.simpleProperty = (bound.myProperty++).toString();">
                            <TextBox.InputBindings>
                                <KeyBinding Key="Enter"
                                            Modifiers="Control"
                                            Command="{Binding EvaluateJavaScriptCommand}"
                                            CommandParameter="{Binding Text, RelativeSource={RelativeSource AncestorType=TextBox}}" />
                            </TextBox.InputBindings>
                        </TextBox>
                        <Button Grid.Row="1"
                                HorizontalAlignment="Left"
                                Margin="6,0"
                                Padding="5,2"
                                Content="Run"
                                Command="{Binding EvaluateJavaScriptCommand}"
                                CommandParameter="{Binding Text, ElementName=EvaluateJavascriptTextBox}" />
                        <TextBlock Grid.Row="2"
                                   Margin="6">Result:</TextBlock>
{'fraction_non_alphanumeric': 0.0949986409350367, 'fraction_numerical': 0.013114976895895624, 'mean_word_length': 1.005860706010631, 'pattern_counts': {'":': 0, '<': 143, '<?xml version=': 0, '>': 143, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 14}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 44, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5517773', 'n_tokens_mistral': 3345, 'n_tokens_neox': 2919, 'n_words': 426}