Files @ 6919080271d5
Branch filter:

Location: ATITD-Tools/Desert-Paint-Codex/Views/RecipeGeneratorView.axaml

Malkyne
Implemented a system that will allow ingredients to be safely renamed, in the
future, without invalidating profiles. Standardized to PP's "FalconBait."
<UserControl xmlns="https://github.com/avaloniaui"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:vm="using:DesertPaintCodex.ViewModels"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:local="clr-namespace:DesertPaintCodex.Models"
             mc:Ignorable="d" d:DesignWidth="600" d:DesignHeight="475"
             x:Class="DesertPaintCodex.Views.RecipeGeneratorView">
    
    <Design.DataContext>
        <vm:RecipeGeneratorViewModel/>
    </Design.DataContext>
    
    <UserControl.DataContext>
        <vm:RecipeGeneratorViewModel/>
    </UserControl.DataContext>
    
    <UserControl.DataTemplates>
        <DataTemplate DataType="{x:Type local:GeneratorRecipe}">
            <Grid ColumnDefinitions="45,5,130,5,*" RowDefinitions="Auto" Margin="5">
                <Border Grid.Column="0" Classes="ReagentSwatch" Background="{Binding Color, Converter={StaticResource paintToBrush}, FallbackValue=#00000000}" />
                <TextBlock Grid.Column="2" VerticalAlignment="Center" Text="{Binding Color.Name}"/>
                <TextBlock Grid.Column="4" VerticalAlignment="Center" TextWrapping="Wrap" Text="{Binding Recipe}"/>
            </Grid>
        </DataTemplate>
    </UserControl.DataTemplates>
    
    
    <UserControl.Styles>
        <Style Selector="DockPanel.ControlBar > Button">
            <Setter Property="DockPanel.Dock" Value="Left"/>
            <Setter Property="Width" Value="60"/>
            <Setter Property="Margin" Value="0 0 5 0"/>
        </Style>
        <Style Selector="TabControl.GeneratorTabs > TabItem:selected">
            <!--<Setter Property="Background" Value="{DynamicResource FlatBackgroundBrush}"/>-->
            <Setter Property="Foreground" Value="#FFFFFF"/>
        </Style>
        <Style Selector="DataGridRow /template/ Rectangle#BackgroundRectangle">
            <Setter Property="Fill" Value="#D86C00"/>
        </Style>
    </UserControl.Styles>
   
    <DockPanel Classes="Activity">
        
        <DockPanel DockPanel.Dock="Bottom" Classes="ControlBar" Margin="0 15 0 0">
            <Button IsVisible="{Binding IsPaused}"
                    Command="{Binding End}">End</Button>
            <Button IsVisible="{Binding IsRunning}"
                    Command="{Binding Pause}">Pause</Button>
            <Button IsVisible="{Binding IsPaused}"
                    Command="{Binding Resume}">Resume</Button>
            <Button IsVisible="{Binding !IsInProgress}"
                    Command="{Binding Start}">Start</Button>
            <Button IsVisible="{Binding CanClear}"
                    Command="{Binding Clear}">Clear</Button>
            <ProgressBar HorizontalAlignment="Stretch" IsIndeterminate="True" IsVisible="{Binding IsRunning}" Value="{Binding Progress}"/>
        </DockPanel>

        <TabControl Classes="GeneratorTabs" SelectedIndex="{Binding SelectedView}">
            <TabItem Header="INPUT PARAMETERS">
                <Grid ColumnDefinitions="*,25,250" RowDefinitions="24,5,*">
                    <TextBlock Grid.Row="0" Grid.Column="0" Classes="BlockHeader">REAGENTS</TextBlock>
                    
                    <DataGrid Grid.Row="2" Grid.Column="0" Items="{Binding Reagents}"
                              IsReadOnly="{Binding IsInProgress}">
                        <DataGrid.Columns>
                            <DataGridCheckBoxColumn Header="Use"
                                                    Binding="{Binding Enabled}" 
                                                    Width="40" />
                            <DataGridTextColumn Header="Name" 
                                                Binding="{Binding Name}" 
                                                Width="*" />
                            <DataGridTextColumn Header="Cost" 
                                                Binding="{Binding Cost}" 
                                                Width="60" />
                            <DataGridTextColumn Header="Max #" 
                                                Binding="{Binding RecipeMax}" 
                                                Width="50" />
                        </DataGrid.Columns>
                    </DataGrid>
                        <TextBlock Grid.Row="0" Grid.Column="2" Classes="BlockHeader" >ADDITIONAL SETTINGS</TextBlock>
                    
                    <Border Grid.Row="2" Grid.Column="2" Classes="ThinFrame">
                        <Grid DockPanel.Dock="Bottom" ColumnDefinitions="*,10,50,10,20" RowDefinitions="Auto,10,Auto,10,Auto,10,Auto,10,Auto">
                            <TextBlock Grid.Row="0" Grid.Column="0" HorizontalAlignment="Right" VerticalAlignment="Center">Product</TextBlock>

                            <ComboBox Grid.Row="0" Grid.Column="2" Grid.ColumnSpan="3" Width="80" SelectedIndex="{Binding ProductIndex}"
                                      IsEnabled="{Binding !IsInProgress}">
                                <ComboBoxItem Content="Paint" />
                                <ComboBoxItem Content="Ribbons" />
                            </ComboBox>

                            <TextBlock Grid.Row="2" Grid.Column="0" HorizontalAlignment="Right" VerticalAlignment="Center">Max Reagents</TextBlock>
                            <NumericUpDown Grid.Row="2" Grid.Column="2" Minimum="2" Maximum="15" Increment="1"
                                           Value="{Binding MaxReagents}"
                                           IsEnabled="{Binding !IsInProgress}"/>

                            <Border Classes="Help" Grid.Row="2" Grid.Column="4" Width="20" Height="20">
                                <TextBlock FontSize="12">?</TextBlock>
                                <ToolTip.Tip>
                                    <StackPanel Margin="5" Spacing="20" Orientation="Vertical">
                                        <TextBlock Classes="BlockHeader">MAXIMUM REAGENTS</TextBlock>
                                        <TextBlock TextWrapping="Wrap">The maximum number of reagents to try to mix together to produce a color.
                                            
