<commit_before>﻿<Controls:MetroWindow x:Class="Orders.com.WPF.CustomerOrderWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:converters="clr-namespace:Orders.com.WPF.Converters"
        xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
        Title="Customer Order" Height="450" Width="900" WindowStartupLocation="CenterOwner" IsMinButtonEnabled="False" IsCloseButtonEnabled="False" IsMaxRestoreButtonEnabled="False" WindowStyle="ToolWindow">
    <Window.Resources>
        <converters:VisibilityConverter x:Key="reverseVisibilityConverter" Reverse="true" />
        <converters:VisibilityConverter x:Key="visibilityConverter" />
        <converters:ErrorsConverter x:Key="errorsConverter" />
    </Window.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="*"></RowDefinition>
            <RowDefinition Height="Auto"></RowDefinition>
        </Grid.RowDefinitions>
        <Grid Grid.Row="0">
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition />
                <RowDefinition />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition />
            </Grid.ColumnDefinitions>
            <Label Content="Order ID:" Grid.Row="0" FontWeight="Bold"/>
            <Label Content="{Binding ID}" Grid.Row="0" Grid.Column="1" />
            <Label Content="Customer:" Grid.Row="1" FontWeight="Bold" />
            <ComboBox Grid.Row="1" Grid.Column="1" Margin="5,0,5,0" ItemsSource="{Binding Customers}" DisplayMemberPath="Name" SelectedValuePath="ID" SelectedValue="{Binding CurrentCustomerID}" Width="Auto" VerticalAlignment="Center"/>
            <Label Content="Total:" Grid.Row="2" FontWeight="Bold" />
            <Label Content="{Binding Total}" ContentStringFormat="C" Grid.Row="2" Grid.Column="1" />
        </Grid>
        <GroupBox Header="Items" Grid.Row="1" Grid.ColumnSpan="2" Margin="5">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="*" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <DataGrid ItemsSource="{Binding OrderItems}" SelectedItem="{Binding SelectedOrderItem, Mode=TwoWay}" AutoGenerateColumns="False" Margin="0,5,0,5">
                    <DataGrid.Columns>
                        <DataGridTemplateColumn Header="ID" IsReadOnly="True">
                            <DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <TextBlock Text="{Binding ID}" />
                                </DataTemplate>
                            </DataGridTemplateColumn.CellTemplate>
                        </DataGridTemplateColumn>
                        <DataGridTemplateColumn Header="Category">
                            <DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <ComboBox Margin="1" IsEnabled="{Binding CanChangeCategoryAndProduct}" ItemsSource="{Binding Categories}" DisplayMemberPath="Name" SelectedValuePath="ID" SelectedValue="{Binding CurrentCategoryID, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
                                </DataTemplate>
                            </DataGridTemplateColumn.CellTemplate>
                        </DataGridTemplateColumn>
                        <DataGridTemplateColumn Header="Product" >
                            <DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <ComboBox Margin="1" IsEnabled="{Binding CanChangeCategoryAndProduct}" ItemsSource="{Binding Products}" DisplayMemberPath="Name" SelectedValuePath="ID" SelectedValue="{Binding CurrentProductID, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
                                </DataTemplate>
                            </DataGridTemplateColumn.CellTemplate>
                        </DataGridTemplateColumn>
                        <DataGridTextColumn Binding="{Binding Price, StringFormat=C}" IsReadOnly="True" Header="Price" ></DataGridTextColumn>
                        <DataGridTextColumn Binding="{Binding Quantity, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Header="Quantity"></DataGridTextColumn>
                        <DataGridTextColumn Binding="{Binding Amount, StringFormat=C}" IsReadOnly="True" Header="Amount"></DataGridTextColumn>
                        <DataGridTextColumn Binding="{Binding Status.Name}" IsReadOnly="True" Header="Status"></DataGridTextColumn>
                        <DataGridTextColumn IsReadOnly="True" Binding="{Binding SubmittedOn}" Header="Submitted On" />
                        <DataGridTextColumn IsReadOnly="True" Binding="{Binding ShippedOn}" Header="Shipped On" />
                        <DataGridTemplateColumn>
                            <DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <Image Source="Images\warning.png" Height="20" Width="20" Visibility="{Binding IsValid, Converter={StaticResource reverseVisibilityConverter}}">
                                        <Image.ToolTip>
                                            <ToolTip Content="{Binding Errors, Converter={StaticResource errorsConverter}}" />
                                        </Image.ToolTip>
                                    </Image>
                                </DataTemplate>
                            </DataGridTemplateColumn.CellTemplate>
                        </DataGridTemplateColumn>
                        <DataGridTemplateColumn Width="Auto">
                            <DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <Button Name="deleteButton" Width="35" Height="35" Command="{Binding DataContext.DeleteSelectedItemCommand, RelativeSource={RelativeSource AncestorType=DataGrid}}" ToolTipService.ToolTip="Delete this row" >
                                        <Button.Content>
                                            <Image Source="Images\delete.png" Stretch="UniformToFill"></Image>
                                        </Button.Content>
                                    </Button>
                                </DataTemplate>
                            </DataGridTemplateColumn.CellTemplate>
                        </DataGridTemplateColumn>
                        <DataGridTemplateColumn>
                            <DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <StackPanel Orientation="Horizontal" >
                                        <Button Width="35" Height="35" ToolTipService.ToolTip="Ship this item" Command="{Binding ShipCommand}" IsEnabled="{Binding Status.CanShip}" Visibility="{Binding Status.CanShip, Converter={StaticResource visibilityConverter}}">
                                            <Button.Content>
                                                <Image Source="Images\next.png" Stretch="UniformToFill"></Image>
                                            </Button.Content>
                                        </Button>
                                    </StackPanel>
                                </DataTemplate>
                            </DataGridTemplateColumn.CellTemplate>
                        </DataGridTemplateColumn>
                    </DataGrid.Columns>
                </DataGrid>
                <Button Grid.Row="1" Margin="5" Width="35" Height="35" Command="{Binding AddOrderItemCommand}" ToolTip="Add Item" HorizontalAlignment="Left">
                    <Button.Content>
                        <Image Source="Images\add.png" Stretch="UniformToFill" />
                    </Button.Content>
                </Button>
            </Grid>
        </GroupBox>
        <StackPanel Grid.Row="2" Orientation="Horizontal">
            <Button Margin="5" Width="35" Height="35" Command="{Binding SaveOrderCommand}" IsEnabled="{Binding CanSave}" ToolTip="Save">
                <Button.Content>
                    <Image Source="Images\save.png" Stretch="UniformToFill"></Image>
                </Button.Content>
            </Button>
            <Button Margin="5" Width="35" Height="35" Command="{Binding RefreshCommand}" IsEnabled="{Binding CanSave}" ToolTip="Undo Changes">
                <Button.Content>
                    <Image Source="Images\sync.png" Stretch="UniformToFill"></Image>
                </Button.Content>
            </Button>
            <Button Margin="5" Width="35" Height="35" Command="{Binding SubmitOrderCommand}" IsEnabled="{Binding CanSubmit}" ToolTip="Submit Order">
                <Button.Content>
                    <Image Source="Images\next.png" Stretch="UniformToFill"></Image>
                </Button.Content>
            </Button>
            <Button Margin="5" Width="35" Height="35" Click="CloseWindowClick" ToolTip="Done">
                <Button.Content>
                    <Image Source="Images\cancel.png" Stretch="UniformToFill"></Image>
                </Button.Content>
            </Button>
        </StackPanel>
    </Grid>
