Files
@ 4778889395e8
Branch filter:
Location: ATITD-Tools/Desert-Paint-Codex/Views/RecipeGeneratorView.axaml
4778889395e8
12.1 KiB
text/plain
Change the displayed permeutation count to display using locale-specific number formatting (with comma / dot separators). Fix a crash when starting a new round of recipe generation after recipe generation completed during a previous run.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 | <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>
|