<commit_before>﻿<UserControl x:Class="TimeSeriesFramework.UI.UserControls.AdapterUserControl"
             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" 
             mc:Ignorable="d" d:DesignHeight="650" d:DesignWidth="850"
             xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:uc="clr-namespace:TimeSeriesFramework.UI.UserControls"
             xmlns:tsfBinding="clr-namespace:TimeSeriesFramework.UI.Binding;assembly=TimeSeriesFramework.UI"
             xmlns:vm="clr-namespace:TimeSeriesFramework.UI.ViewModels"
             Background="Transparent">
    
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/TimeSeriesFramework.UI.WPF;Component/Resources/CommonResource.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>

    <StackPanel Orientation="Vertical">

        <StackPanel.Resources>
            <CollectionViewSource Source="{Binding Path=NodeLookupList}" x:Key="NodeLookupList"/>
            <CollectionViewSource Source="{Binding Path=AdapterTypeList}" x:Key="AdapterTypeList"/>
            <CollectionViewSource Source="{Binding Path=ParameterList}" x:Key="ParameterList"/>
        </StackPanel.Resources>

        <Grid x:Name="GridDetailView" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="5" DataContext="{Binding Path=CurrentItem, Mode=TwoWay}" DataContextChanged="GridDetailView_DataContextChanged">
            <Grid.BindingGroup >
                <BindingGroup Name="input"/>
            </Grid.BindingGroup>

            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>

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



            <StackPanel Orientation="Horizontal" Grid.Row="0" Grid.Column="0" HorizontalAlignment="Right">
                <TextBlock Text="Name" Style="{StaticResource RequiredLabel}" />
                <TextBlock Style="{StaticResource RequiredMarker}" />
            </StackPanel>
            <TextBox Grid.Row="0" Grid.Column="1" CharacterCasing="Upper" Text="{tsfBinding:Column Path=AdapterName}" MaxLength="50"/>
                
            <StackPanel Orientation="Horizontal" Grid.Row="0" Grid.Column="2" HorizontalAlignment="Right">
                <TextBlock Text="Load Order" Style="{StaticResource RequiredLabel}" />
                <TextBlock Style="{StaticResource RequiredMarker}" />
            </StackPanel>            
            <TextBox Grid.Row="0" Grid.Column="3" Text="{tsfBinding:Column Path=LoadOrder}" Width="35" />
            <GroupBox Grid.Row="2" Grid.ColumnSpan="4" Header="Adapter Type">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="Auto" />
                    </Grid.ColumnDefinitions>
                    
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>
                    
                    <TextBlock Grid.Row="0" Grid.Column="0" Text="Search Directory" />
                    <StackPanel Grid.Row="0" Grid.Column="1" Orientation="Horizontal">
                        <TextBox DataContext="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext}"
                                 Name="SearchDirectoryTextBox" Text="{tsfBinding:Column Path=SearchDirectory}" Width="395"/>
                        <Button Click="Browse_Click" Width="Auto" ToolTip="Browse">
                            <Button.Template>
                                <ControlTemplate>
                                    <Image Source="/TimeSeriesFramework.UI;component/images/Folder.png" Height="24" Width="24" />
                                </ControlTemplate>
                            </Button.Template>
                        </Button>
                    </StackPanel>
                    <TextBlock Grid.Row="1" Grid.Column="0" Text="Type" />
                    <ComboBox Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="2" ItemsSource="{Binding Source={StaticResource AdapterTypeList}}" DisplayMemberPath="Value" HorizontalContentAlignment="Left" Width="430"
                              SelectedItem="{tsfBinding:Column Path=TypeName, Converter={StaticResource DictionaryToKeyValuePairConverter}, ConverterParameter={StaticResource AdapterTypeList}}" />
                </Grid>
            </GroupBox>
            <GroupBox Grid.Row="3" Grid.ColumnSpan="4" Header="Connection String">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="Auto" />
                    </Grid.ColumnDefinitions>

                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>
                    
                    <TextBlock Text="Parameters" VerticalAlignment="Top" Grid.Row="0" Grid.Column="0" />
                    
                    <ListBox Grid.Row="0" Grid.Column="1" Width="{StaticResource LargerItemSize}" Height="{StaticResource XSmallItemSize}" HorizontalContentAlignment="Stretch"
                             Name="ParameterListBox" ItemsSource="{Binding Source={StaticResource ParameterList}}" SelectedItem="{Binding Path=SelectedParameter}"
                             DataContext="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext}" ScrollViewer.VerticalScrollBarVisibility="Auto"
                             ScrollViewer.HorizontalScrollBarVisibility="Auto">
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <TextBlock FontWeight="{Binding Path=Boldness}" Foreground="{Binding Path=Color}" Text="{Binding Path=Name}" ToolTipService.InitialShowDelay="0" Width="Auto" TextAlignment="Left" HorizontalAlignment="Left">
                                    <TextBlock.ToolTip>
                                        <ToolTip>
                                            <TextBlock Text="{Binding Path=Description}" />
                                        </ToolTip>
                                    </TextBlock.ToolTip>
                                </TextBlock>
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>

                    <StackPanel Grid.Row="0" Grid.Column="2" Margin="10,5,0,0">
                        <TextBlock Name="ParameterValueTextBlock" Margin="0" Text="Value" HorizontalAlignment="Center" VerticalAlignment="Top" />
                        <Button Content="Default" Margin="0" Width="Auto" HorizontalAlignment="Center" ToolTip="Click to restore the default value." Click="Default_Click" />
                    </StackPanel>
                    <StackPanel Grid.Row="0" Grid.Column="3" DataContext="{Binding ElementName=ParameterListBox, Path=SelectedItem}">
                        <StackPanel.Resources>
                            <CollectionViewSource Source="{Binding Path=EnumValues}" x:Key="EnumValues" />
                        </StackPanel.Resources>
                        
                        <TextBox Name="ParameterValueTextBox" Height="{StaticResource XSmallItemSize}" Text="{tsfBinding:Column Path=Value}" TextWrapping="Wrap"
                                 Visibility="{Binding Path=IsOther, Converter={StaticResource ObjectToVisibilityConverter}}" VerticalScrollBarVisibility="Auto"/>
                        
                        <StackPanel>
                            <StackPanel.Style>
                                <Style TargetType="{x:Type StackPanel}">
                                    <Style.Triggers>
                                        <DataTrigger Binding="{Binding ElementName=ParameterListBox, Path=SelectedItem}" Value="{x:Null}">
                                            <Setter Property="Visibility" Value="Collapsed" />
                                        </DataTrigger>
                                    </Style.Triggers>
                                </Style>
                            </StackPanel.Style>

                            <StackPanel Margin="5" Width="{Binding ElementName=ParameterValueTextBox, Path=Width}" Height="{Binding ElementName=ParameterValueTextBox, Path=Height}"
                                        Visibility="{Binding Path=IsBoolean, Converter={StaticResource ObjectToVisibilityConverter}}">
                                <RadioButton Content="True" GroupName="BooleanParameter" IsChecked="{Binding Path=Value}" />
                                <RadioButton Content="False" GroupName="BooleanParameter" IsChecked="{Binding Mode=OneWay, Path=IsFalseChecked}" />
                            </StackPanel>
                            
                            <StackPanel Margin="5" Height="{Binding ElementName=ParameterValueTextBox, Path=Height}"
                                        Visibility="{Binding Path=IsEnum, Converter={StaticResource ObjectToVisibilityConverter}}">
                                <ComboBox ItemsSource="{Binding Source={StaticResource EnumValues}}" SelectedItem="{Binding Path=Value}" />
                            </StackPanel>
                        </StackPanel>
                    </StackPanel>
                    <TextBlock Grid.Row="1" Grid.Column="0" Text="Connection String" VerticalAlignment="Top" />
                    <TextBox Grid.Row="1" Grid.Column="1"  Grid.ColumnSpan="3" Width="450" Height="{StaticResource XSmallItemSize}"
                             Text="{tsfBinding:Column Path=ConnectionString}" TextWrapping="Wrap" ScrollViewer.VerticalScrollBarVisibility="Visible" />
                </Grid>
            </GroupBox>
            <TextBlock Text="Runtime ID" Grid.Row="4" Grid.Column="0" />
            <StackPanel Orientation="Horizontal" Grid.Row="4" Grid.Column="1"><commit_msg>Widened input fields on the AdapterUserControl.<commit_after>﻿<UserControl x:Class="TimeSeriesFramework.UI.UserControls.AdapterUserControl"
             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" 
             mc:Ignorable="d" d:DesignHeight="650" d:DesignWidth="850"
             xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:uc="clr-namespace:TimeSeriesFramework.UI.UserControls"
             xmlns:tsfBinding="clr-namespace:TimeSeriesFramework.UI.Binding;assembly=TimeSeriesFramework.UI"
             xmlns:vm="clr-namespace:TimeSeriesFramework.UI.ViewModels"
             Background="Transparent">
    
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/TimeSeriesFramework.UI.WPF;Component/Resources/CommonResource.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>

    <StackPanel Orientation="Vertical">

        <StackPanel.Resources>
            <CollectionViewSource Source="{Binding Path=NodeLookupList}" x:Key="NodeLookupList"/>
            <CollectionViewSource Source="{Binding Path=AdapterTypeList}" x:Key="AdapterTypeList"/>
            <CollectionViewSource Source="{Binding Path=ParameterList}" x:Key="ParameterList"/>
        </StackPanel.Resources>

        <Grid x:Name="GridDetailView" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="5" DataContext="{Binding Path=CurrentItem, Mode=TwoWay}" DataContextChanged="GridDetailView_DataContextChanged">
            <Grid.BindingGroup >
                <BindingGroup Name="input"/>
            </Grid.BindingGroup>

            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>

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



            <StackPanel Orientation="Horizontal" Grid.Row="0" Grid.Column="0" HorizontalAlignment="Right">
                <TextBlock Text="Name" Style="{StaticResource RequiredLabel}" />
                <TextBlock Style="{StaticResource RequiredMarker}" />
            </StackPanel>
            <TextBox Grid.Row="0" Grid.Column="1" CharacterCasing="Upper" Text="{tsfBinding:Column Path=AdapterName}" MaxLength="50"/>
                
            <StackPanel Orientation="Horizontal" Grid.Row="0" Grid.Column="2" HorizontalAlignment="Right">
                <TextBlock Text="Load Order" Style="{StaticResource RequiredLabel}" />
                <TextBlock Style="{StaticResource RequiredMarker}" />
            </StackPanel>            
            <TextBox Grid.Row="0" Grid.Column="3" Text="{tsfBinding:Column Path=LoadOrder}" Width="35" />
            <GroupBox Grid.Row="2" Grid.ColumnSpan="4" Header="Adapter Type">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>
                    
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>
                    
                    <TextBlock Grid.Row="0" Grid.Column="0" Text="Search Directory" />
                    <StackPanel Grid.Row="0" Grid.Column="1" HorizontalAlignment="Stretch" Orientation="Horizontal">
                        <TextBox DataContext="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext}"
                                 Name="SearchDirectoryTextBox" Text="{tsfBinding:Column Path=SearchDirectory}" Width="525" />
                        <Button Click="Browse_Click" Width="Auto" ToolTip="Browse">
                            <Button.Template>
                                <ControlTemplate>
                                    <Image Source="/TimeSeriesFramework.UI;component/images/Folder.png" Height="24" Width="24" />
                                </ControlTemplate>
                            </Button.Template>
                        </Button>
                    </StackPanel>
                    <TextBlock Grid.Row="1" Grid.Column="0" Text="Type" />
                    <ComboBox Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="2" ItemsSource="{Binding Source={StaticResource AdapterTypeList}}" DisplayMemberPath="Value" HorizontalContentAlignment="Left" Width="560"
                              SelectedItem="{tsfBinding:Column Path=TypeName, Converter={StaticResource DictionaryToKeyValuePairConverter}, ConverterParameter={StaticResource AdapterTypeList}}" />
                </Grid>
            </GroupBox>
            <GroupBox Grid.Row="3" Grid.ColumnSpan="4" Header="Connection String">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="Auto" />
                    </Grid.ColumnDefinitions>

                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>
                    
                    <TextBlock Text="Parameters" VerticalAlignment="Top" Grid.Row="0" Grid.Column="0" />
                    
                    <ListBox Grid.Row="0" Grid.Column="1" Width="{StaticResource XLargeItemSize}" Height="{StaticResource XSmallItemSize}" HorizontalContentAlignment="Stretch"
                             Name="ParameterListBox" ItemsSource="{Binding Source={StaticResource ParameterList}}" SelectedItem="{Binding Path=SelectedParameter}"
                             DataContext="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext}" ScrollViewer.VerticalScrollBarVisibility="Auto"
                             ScrollViewer.HorizontalScrollBarVisibility="Auto">
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <TextBlock FontWeight="{Binding Path=Boldness}" Foreground="{Binding Path=Color}" Text="{Binding Path=Name}" ToolTipService.InitialShowDelay="0" Width="Auto" TextAlignment="Left" HorizontalAlignment="Left">
                                    <TextBlock.ToolTip>
                                        <ToolTip>
                                            <TextBlock Text="{Binding Path=Description}" />
                                        </ToolTip>
                                    </TextBlock.ToolTip>
                                </TextBlock>
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>

                    <StackPanel Grid.Row="0" Grid.Column="2" Margin="10,5,0,0">
                        <TextBlock Name="ParameterValueTextBlock" Margin="0" Text="Value" HorizontalAlignment="Center" VerticalAlignment="Top" />
                        <Button Content="Default" Margin="0" Width="Auto" HorizontalAlignment="Center" ToolTip="Click to restore the default value." Click="Default_Click" />
                    </StackPanel>
                    <StackPanel Grid.Row="0" Grid.Column="3" DataContext="{Binding ElementName=ParameterListBox, Path=SelectedItem}">
                        <StackPanel.Resources>
                            <CollectionViewSource Source="{Binding Path=EnumValues}" x:Key="EnumValues" />
                        </StackPanel.Resources>
                        
                        <TextBox Name="ParameterValueTextBox" Width="{StaticResource XLargeItemSize}" Height="{StaticResource XSmallItemSize}" Text="{tsfBinding:Column Path=Value}" TextWrapping="Wrap"
                                 Visibility="{Binding Path=IsOther, Converter={StaticResource ObjectToVisibilityConverter}}" VerticalScrollBarVisibility="Auto"/>
                        
                        <StackPanel>
                            <StackPanel.Style>
                                <Style TargetType="{x:Type StackPanel}">
                                    <Style.Triggers>
                                        <DataTrigger Binding="{Binding ElementName=ParameterListBox, Path=SelectedItem}" Value="{x:Null}">
                                            <Setter Property="Visibility" Value="Collapsed" />
                                        </DataTrigger>
                                    </Style.Triggers>
                                </Style>
                            </StackPanel.Style>

                            <StackPanel Margin="5" Width="{Binding ElementName=ParameterValueTextBox, Path=Width}" Height="{Binding ElementName=ParameterValueTextBox, Path=Height}"
                                        Visibility="{Binding Path=IsBoolean, Converter={StaticResource ObjectToVisibilityConverter}}">
                                <RadioButton Content="True" GroupName="BooleanParameter" IsChecked="{Binding Path=Value}" />
                                <RadioButton Content="False" GroupName="BooleanParameter" IsChecked="{Binding Mode=OneWay, Path=IsFalseChecked}" />
                            </StackPanel>
                            
                            <StackPanel Margin="5" Height="{Binding ElementName=ParameterValueTextBox, Path=Height}"
                                        Visibility="{Binding Path=IsEnum, Converter={StaticResource ObjectToVisibilityConverter}}">
                                <ComboBox ItemsSource="{Binding Source={StaticResource EnumValues}}" SelectedItem="{Binding Path=Value}" />
                            </StackPanel>
                        </StackPanel>
                    </StackPanel>
                    <TextBlock Grid.Row="1" Grid.Column="0" Text="Connection String" VerticalAlignment="Top" />
                    <TextBox Grid.Row="1" Grid.Column="1"  Grid.ColumnSpan="3" Width="Auto" Height="{StaticResource XSmallItemSize}" HorizontalAlignment="Stretch"
                             Text="{tsfBinding:Column Path=ConnectionString}" TextWrapping="Wrap" ScrollViewer.VerticalScrollBarVisibility="Visible" />
                </Grid>
            </GroupBox>
            <TextBlock Text="Runtime ID" Grid.Row="4" Grid.Column="0" />
            <StackPanel Orientation="Horizontal" Grid.Row="4" Grid.Column="1">
{'fraction_non_alphanumeric': 0.11321841627154695, 'fraction_numerical': 0.008020560996144814, 'mean_word_length': 1.8494949494949495, 'pattern_counts': {'":': 0, '<': 259, '<?xml version=': 0, '>': 259, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 18}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 34, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3027121', 'n_tokens_mistral': 5434, 'n_tokens_neox': 4908, 'n_words': 806}