<commit_before>﻿<controls:WindowBase x:Class="Playnite.DesktopApp.Windows.EmulatedGameImportWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
        xmlns:prism="clr-namespace:Prism.Interactivity;assembly=Prism.Wpf"
        xmlns:p="clr-namespace:Playnite;assembly=Playnite"
        xmlns:pcon="clr-namespace:Playnite.Converters;assembly=Playnite"
        xmlns:controls="clr-namespace:Playnite.Controls;assembly=Playnite"
        xmlns:dctrls="clr-namespace:Playnite.DesktopApp.Controls"
        xmlns:pvm="clr-namespace:Playnite.DesktopApp.ViewModels"
        xmlns:pm="clr-namespace:Playnite.SDK.Models;assembly=Playnite.SDK"
        xmlns:pbeh="clr-namespace:Playnite.Behaviors;assembly=Playnite"       
        xmlns:pcmd="clr-namespace:Playnite.Commands;assembly=Playnite"     
        xmlns:sys="clr-namespace:System;assembly=mscorlib"
        mc:Ignorable="d"
        d:DesignStyle="{StaticResource WindowDesignStyle}"
        Style="{DynamicResource StandardWindowStyle}"
        Title="" WindowStartupLocation="CenterOwner"
        Height="600" Width="800" x:Name="WindowEmulatorImport"
        AutomationProperties.AutomationId="WindowEmulatorImport">

    <controls:WindowBase.Resources>
        <Style TargetType="TextBlock" BasedOn="{StaticResource BaseTextBlockStyle}" />
    </controls:WindowBase.Resources>

    <Grid>
        <Grid.Resources>
            <p:BindingProxy x:Key="BindingProxy" Data="{Binding}" />
        </Grid.Resources>

        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>

        <TextBlock Grid.Row="0" TextWrapping="Wrap" Margin="10,5,10,5"
                   Visibility="{Binding IsScanSetup, Converter={StaticResource BooleanToVisibilityConverter}}"
                   Text="{DynamicResource LOCEmuImportDirectoryConfigDesc}" />

        <controls:ExtendedDataGrid Grid.Row="1" Margin="10,5,10,0"
                  Visibility="{Binding IsScanSetup, Converter={StaticResource InvertedBooleanToVisibilityConverter}}"
                  CanUserAddRows="False" AutoGenerateColumns="False" CanUserResizeRows="False" GridLinesVisibility="None"                  
                  ItemsSource="{Binding CollectionView}" SelectedItemsList="{Binding SelectedGames, Mode=TwoWay}">
            <i:Interaction.Triggers>
                <i:EventTrigger EventName="ContextMenuOpening" >
                    <prism:InvokeCommandAction Command="{Binding Data.ContextMenuOpening, Source={StaticResource BindingProxy}}" />
                </i:EventTrigger>
            </i:Interaction.Triggers>
            <DataGrid.ContextMenu>
                <ContextMenu ItemsSource="{Binding Data.MenuItems, Source={StaticResource BindingProxy}}">  
                    <ContextMenu.ItemContainerStyle>
                        <Style TargetType="MenuItem">
                            <Setter Property="Command" Value="{Binding Command}" />
                            <Setter Property="ItemsSource" Value="{Binding Items}" />
                        </Style>
                    </ContextMenu.ItemContainerStyle>
                </ContextMenu>
            </DataGrid.ContextMenu>
            <DataGrid.Columns>
                <DataGridTemplateColumn Header="{DynamicResource LOCImportLabel}">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <CheckBox IsChecked="{Binding Import, UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Center" />
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
                <DataGridTemplateColumn Header="{DynamicResource LOCNameLabel}" SortMemberPath="Name" MinWidth="300">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <TextBox Text="{Binding Name, UpdateSourceTrigger=PropertyChanged}"
                                     Background="{StaticResource NormalBrushDark}"/>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
                <DataGridTemplateColumn Header="{DynamicResource LOCPlatformTitle}" Width="200">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <dctrls:ComboBoxList Background="{StaticResource NormalBrushDark}"
                                                 SelectedItems="{Binding Platforms, UpdateSourceTrigger=PropertyChanged}"
                                                 ItemsSource="{Binding Data.Platforms, Source={StaticResource BindingProxy}}"/>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
                <DataGridTemplateColumn Header="{DynamicResource LOCRegionLabel}" Width="200">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <dctrls:ComboBoxList Background="{StaticResource NormalBrushDark}"
                                                 SelectedItems="{Binding Regions, UpdateSourceTrigger=PropertyChanged}"
                                                 ItemsSource="{Binding Data.Regions, Source={StaticResource BindingProxy}}"/>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
            </DataGrid.Columns>
            <DataGrid.RowDetailsTemplate>
                <DataTemplate>
                    <ListView ItemsSource="{Binding Roms}" BorderThickness="0" Margin="8">
                        <ListView.ContextMenu>
                            <ContextMenu Visibility="Collapsed" />
                        </ListView.ContextMenu>
                        <ListView.ItemContainerStyle>
                            <Style TargetType="ListViewItem" BasedOn="{StaticResource {x:Type ListViewItem}}">
                                <Setter Property="Focusable" Value="false"/>
                            </Style>
                        </ListView.ItemContainerStyle>
                        <ListView.View>
                            <GridView>
                                <GridViewColumn>
                                    <GridViewColumn.CellTemplate>
                                        <DataTemplate>
                                            <CheckBox IsChecked="{Binding Import}" VerticalAlignment="Center" HorizontalAlignment="Center" />
                                        </DataTemplate>
                                    </GridViewColumn.CellTemplate>
                                </GridViewColumn>
                                <GridViewColumn Header="{DynamicResource LOCNameLabel}" Width="Auto" DisplayMemberBinding="{Binding Name.DiscName}" />
                                <GridViewColumn Header="{DynamicResource LOCPathLabel}" Width="Auto" DisplayMemberBinding="{Binding Path}" />
                                <GridViewColumn Header="db" 
                                                Width="{Binding Path=(p:PlayniteEnvironment.IsDebugBuild), Converter={StaticResource BoolToAutoWidthConverter}}">
                                    <GridViewColumn.CellTemplate>
                                        <DataTemplate>
                                            <TextBox IsReadOnly="True" Text="{Binding DbData, Mode=OneWay}" />
                                        </DataTemplate>
                                    </GridViewColumn.CellTemplate>
                                </GridViewColumn>
                            </GridView>
                        </ListView.View>
                    </ListView>
                </DataTemplate>
            </DataGrid.RowDetailsTemplate>
        </controls:ExtendedDataGrid>

        <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto"
                      Grid.Row="1" Visibility="{Binding IsScanSetup, Converter={StaticResource BooleanToVisibilityConverter}}"
                      Margin="5,5,5,0">
            <ItemsControl ItemsSource="{Binding ScannerConfigs}">
                <ItemsControl.ItemTemplate>
                    <DataTemplate>
                        <Border Margin="5" DockPanel.Dock="Top" BorderThickness="1" 
                                BorderBrush="{DynamicResource NormalBorderBrush}" CornerRadius="{DynamicResource ControlCornerRadius}">
                            <StackPanel Margin="10">
                                <StackPanel.Resources>
                                    <Style TargetType="TextBlock" BasedOn="{StaticResource BaseTextBlockStyle}" />
                                </StackPanel.Resources>
                                <StackPanel Orientation="Horizontal">
                                    <TextBlock Text="{DynamicResource LOCEmuScanEmulator}" VerticalAlignment="Center" />
                                    <ComboBox Width="150" Margin="10,0,10,0" Name="ComboEmulatorList"
                                                ItemsSource="{Binding Data.Emulators, Source={StaticResource BindingProxy}}"
                                                DisplayMemberPath="Name" SelectedValuePath="Id" SelectedValue="{Binding EmulatorId}" />
                                    <TextBlock Text="{DynamicResource LOCProfileLabel}" VerticalAlignment="Center" />
                                    <ComboBox Width="150" Margin="10,0,10,0"
                                                ItemsSource="{Binding SelectedItem.AllProfiles, ElementName=ComboEmulatorList}"
                                                DisplayMemberPath="Name" SelectedValuePath="Id" SelectedValue="{Binding EmulatorProfileId}" />
                                </StackPanel>
                                <DockPanel Margin="0,10,0,10">
                                    <TextBlock Text="{DynamicResource LOCEmuScanDirectory}" VerticalAlignment="Center" />
                                    <TextBox pbeh:TextBoxBehavior.AttachDirectoryBrowser="True" Margin="10,0,10,0"
                                                Text="{Binding Directory, UpdateSourceTrigger=PropertyChanged}"/>
                                </DockPanel>
                                <CheckBox Content="{DynamicResource LOCEmuSaveScanConfig}"
                                          IsChecked="{Binding Save}"
                                          Visibility="{Binding Id, Converter={StaticResource InvertedObjectEqualityToVisibilityConverter}, ConverterParameter={x:Static sys:Guid.Empty}}"/>
                                <Button Content="{DynamicResource LOCRemoveLabel}" Margin="0,10,0,0" HorizontalAlignment="Left"
                                        Command="{Binding Data.RemoveScanConfigCommand, Source={StaticResource BindingProxy}}"
                                        CommandParameter="{Binding}" />
                            </StackPanel>
                        </Border>
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
            </ItemsControl>
        </ScrollViewer>

        <StackPanel Grid.Row="2" Orientation="Horizontal" Margin="10,10,10,10">
            <Button Content="{DynamicResource LOCEmuAddScanner}"
                    Command="{Binding AddScanConfigCommand}" 
                    Visibility="{Binding IsScanSetup, Converter={StaticResource BooleanToVisibilityConverter}}"/>
            <Button Content="{DynamicResource LOCEmuAddSavedScanner}" Margin="10,0,0,0"
                    Command="{Binding AddScanConfigCommand}" 
                    Visibility="{Binding IsScanSetup, Converter={StaticResource BooleanToVisibilityConverter}}"
                    pbeh:LeftClickContextMenuBehavior.Enabled="True">
                <Button.ContextMenu>
                    <ContextMenu ItemsSource="{Binding SavedConfigs}" Placement="Top">
                        <ContextMenu.ItemContainerStyle>
                            <Style TargetType="MenuItem">
                                <Setter Property="Command" Value="{Binding Data.AddSavedScanConfigCommand, Source={StaticResource BindingProxy}}" />
                                <Setter Property="CommandParameter" Value="{Binding}" />
                            </Style>
                        </ContextMenu.ItemContainerStyle>
                    </ContextMenu>
                </Button.ContextMenu>
            </Button>
            <Button Content="{DynamicResource LOCSelectAll}" Margin="0,0,10,0"
                    Command="{Binding SelectAllCommmand}"
                    Visibility="{Binding IsScanSetup, Converter={StaticResource InvertedBooleanToVisibilityConverter}}" />
            <Button Content="{DynamicResource LOCDeselectAll}"
                    Command="{Binding DeselectAllCommmand}"
                    Visibility="{Binding IsScanSetup, Converter={StaticResource InvertedBooleanToVisibilityConverter}}" />
        </StackPanel>

        <Border Grid.Row="3" BorderThickness="0,1,0,0" BorderBrush="{StaticResource NormalBorderBrush}">
            <DockPanel LastChildFill="False" Margin="5">
                <Button Content="{DynamicResource LOCCloseLabel}" DockPanel.Dock="Right" IsCancel="True"
                        Command="{Binding CancelCommand}" 
                        Style="{StaticResource BottomButton}" />
                <Button Content="{DynamicResource LOCImportLabel}" DockPanel.Dock="Right"
                        Command="{Binding ImportCommand}"
                        Style="{StaticResource BottomButton}"
                        Visibility="{Binding IsScanSetup, Converter={StaticResource InvertedBooleanToVisibilityConverter}}"/>
                <Button Content="{DynamicResource LOCStartScan}" DockPanel.Dock="Right"
                        Command="{Binding ScanCommmand}"
                        Style="{StaticResource BottomButton}"
                        Visibility="{Binding IsScanSetup, Converter={StaticResource BooleanToVisibilityConverter}}"/>
                <Button Content="{DynamicResource LOCMenuHelpTitle}"
                        Command="{x:Static pcmd:GlobalCommands.NavigateUrlCommand}"
                        CommandParameter="https://github.com/JosefNemec/Playnite/wiki/Adding-new-emulator"                        
                        DockPanel.Dock="Left" Style="{StaticResource BottomButton}"/>
            </DockPanel>
        </Border>
    </Grid>