</Controls:MetroWindow><commit_msg>move the refresh button along side the add button<commit_after>﻿<Controls:MetroWindow x:Class="Orders.com.WPF.CustomerOrderWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:converters="clr-namespace:Orders.com.WPF.Converters"
        xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
        Title="Customer Order" Height="450" Width="900" WindowStartupLocation="CenterOwner" IsMinButtonEnabled="False" IsCloseButtonEnabled="False" IsMaxRestoreButtonEnabled="False" WindowStyle="ToolWindow">
    <Window.Resources>
        <converters:VisibilityConverter x:Key="reverseVisibilityConverter" Reverse="true" />
        <converters:VisibilityConverter x:Key="visibilityConverter" />
        <converters:ErrorsConverter x:Key="errorsConverter" />
    </Window.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="*"></RowDefinition>
            <RowDefinition Height="Auto"></RowDefinition>
        </Grid.RowDefinitions>
        <Grid Grid.Row="0">
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition />
                <RowDefinition />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition />
            </Grid.ColumnDefinitions>
            <Label Content="Order ID:" Grid.Row="0" FontWeight="Bold"/>
            <Label Content="{Binding ID}" Grid.Row="0" Grid.Column="1" />
            <Label Content="Customer:" Grid.Row="1" FontWeight="Bold" />
            <ComboBox Grid.Row="1" Grid.Column="1" Margin="5,0,5,0" ItemsSource="{Binding Customers}" DisplayMemberPath="Name" SelectedValuePath="ID" SelectedValue="{Binding CurrentCustomerID}" Width="Auto" VerticalAlignment="Center"/>
            <Label Content="Total:" Grid.Row="2" FontWeight="Bold" />
            <Label Content="{Binding Total}" ContentStringFormat="C" Grid.Row="2" Grid.Column="1" />
        </Grid>
        <GroupBox Header="Items" Grid.Row="1" Grid.ColumnSpan="2" Margin="5">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="*" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <DataGrid ItemsSource="{Binding OrderItems}" SelectedItem="{Binding SelectedOrderItem, Mode=TwoWay}" AutoGenerateColumns="False" Margin="0,5,0,5">
                    <DataGrid.Columns>
                        <DataGridTemplateColumn Header="ID" IsReadOnly="True">
                            <DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <TextBlock Text="{Binding ID}" />
                                </DataTemplate>
                            </DataGridTemplateColumn.CellTemplate>
                        </DataGridTemplateColumn>
                        <DataGridTemplateColumn Header="Category">
                            <DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <ComboBox Margin="1" IsEnabled="{Binding CanChangeCategoryAndProduct}" ItemsSource="{Binding Categories}" DisplayMemberPath="Name" SelectedValuePath="ID" SelectedValue="{Binding CurrentCategoryID, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
                                </DataTemplate>
                            </DataGridTemplateColumn.CellTemplate>
                        </DataGridTemplateColumn>
                        <DataGridTemplateColumn Header="Product" >
                            <DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <ComboBox Margin="1" IsEnabled="{Binding CanChangeCategoryAndProduct}" ItemsSource="{Binding Products}" DisplayMemberPath="Name" SelectedValuePath="ID" SelectedValue="{Binding CurrentProductID, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
                                </DataTemplate>
                            </DataGridTemplateColumn.CellTemplate>
                        </DataGridTemplateColumn>
                        <DataGridTextColumn Binding="{Binding Price, StringFormat=C}" IsReadOnly="True" Header="Price" ></DataGridTextColumn>
                        <DataGridTextColumn Binding="{Binding Quantity, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Header="Quantity"></DataGridTextColumn>
                        <DataGridTextColumn Binding="{Binding Amount, StringFormat=C}" IsReadOnly="True" Header="Amount"></DataGridTextColumn>
                        <DataGridTextColumn Binding="{Binding Status.Name}" IsReadOnly="True" Header="Status"></DataGridTextColumn>
                        <DataGridTextColumn IsReadOnly="True" Binding="{Binding SubmittedOn}" Header="Submitted On" />
                        <DataGridTextColumn IsReadOnly="True" Binding="{Binding ShippedOn}" Header="Shipped On" />
                        <DataGridTemplateColumn>
                            <DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <Image Source="Images\warning.png" Height="20" Width="20" Visibility="{Binding IsValid, Converter={StaticResource reverseVisibilityConverter}}">
                                        <Image.ToolTip>
                                            <ToolTip Content="{Binding Errors, Converter={StaticResource errorsConverter}}" />
                                        </Image.ToolTip>
                                    </Image>
                                </DataTemplate>
                            </DataGridTemplateColumn.CellTemplate>
                        </DataGridTemplateColumn>
                        <DataGridTemplateColumn Width="Auto">
                            <DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <Button Name="deleteButton" Width="35" Height="35" Command="{Binding DataContext.DeleteSelectedItemCommand, RelativeSource={RelativeSource AncestorType=DataGrid}}" ToolTipService.ToolTip="Delete this row" >
                                        <Button.Content>
                                            <Image Source="Images\delete.png" Stretch="UniformToFill"></Image>
                                        </Button.Content>
                                    </Button>
                                </DataTemplate>
                            </DataGridTemplateColumn.CellTemplate>
                        </DataGridTemplateColumn>
                        <DataGridTemplateColumn>
                            <DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <StackPanel Orientation="Horizontal" >
                                        <Button Width="35" Height="35" ToolTipService.ToolTip="Ship this item" Command="{Binding ShipCommand}" IsEnabled="{Binding Status.CanShip}" Visibility="{Binding Status.CanShip, Converter={StaticResource visibilityConverter}}">
                                            <Button.Content>
                                                <Image Source="Images\next.png" Stretch="UniformToFill"></Image>
                                            </Button.Content>
                                        </Button>
                                    </StackPanel>
                                </DataTemplate>
                            </DataGridTemplateColumn.CellTemplate>
                        </DataGridTemplateColumn>
                    </DataGrid.Columns>
                </DataGrid>
                <StackPanel Grid.Row="1" HorizontalAlignment="Left" Orientation="Horizontal">
                    <Button Margin="5" Width="35" Height="35" Command="{Binding AddOrderItemCommand}" ToolTip="Add Item">
                        <Button.Content>
                            <Image Source="Images\add.png" Stretch="UniformToFill" />
                        </Button.Content>
                    </Button>
                    <Button Margin="5" Width="35" Height="35" Command="{Binding RefreshCommand}" IsEnabled="{Binding CanSave}" ToolTip="Undo Changes">
                        <Button.Content>
                            <Image Source="Images\sync.png" Stretch="UniformToFill"></Image>
                        </Button.Content>
                    </Button>
                </StackPanel>
            </Grid>
        </GroupBox>
        <StackPanel Grid.Row="2" Orientation="Horizontal">
            <Button Margin="5" Width="35" Height="35" Command="{Binding SaveOrderCommand}" IsEnabled="{Binding CanSave}" ToolTip="Save">
                <Button.Content>
                    <Image Source="Images\save.png" Stretch="UniformToFill"></Image>
                </Button.Content>
            </Button>
            <Button Margin="5" Width="35" Height="35" Command="{Binding SubmitOrderCommand}" IsEnabled="{Binding CanSubmit}" ToolTip="Submit Order">
                <Button.Content>
                    <Image Source="Images\next.png" Stretch="UniformToFill"></Image>
                </Button.Content>
            </Button>
            <Button Margin="5" Width="35" Height="35" Click="CloseWindowClick" ToolTip="Done">
                <Button.Content>
                    <Image Source="Images\cancel.png" Stretch="UniformToFill"></Image>
                </Button.Content>
            </Button>
        </StackPanel>
    </Grid>
</Controls:MetroWindow>
{'fraction_non_alphanumeric': 0.1119659008212912, 'fraction_numerical': 0.007901029213015906, 'mean_word_length': 1.7519668144757545, 'pattern_counts': {'":': 0, '<': 295, '<?xml version=': 0, '>': 295, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 8}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 50, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7645179', 'n_tokens_mistral': 4563, 'n_tokens_neox': 4165, 'n_words': 706}