Larger numbers will make it easier to find evasive recipes, but they will also exponentially increase the amount of time it takes the finish the generator process.</TextBlock>
                                    </StackPanel>
                                </ToolTip.Tip>
                            </Border>
                            
                            <TextBlock Grid.Row="4" Grid.Column="0" HorizontalAlignment="Right" VerticalAlignment="Center">Max Concentration</TextBlock>
                            <NumericUpDown Grid.Row="4" Grid.Column="2" Minimum="1" Maximum="{Binding MaxConcentrationMax}" Increment="1"
                                           Value="{Binding MaxConcentration}"
                                           IsEnabled="{Binding !IsInProgress}"/>
                            <Border Classes="Help" Grid.Row="4" Grid.Column="4" Width="20" Height="20">
                                <TextBlock FontSize="12">?</TextBlock>
                                <ToolTip.Tip>
                                    <StackPanel Margin="5" Spacing="20" Orientation="Vertical">
                                        <TextBlock Classes="BlockHeader">MAXIMUM CONCENTRATION</TextBlock>
                                        <TextBlock TextWrapping="Wrap">The maximum deben of paint to add, to attempt to produce a color.
                                            
Larger numbers will make it easier to find evasive recipes, but they will also exponentially increase the amount of time it takes the finish the generator process.</TextBlock>
                                    </StackPanel>
                                </ToolTip.Tip>
                            </Border>  
                            
                            <!-- Commenting these out until we have a better handle on how to describe what they are to users. -->
                            <!--
                            <TextBlock Grid.Row="6" Grid.Column="0" HorizontalAlignment="Right" VerticalAlignment="Center">Full Quantity</TextBlock>
                            <NumericUpDown Grid.Row="6" Grid.Column="2" Minimum="{Binding FullQuantityMax}" Maximum="30" Increment="1" Value="{Binding FullQuantity}" IsEnabled="{Binding !IsInProgress}"/>
                            <Border Classes="Help" Grid.Row="6" Grid.Column="4" Width="20" Height="20">
                                <TextBlock FontSize="12">?</TextBlock>
                                <ToolTip.Tip>
                                    <StackPanel Margin="5" Spacing="20" Orientation="Vertical">
                                        <TextBlock Classes="BlockHeader">FULL QUANTITY</TextBlock>
                                        <TextBlock TextWrapping="Wrap">This is an alternative maximum quantity of a reagent that should be permitted in the mix, if we are below the "Full Quantity Depth" number of unique reagents.</TextBlock>
                                    </StackPanel>
                                </ToolTip.Tip>
                            </Border>  
                            
                            <TextBlock Grid.Row="8" Grid.Column="0" HorizontalAlignment="Right" VerticalAlignment="Center">Full Quantity Depth</TextBlock>
                            <NumericUpDown Grid.Row="8" Grid.Column="2" Minimum="0" Maximum="15" Increment="1" Value="{Binding FullQuantityDepth}" IsEnabled="{Binding !IsInProgress}"/>
                            <Border Classes="Help" Grid.Row="8" Grid.Column="4" Width="20" Height="20">
                                <TextBlock FontSize="12">?</TextBlock>
                                <ToolTip.Tip>
                                    <StackPanel Margin="5" Spacing="20" Orientation="Vertical">
                                        <TextBlock Classes="BlockHeader">FULL QUANTITY DEPTH</TextBlock>
                                        <TextBlock TextWrapping="Wrap">At or below this number of unique reagents, we use this alternative maximum quantity of each reagent, as specified by "Full Quantity."</TextBlock>
                                    </StackPanel>
                                </ToolTip.Tip>
                            </Border>  
                            -->
                            
                        </Grid>
                    
                    </Border>
                    
                </Grid>
                
            </TabItem>
            <TabItem Header="RECIPES">
                <DockPanel>
                    <Grid DockPanel.Dock="Top" ColumnDefinitions="*,*" RowDefinitions="Auto" Margin="0 0 0 5">
                        <TextBlock Classes="BlockHeader">RECIPE LIST</TextBlock>
                        <StackPanel Grid.Column="1" Orientation="Horizontal" Spacing="5" HorizontalAlignment="Right">
                            <TextBlock Text="{Binding PermutationCount}"/>
                            <TextBlock> paint blends tested</TextBlock>
                        </StackPanel>
                    </Grid>

                    <StackPanel DockPanel.Dock="Bottom" Orientation="Vertical" Spacing="5" Margin="0 10 0 0"
                                IsVisible="{Binding MostRecentRecipe, Converter={x:Static ObjectConverters.IsNotNull}}">
                        <TextBlock Classes="BlockHeader">MOST RECENT DISCOVERY</TextBlock>
                        <TextBlock Text="{Binding MostRecentTime}"/>
                        <Border Classes="ThinFrame">
                            <ContentControl Content="{Binding MostRecentRecipe}"/>
                        </Border>
                    </StackPanel>
                    
                    <Border BorderBrush="{DynamicResource ThemeBorderMidBrush}"
                            BorderThickness="{DynamicResource ThemeBorderThickness}">
                        <ScrollViewer Background="{DynamicResource ThemeBackgroundBrush}">
                            <ItemsControl Items="{Binding AllRecipes}"/>
                        </ScrollViewer>
                    </Border>
                </DockPanel>
            </TabItem>
        </TabControl>
    </DockPanel>
</UserControl>