</controls:WindowBase>
<commit_msg>Better row selection on emulated game import dialog<commit_after>﻿<controls:WindowBase x:Class="Playnite.DesktopApp.Windows.EmulatedGameImportWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
        xmlns:prism="clr-namespace:Prism.Interactivity;assembly=Prism.Wpf"
        xmlns:p="clr-namespace:Playnite;assembly=Playnite"
        xmlns:pcon="clr-namespace:Playnite.Converters;assembly=Playnite"
        xmlns:controls="clr-namespace:Playnite.Controls;assembly=Playnite"
        xmlns:dctrls="clr-namespace:Playnite.DesktopApp.Controls"
        xmlns:pvm="clr-namespace:Playnite.DesktopApp.ViewModels"
        xmlns:pm="clr-namespace:Playnite.SDK.Models;assembly=Playnite.SDK"
        xmlns:pbeh="clr-namespace:Playnite.Behaviors;assembly=Playnite"       
        xmlns:pcmd="clr-namespace:Playnite.Commands;assembly=Playnite"     
        xmlns:sys="clr-namespace:System;assembly=mscorlib"
        mc:Ignorable="d"
        d:DesignStyle="{StaticResource WindowDesignStyle}"
        Style="{DynamicResource StandardWindowStyle}"
        Title="" WindowStartupLocation="CenterOwner"
        Height="600" Width="800" x:Name="WindowEmulatorImport"
        AutomationProperties.AutomationId="WindowEmulatorImport">

    <controls:WindowBase.Resources>
        <Style TargetType="TextBlock" BasedOn="{StaticResource BaseTextBlockStyle}" />
    </controls:WindowBase.Resources>

    <Grid>
        <Grid.Resources>
            <p:BindingProxy x:Key="BindingProxy" Data="{Binding}" />
        </Grid.Resources>

        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>

        <TextBlock Grid.Row="0" TextWrapping="Wrap" Margin="10,5,10,5"
                   Visibility="{Binding IsScanSetup, Converter={StaticResource BooleanToVisibilityConverter}}"
                   Text="{DynamicResource LOCEmuImportDirectoryConfigDesc}" />

        <controls:ExtendedDataGrid Grid.Row="1" Margin="10,5,10,0"
                  Visibility="{Binding IsScanSetup, Converter={StaticResource InvertedBooleanToVisibilityConverter}}"
                  CanUserAddRows="False" AutoGenerateColumns="False" CanUserResizeRows="False" GridLinesVisibility="None"
                  ItemsSource="{Binding CollectionView}" SelectedItemsList="{Binding SelectedGames, Mode=TwoWay}">
            <i:Interaction.Triggers>
                <i:EventTrigger EventName="ContextMenuOpening" >
                    <prism:InvokeCommandAction Command="{Binding Data.ContextMenuOpening, Source={StaticResource BindingProxy}}" />
                </i:EventTrigger>
            </i:Interaction.Triggers>
            <DataGrid.ContextMenu>
                <ContextMenu ItemsSource="{Binding Data.MenuItems, Source={StaticResource BindingProxy}}">  
                    <ContextMenu.ItemContainerStyle>
                        <Style TargetType="MenuItem">
                            <Setter Property="Command" Value="{Binding Command}" />
                            <Setter Property="ItemsSource" Value="{Binding Items}" />
                        </Style>
                    </ContextMenu.ItemContainerStyle>
                </ContextMenu>
            </DataGrid.ContextMenu>
            <DataGrid.Columns>
                <DataGridTemplateColumn Header="{DynamicResource LOCImportLabel}">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <CheckBox IsChecked="{Binding Import, UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Center" />
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
                <DataGridTemplateColumn Header="{DynamicResource LOCNameLabel}" SortMemberPath="Name" MinWidth="300">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <TextBox Text="{Binding Name, UpdateSourceTrigger=PropertyChanged}"
                                     Background="{StaticResource NormalBrushDark}"/>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
                <DataGridTemplateColumn Header="{DynamicResource LOCPlatformTitle}" Width="200">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <dctrls:ComboBoxList Background="{StaticResource NormalBrushDark}"
                                                 SelectedItems="{Binding Platforms, UpdateSourceTrigger=PropertyChanged}"
                                                 ItemsSource="{Binding Data.Platforms, Source={StaticResource BindingProxy}}"/>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
                <DataGridTemplateColumn Header="{DynamicResource LOCRegionLabel}" Width="200">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <dctrls:ComboBoxList Background="{StaticResource NormalBrushDark}"
                                                 SelectedItems="{Binding Regions, UpdateSourceTrigger=PropertyChanged}"
                                                 ItemsSource="{Binding Data.Regions, Source={StaticResource BindingProxy}}"/>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
                <!--Hack to make the last empty column being able to slect a row-->
                <DataGridTemplateColumn Width="*">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <TextBlock VerticalAlignment="Stretch" HorizontalAlignment="Stretch" />
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
            </DataGrid.Columns>
            <DataGrid.RowDetailsTemplate>
                <DataTemplate>
                    <ListView ItemsSource="{Binding Roms}" BorderThickness="0" Margin="8">
                        <ListView.ContextMenu>
                            <ContextMenu Visibility="Collapsed" />
                        </ListView.ContextMenu>
                        <ListView.ItemContainerStyle>
                            <Style TargetType="ListViewItem" BasedOn="{StaticResource {x:Type ListViewItem}}">
                                <Setter Property="Focusable" Value="false"/>
                            </Style>
                        </ListView.ItemContainerStyle>
                        <ListView.View>
                            <GridView>
                                <GridViewColumn>
                                    <GridViewColumn.CellTemplate>
                                        <DataTemplate>
                                            <CheckBox IsChecked="{Binding Import}" VerticalAlignment="Center" HorizontalAlignment="Center" />
                                        </DataTemplate>
                                    </GridViewColumn.CellTemplate>
                                </GridViewColumn>
                                <GridViewColumn Header="{DynamicResource LOCNameLabel}" Width="Auto" DisplayMemberBinding="{Binding Name.DiscName}" />
                                <GridViewColumn Header="{DynamicResource LOCPathLabel}" Width="Auto" DisplayMemberBinding="{Binding Path}" />
                                <GridViewColumn Header="db" 
                                                Width="{Binding Path=(p:PlayniteEnvironment.IsDebugBuild), Converter={StaticResource BoolToAutoWidthConverter}}">
                                    <GridViewColumn.CellTemplate>
                                        <DataTemplate>
                                            <TextBox IsReadOnly="True" Text="{Binding DbData, Mode=OneWay}" />
                                        </DataTemplate>
                                    </GridViewColumn.CellTemplate>
                                </GridViewColumn>
                            </GridView>
                        </ListView.View>
                    </ListView>
                </DataTemplate>
            </DataGrid.RowDetailsTemplate>
        </controls:ExtendedDataGrid>

        <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto"
                      Grid.Row="1" Visibility="{Binding IsScanSetup, Converter={StaticResource BooleanToVisibilityConverter}}"
                      Margin="5,5,5,0">
            <ItemsControl ItemsSource="{Binding ScannerConfigs}">
                <ItemsControl.ItemTemplate>
                    <DataTemplate>
                        <Border Margin="5" DockPanel.Dock="Top" BorderThickness="1" 
                                BorderBrush="{DynamicResource NormalBorderBrush}" CornerRadius="{DynamicResource ControlCornerRadius}">
                            <StackPanel Margin="10">
                                <StackPanel.Resources>
                                    <Style TargetType="TextBlock" BasedOn="{StaticResource BaseTextBlockStyle}" />
                                </StackPanel.Resources>
                                <StackPanel Orientation="Horizontal">
                                    <TextBlock Text="{DynamicResource LOCEmuScanEmulator}" VerticalAlignment="Center" />
                                    <ComboBox Width="150" Margin="10,0,10,0" Name="ComboEmulatorList"
                                                ItemsSource="{Binding Data.Emulators, Source={StaticResource BindingProxy}}"
                                                DisplayMemberPath="Name" SelectedValuePath="Id" SelectedValue="{Binding EmulatorId}" />
                                    <TextBlock Text="{DynamicResource LOCProfileLabel}" VerticalAlignment="Center" />
                                    <ComboBox Width="150" Margin="10,0,10,0"
                                                ItemsSource="{Binding SelectedItem.AllProfiles, ElementName=ComboEmulatorList}"
                                                DisplayMemberPath="Name" SelectedValuePath="Id" SelectedValue="{Binding EmulatorProfileId}" />
                                </StackPanel>
                                <DockPanel Margin="0,10,0,10">
                                    <TextBlock Text="{DynamicResource LOCEmuScanDirectory}" VerticalAlignment="Center" />
                                    <TextBox pbeh:TextBoxBehavior.AttachDirectoryBrowser="True" Margin="10,0,10,0"
                                                Text="{Binding Directory, UpdateSourceTrigger=PropertyChanged}"/>
                                </DockPanel>
                                <CheckBox Content="{DynamicResource LOCEmuSaveScanConfig}"
                                          IsChecked="{Binding Save}"
                                          Visibility="{Binding Id, Converter={StaticResource InvertedObjectEqualityToVisibilityConverter}, ConverterParameter={x:Static sys:Guid.Empty}}"/>
                                <Button Content="{DynamicResource LOCRemoveLabel}" Margin="0,10,0,0" HorizontalAlignment="Left"
                                        Command="{Binding Data.RemoveScanConfigCommand, Source={StaticResource BindingProxy}}"
                                        CommandParameter="{Binding}" />
                            </StackPanel>
                        </Border>
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
            </ItemsControl>
        </ScrollViewer>

        <StackPanel Grid.Row="2" Orientation="Horizontal" Margin="10,10,10,10">
            <Button Content="{DynamicResource LOCEmuAddScanner}"
                    Command="{Binding AddScanConfigCommand}" 
                    Visibility="{Binding IsScanSetup, Converter={StaticResource BooleanToVisibilityConverter}}"/>
            <Button Content="{DynamicResource LOCEmuAddSavedScanner}" Margin="10,0,0,0"
                    Command="{Binding AddScanConfigCommand}" 
                    Visibility="{Binding IsScanSetup, Converter={StaticResource BooleanToVisibilityConverter}}"
                    pbeh:LeftClickContextMenuBehavior.Enabled="True">
                <Button.ContextMenu>
                    <ContextMenu ItemsSource="{Binding SavedConfigs}" Placement="Top">
                        <ContextMenu.ItemContainerStyle>
                            <Style TargetType="MenuItem">
                                <Setter Property="Command" Value="{Binding Data.AddSavedScanConfigCommand, Source={StaticResource BindingProxy}}" />
                                <Setter Property="CommandParameter" Value="{Binding}" />
                            </Style>
                        </ContextMenu.ItemContainerStyle>
                    </ContextMenu>
                </Button.ContextMenu>
            </Button>
            <Button Content="{DynamicResource LOCSelectAll}" Margin="0,0,10,0"
                    Command="{Binding SelectAllCommmand}"
                    Visibility="{Binding IsScanSetup, Converter={StaticResource InvertedBooleanToVisibilityConverter}}" />
            <Button Content="{DynamicResource LOCDeselectAll}"
                    Command="{Binding DeselectAllCommmand}"
                    Visibility="{Binding IsScanSetup, Converter={StaticResource InvertedBooleanToVisibilityConverter}}" />
        </StackPanel>

        <Border Grid.Row="3" BorderThickness="0,1,0,0" BorderBrush="{StaticResource NormalBorderBrush}">
            <DockPanel LastChildFill="False" Margin="5">
                <Button Content="{DynamicResource LOCCloseLabel}" DockPanel.Dock="Right" IsCancel="True"
                        Command="{Binding CancelCommand}" 
                        Style="{StaticResource BottomButton}" />
                <Button Content="{DynamicResource LOCImportLabel}" DockPanel.Dock="Right"
                        Command="{Binding ImportCommand}"
                        Style="{StaticResource BottomButton}"
                        Visibility="{Binding IsScanSetup, Converter={StaticResource InvertedBooleanToVisibilityConverter}}"/>
                <Button Content="{DynamicResource LOCStartScan}" DockPanel.Dock="Right"
                        Command="{Binding ScanCommmand}"
                        Style="{StaticResource BottomButton}"
                        Visibility="{Binding IsScanSetup, Converter={StaticResource BooleanToVisibilityConverter}}"/>
                <Button Content="{DynamicResource LOCMenuHelpTitle}"
                        Command="{x:Static pcmd:GlobalCommands.NavigateUrlCommand}"
                        CommandParameter="https://github.com/JosefNemec/Playnite/wiki/Adding-new-emulator"                        
                        DockPanel.Dock="Left" Style="{StaticResource BottomButton}"/>
            </DockPanel>
        </Border>
    </Grid>
</controls:WindowBase>

{'fraction_non_alphanumeric': 0.09643396893790797, 'fraction_numerical': 0.0074600469468471655, 'mean_word_length': 1.7048182292572622, 'pattern_counts': {'":': 0, '<': 311, '<?xml version=': 0, '>': 311, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 32}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 92, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3632820', 'n_tokens_mistral': 7306, 'n_tokens_neox': 6371, 'n_words': 966}