<commit_before>﻿<UserControl x:Class="NSwagStudio.Views.CodeGenerators.SwaggerToTypeScriptClientGeneratorView"
             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:converters="clr-namespace:MyToolkit.Converters;assembly=MyToolkit.Extended"
             xmlns:avalonedit="http://icsharpcode.net/sharpdevelop/avalonedit"
             xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
             xmlns:codeGenerators="clr-namespace:NSwagStudio.ViewModels.CodeGenerators"
             xmlns:controls="clr-namespace:NSwagStudio.Controls"
             xmlns:converters1="clr-namespace:NSwagStudio.Converters"
             xmlns:dialogs="clr-namespace:MyToolkit.Dialogs;assembly=MyToolkit.Extended"
             mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="300">

    <UserControl.Resources>
        <codeGenerators:SwaggerToTypeScriptClientGeneratorViewModel x:Key="ViewModel" />
        <converters:VisibilityConverter x:Key="VisibilityConverter" />
        <converters:EqualityConverter x:Key="EqualityConverter" />
        <converters:NotConverter x:Key="NotConverter" />
        <converters1:NumberAdditionConverter x:Key="NumberAdditionConverter" />
        <converters1:StringArrayConverter x:Key="StringArrayConverter" />
    </UserControl.Resources>

    <TabControl TabStripPlacement="Left" Margin="8" Name="TabControl" DataContext="{StaticResource ViewModel}">
        <TabItem Header="Settings" HeaderTemplate="{StaticResource RotatedTabItem}">
            <ScrollViewer x:Name="ScrollViewer" VerticalScrollBarVisibility="Visible" 
                          HorizontalScrollBarVisibility="Hidden"
                          IsEnabled="{Binding IsLoading, Converter={StaticResource NotConverter}}">
                <StackPanel Margin="8,8,8,0" Width="{Binding ElementName=ScrollViewer, Path=ActualWidth, Converter={StaticResource NumberAdditionConverter}, ConverterParameter=-32}">
                    <TextBlock Text="TypeScript Client Settings" FontSize="15" FontWeight="Bold" Margin="0,0,0,12" />

                    <TextBlock Text="Module name (empty for no module declaration)" FontWeight="Bold" Margin="0,0,0,6" />
                    <TextBox Text="{Binding Command.ModuleName, Mode=TwoWay}" Margin="0,0,0,12" />

                    <TextBlock Text="Namespace (empty for no namespace declaration)" FontWeight="Bold" Margin="0,0,0,6" />
                    <TextBox Text="{Binding Command.Namespace, Mode=TwoWay}" Margin="0,0,0,12" />

                    <TextBlock Text="TypeScript Version" FontWeight="Bold" Margin="0,0,0,6" />
                    <ComboBox SelectedItem="{Binding Command.TypeScriptVersion, Mode=TwoWay}" 
                              ItemsSource="{Binding TypeScriptVersions}" Margin="0,0,0,12" />

                    <GroupBox Header="Client" Margin="0,0,0,12">
                        <StackPanel Margin="4,4,4,-8">
                            <CheckBox IsChecked="{Binding Command.GenerateClientClasses, Mode=TwoWay}" 
                                      Content="Generate Client Classes" Margin="0,4,0,12" />

                            <StackPanel Visibility="{Binding Command.GenerateClientClasses, Converter={StaticResource VisibilityConverter}}">
                                <CheckBox IsChecked="{Binding Command.WrapExceptions, Mode=TwoWay}" 
                                          Content="Wrap DTO exceptions in a SwaggerError instance" Margin="0,0,0,12" />

                                <CheckBox IsChecked="{Binding Command.GenerateClientInterfaces, Mode=TwoWay}" 
                                          Content="Generate Client Interfaces" Margin="0,0,0,12" />

                                <TextBlock Text="Class Name" FontWeight="Bold" Margin="0,0,0,6" />
                                <TextBox Text="{Binding Command.ClassName, Mode=TwoWay}" Margin="0,0,0,12" />

                                <TextBlock Margin="0,0,0,6" TextWrapping="Wrap">
                                        <Run Text="Operation Generation Mode" FontWeight="Bold" />
                                        <LineBreak />
                                        The {controller} placeholder of the Class Name is replaced by generated client name (depends on the OperationGenerationMode strategy).
                                </TextBlock>
                                <ComboBox SelectedItem="{Binding Command.OperationGenerationMode, Mode=TwoWay}" 
                                          ItemsSource="{Binding OperationGenerationModes}" Margin="0,0,0,12" />

                                <TextBlock Text="Template" FontWeight="Bold" Margin="0,0,0,6" />
                                <ComboBox SelectedItem="{Binding Command.Template, Mode=TwoWay}" 
                                          ItemsSource="{Binding Templates}" Margin="0,0,0,12" />

                                <StackPanel Visibility="{Binding Command.Template, ConverterParameter='JQueryPromises', Converter={StaticResource EqualityConverter}}">
                                    <TextBlock Text="Promise Type" FontWeight="Bold" Margin="0,0,0,6" />
                                    <ComboBox SelectedItem="{Binding Command.PromiseType, Mode=TwoWay}" 
                                              ItemsSource="{Binding PromiseTypes}" Margin="0,0,0,12" />
                                </StackPanel>
                            </StackPanel>
                        </StackPanel>
                    </GroupBox>

                    <GroupBox Header="DTO Types" Margin="0,0,0,12">
                        <StackPanel Margin="4,8,4,-8">
                            <CheckBox IsChecked="{Binding Command.GenerateDtoTypes, Mode=TwoWay}" 
                                          Content="Generate DTO interfaces (e.g. request and response types)" Margin="0,0,0,12" />

                            <StackPanel Visibility="{Binding Command.GenerateDtoTypes, Converter={StaticResource VisibilityConverter}}">
                                <CheckBox IsChecked="{Binding Command.GenerateDefaultValues, Mode=TwoWay}" Margin="0,0,0,12">
                                    <TextBlock Text="Generate default values for properties (if default value is specified)" TextWrapping="Wrap" />
                                </CheckBox>

                                <CheckBox IsChecked="{Binding Command.MarkOptionalProperties, Mode=TwoWay}" 
                                          Content="Mark optional properties with ?" Margin="0,0,0,12" />

                                <TextBlock Text="Date Time Type" FontWeight="Bold" Margin="0,0,0,6" />
                                <ComboBox SelectedItem="{Binding Command.DateTimeType, Mode=TwoWay}" 
                                          ItemsSource="{Binding DateTimeTypes}" Margin="0,0,0,12" />

                                <TextBlock Text="Type Style" FontWeight="Bold" Margin="0,0,0,6" />
                                <ComboBox SelectedItem="{Binding Command.TypeStyle, Mode=TwoWay}" 
                                          ItemsSource="{Binding TypeStyles}" Margin="0,0,0,12" />

                                <StackPanel Visibility="{Binding Command.TypeStyle, ConverterParameter='!Class', Converter={StaticResource EqualityConverter}}">
                                    <TextBlock Text="The type names which always generate plain TypeScript classes (comma separated)" FontWeight="Bold" Margin="0,0,0,6" />
                                    <TextBox Text="{Binding ClassTypes, Mode=TwoWay}" Margin="0,0,0,12" />
                                </StackPanel>
                            </StackPanel>
                        </StackPanel>
                    </GroupBox>

                    <GroupBox Header="Class Extensions" Margin="0,0,0,12">
                        <StackPanel Margin="4,8,4,-8">
                            <TextBlock Text="Extended classes (comma separated)" FontWeight="Bold" Margin="0,0,0,6" />
                            <TextBox Text="{Binding ExtendedClasses, Mode=TwoWay}" Margin="0,0,0,12" />

                            <TextBlock Text="Path to class extension code file (the module import 'generated' is removed and class export keywords are added)" 
                                       FontWeight="Bold" Margin="0,0,0,6" />
                            <dialogs:FileOpenPicker DefaultExtension=".ts" Filter="TypeScript Files (.ts)|*.ts"
                                                     FilePath="{Binding Command.ExtensionCode, Mode=TwoWay}" 
                                                     Margin="0,0,0,12" />
                        </StackPanel>
                    </GroupBox>
                    
                    <GroupBox Header="Swagger Information" Margin="0,0,0,12">
                        <StackPanel Margin="4,8,4,-8">
                            <TextBlock Text="Service host (optional, use '.' to remove the hostname)" FontWeight="Bold" Margin="0,0,0,6" />
                            <TextBox Text="{Binding Command.ServiceHost, Mode=TwoWay}" Margin="0,0,0,12" />

                            <TextBlock Text="Service schemes (optional, 'http', 'https', 'ws', 'wss', multiple on separate lines)" FontWeight="Bold" Margin="0,0,0,6" />
                            <TextBox Text="{Binding Command.ServiceSchemes, Mode=TwoWay, Converter={StaticResource StringArrayConverter}}" Height="52" AcceptsReturn="True" VerticalScrollBarVisibility="Visible" Margin="0,0,0,12" />
                        </StackPanel>
                    </GroupBox>

                    <TextBlock Text="Output file path (empty: no file output)" FontWeight="Bold" Margin="0,0,0,6" />
                    <dialogs:FileSavePicker DefaultExtension=".ts" Filter="TypeScript Files (.ts)|*.ts"
                                            FilePath="{Binding Command.OutputFilePath, Mode=TwoWay}" 
                                            Margin="0,0,0,12" />
                </StackPanel>
            </ScrollViewer>
        </TabItem>
        <TabItem Header="Output" HeaderTemplate="{StaticResource RotatedTabItem}">
            <Border Margin="-2">
                <avalonedit:TextEditor Background="GhostWhite" FontFamily="Consolas" IsReadOnly="True" ShowLineNumbers="True"
                                       SyntaxHighlighting="JavaScript" FontSize="10pt" Padding="8">
                    <i:Interaction.Behaviors>
                        <controls:AvalonEditBehavior Text="{Binding ClientCode, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
                    </i:Interaction.Behaviors>
                </avalonedit:TextEditor>
            </Border>
        </TabItem>
    </TabControl>
</UserControl>
<commit_msg>Improved UI<commit_after>﻿<UserControl x:Class="NSwagStudio.Views.CodeGenerators.SwaggerToTypeScriptClientGeneratorView"
             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:converters="clr-namespace:MyToolkit.Converters;assembly=MyToolkit.Extended"
             xmlns:avalonedit="http://icsharpcode.net/sharpdevelop/avalonedit"
             xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
             xmlns:codeGenerators="clr-namespace:NSwagStudio.ViewModels.CodeGenerators"
             xmlns:controls="clr-namespace:NSwagStudio.Controls"
             xmlns:converters1="clr-namespace:NSwagStudio.Converters"
             xmlns:dialogs="clr-namespace:MyToolkit.Dialogs;assembly=MyToolkit.Extended"
             mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="300">

    <UserControl.Resources>
        <codeGenerators:SwaggerToTypeScriptClientGeneratorViewModel x:Key="ViewModel" />
        <converters:VisibilityConverter x:Key="VisibilityConverter" />
        <converters:EqualityConverter x:Key="EqualityConverter" />
        <converters:NotConverter x:Key="NotConverter" />
        <converters1:NumberAdditionConverter x:Key="NumberAdditionConverter" />
        <converters1:StringArrayConverter x:Key="StringArrayConverter" />
    </UserControl.Resources>

    <TabControl TabStripPlacement="Left" Margin="8" Name="TabControl" DataContext="{StaticResource ViewModel}">
        <TabItem Header="Settings" HeaderTemplate="{StaticResource RotatedTabItem}">
            <ScrollViewer x:Name="ScrollViewer" VerticalScrollBarVisibility="Visible" 
                          HorizontalScrollBarVisibility="Hidden"
                          IsEnabled="{Binding IsLoading, Converter={StaticResource NotConverter}}">
                <StackPanel Margin="8,8,8,0" Width="{Binding ElementName=ScrollViewer, Path=ActualWidth, Converter={StaticResource NumberAdditionConverter}, ConverterParameter=-32}">
                    <TextBlock Text="TypeScript Client Settings" FontSize="15" FontWeight="Bold" Margin="0,0,0,12" />

                    <TextBlock Text="Module name (empty for no module declaration)" FontWeight="Bold" Margin="0,0,0,6" />
                    <TextBox Text="{Binding Command.ModuleName, Mode=TwoWay}" Margin="0,0,0,12" />

                    <TextBlock Text="Namespace (empty for no namespace declaration)" FontWeight="Bold" Margin="0,0,0,6" />
                    <TextBox Text="{Binding Command.Namespace, Mode=TwoWay}" Margin="0,0,0,12" />

                    <TextBlock Text="TypeScript Version" FontWeight="Bold" Margin="0,0,0,6" />
                    <ComboBox SelectedItem="{Binding Command.TypeScriptVersion, Mode=TwoWay}" 
                              ItemsSource="{Binding TypeScriptVersions}" Margin="0,0,0,12" />

                    <GroupBox Header="Client" Margin="0,0,0,12">
                        <StackPanel Margin="4,4,4,-8">
                            <CheckBox IsChecked="{Binding Command.GenerateClientClasses, Mode=TwoWay}" 
                                      Content="Generate Client Classes" Margin="0,4,0,12" />

                            <StackPanel Visibility="{Binding Command.GenerateClientClasses, Converter={StaticResource VisibilityConverter}}">
                                <CheckBox IsChecked="{Binding Command.GenerateClientInterfaces, Mode=TwoWay}" 
                                          Content="Generate Client Interfaces" Margin="0,0,0,12" />

                                <CheckBox IsChecked="{Binding Command.WrapExceptions, Mode=TwoWay}" 
                                          Content="Wrap DTO exceptions in a SwaggerError instance" Margin="0,0,0,12" />

                                <TextBlock Text="Class Name" FontWeight="Bold" Margin="0,0,0,6" />
                                <TextBox Text="{Binding Command.ClassName, Mode=TwoWay}" Margin="0,0,0,12" />

                                <TextBlock Margin="0,0,0,6" TextWrapping="Wrap">
                                        <Run Text="Operation Generation Mode" FontWeight="Bold" />
                                        <LineBreak />
                                        The {controller} placeholder of the Class Name is replaced by generated client name (depends on the OperationGenerationMode strategy).
                                </TextBlock>
                                <ComboBox SelectedItem="{Binding Command.OperationGenerationMode, Mode=TwoWay}" 
                                          ItemsSource="{Binding OperationGenerationModes}" Margin="0,0,0,12" />

                                <TextBlock Text="Template" FontWeight="Bold" Margin="0,0,0,6" />
                                <ComboBox SelectedItem="{Binding Command.Template, Mode=TwoWay}" 
                                          ItemsSource="{Binding Templates}" Margin="0,0,0,12" />

                                <StackPanel Visibility="{Binding Command.Template, ConverterParameter='JQueryPromises', Converter={StaticResource EqualityConverter}}">
                                    <TextBlock Text="Promise Type" FontWeight="Bold" Margin="0,0,0,6" />
                                    <ComboBox SelectedItem="{Binding Command.PromiseType, Mode=TwoWay}" 
                                              ItemsSource="{Binding PromiseTypes}" Margin="0,0,0,12" />
                                </StackPanel>
                            </StackPanel>
                        </StackPanel>
                    </GroupBox>

                    <GroupBox Header="DTO Types" Margin="0,0,0,12">
                        <StackPanel Margin="4,8,4,-8">
                            <CheckBox IsChecked="{Binding Command.GenerateDtoTypes, Mode=TwoWay}" 
                                          Content="Generate DTO interfaces (e.g. request and response types)" Margin="0,0,0,12" />

                            <StackPanel Visibility="{Binding Command.GenerateDtoTypes, Converter={StaticResource VisibilityConverter}}">
                                <CheckBox IsChecked="{Binding Command.GenerateDefaultValues, Mode=TwoWay}" Margin="0,0,0,12">
                                    <TextBlock Text="Generate default values for properties (if default value is specified)" TextWrapping="Wrap" />
                                </CheckBox>

                                <CheckBox IsChecked="{Binding Command.MarkOptionalProperties, Mode=TwoWay}" 
                                          Content="Mark optional properties with ?" Margin="0,0,0,12" />

                                <TextBlock Text="Date Time Type" FontWeight="Bold" Margin="0,0,0,6" />
                                <ComboBox SelectedItem="{Binding Command.DateTimeType, Mode=TwoWay}" 
                                          ItemsSource="{Binding DateTimeTypes}" Margin="0,0,0,12" />

                                <TextBlock Text="Type Style" FontWeight="Bold" Margin="0,0,0,6" />
                                <ComboBox SelectedItem="{Binding Command.TypeStyle, Mode=TwoWay}" 
                                          ItemsSource="{Binding TypeStyles}" Margin="0,0,0,12" />

                                <StackPanel Visibility="{Binding Command.TypeStyle, ConverterParameter='!Class', Converter={StaticResource EqualityConverter}}">
                                    <TextBlock Text="The type names which always generate plain TypeScript classes (comma separated)" FontWeight="Bold" Margin="0,0,0,6" />
                                    <TextBox Text="{Binding ClassTypes, Mode=TwoWay}" Margin="0,0,0,12" />
                                </StackPanel>
                            </StackPanel>
                        </StackPanel>
                    </GroupBox>

                    <GroupBox Header="Class Extensions" Margin="0,0,0,12">
                        <StackPanel Margin="4,8,4,-8">
                            <TextBlock Text="Extended classes (comma separated)" FontWeight="Bold" Margin="0,0,0,6" />
                            <TextBox Text="{Binding ExtendedClasses, Mode=TwoWay}" Margin="0,0,0,12" />

                            <TextBlock Text="Path to class extension code file (the module import 'generated' is removed and class export keywords are added)" 
                                       FontWeight="Bold" Margin="0,0,0,6" />
                            <dialogs:FileOpenPicker DefaultExtension=".ts" Filter="TypeScript Files (.ts)|*.ts"
                                                     FilePath="{Binding Command.ExtensionCode, Mode=TwoWay}" 
                                                     Margin="0,0,0,12" />
                        </StackPanel>
                    </GroupBox>
                    
                    <GroupBox Header="Swagger Information" Margin="0,0,0,12">
                        <StackPanel Margin="4,8,4,-8">
                            <TextBlock Text="Service host (optional, use '.' to remove the hostname)" FontWeight="Bold" Margin="0,0,0,6" />
                            <TextBox Text="{Binding Command.ServiceHost, Mode=TwoWay}" Margin="0,0,0,12" />

                            <TextBlock Text="Service schemes (optional, 'http', 'https', 'ws', 'wss', multiple on separate lines)" FontWeight="Bold" Margin="0,0,0,6" />
                            <TextBox Text="{Binding Command.ServiceSchemes, Mode=TwoWay, Converter={StaticResource StringArrayConverter}}" Height="52" AcceptsReturn="True" VerticalScrollBarVisibility="Visible" Margin="0,0,0,12" />
                        </StackPanel>
                    </GroupBox>

                    <TextBlock Text="Output file path (empty: no file output)" FontWeight="Bold" Margin="0,0,0,6" />
                    <dialogs:FileSavePicker DefaultExtension=".ts" Filter="TypeScript Files (.ts)|*.ts"
                                            FilePath="{Binding Command.OutputFilePath, Mode=TwoWay}" 
                                            Margin="0,0,0,12" />
                </StackPanel>
            </ScrollViewer>
        </TabItem>
        <TabItem Header="Output" HeaderTemplate="{StaticResource RotatedTabItem}">
            <Border Margin="-2">
                <avalonedit:TextEditor Background="GhostWhite" FontFamily="Consolas" IsReadOnly="True" ShowLineNumbers="True"
                                       SyntaxHighlighting="JavaScript" FontSize="10pt" Padding="8">
                    <i:Interaction.Behaviors>
                        <controls:AvalonEditBehavior Text="{Binding ClientCode, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
                    </i:Interaction.Behaviors>
                </avalonedit:TextEditor>
            </Border>
        </TabItem>
    </TabControl>
</UserControl>

{'fraction_non_alphanumeric': 0.11476884331714338, 'fraction_numerical': 0.022486058643640942, 'mean_word_length': 1.8077020202020202, 'pattern_counts': {'":': 0, '<': 189, '<?xml version=': 0, '>': 189, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 24}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 78, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4558704', 'n_tokens_mistral': 5882, 'n_tokens_neox': 5277, 'n_words': 943}