64 lines
4.1 KiB
XML
64 lines
4.1 KiB
XML
<Window x:Class="Life.MainWindow"
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
xmlns:local="clr-namespace:Life"
|
|
xmlns:vm="clr-namespace:Life.ViewModel"
|
|
mc:Ignorable="d"
|
|
Title="MainWindow" Height="450" Width="800" d:DataContext="{d:DesignInstance vm:AutomatonViewModel}">
|
|
<Window.InputBindings>
|
|
<KeyBinding Key="O" Modifiers="Control" Command="{Binding LoadCommand}"/>
|
|
<KeyBinding Key="S" Modifiers="Control" Command="{Binding SaveCommand}"/>
|
|
<KeyBinding Key="N" Modifiers="Control" Command="{Binding ResetCommand}"/>
|
|
</Window.InputBindings>
|
|
<DockPanel>
|
|
<Menu DockPanel.Dock="Top">
|
|
<MenuItem Command="{Binding ResetCommand}" Header="Reset" />
|
|
<MenuItem Command="{Binding LoadCommand}" Header="Load" />
|
|
<MenuItem Command="{Binding SaveCommand}" Header="Save" />
|
|
</Menu>
|
|
<Grid>
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="2*" MinWidth="400"/>
|
|
<ColumnDefinition Width="3"/>
|
|
<ColumnDefinition Width="1*" MinWidth="300" MaxWidth="400"/>
|
|
</Grid.ColumnDefinitions>
|
|
|
|
<ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
|
|
<local:AutomatonField Field="{Binding Field}" Size="{Binding Size}" Separation="3" ClickCommand="{Binding CellClicked}"/>
|
|
</ScrollViewer>
|
|
|
|
<GridSplitter Grid.Column="1" Width="3" ResizeDirection="Columns" ResizeBehavior="PreviousAndNext"/>
|
|
|
|
<StackPanel Orientation="Vertical" Margin="8" Grid.Column="2" HorizontalAlignment="Stretch">
|
|
<DockPanel Style="{StaticResource Setting}">
|
|
<TextBlock Style="{StaticResource Header}" VerticalAlignment="Center">Iteration</TextBlock>
|
|
<TextBlock Style="{StaticResource Value}" Text="{Binding Iteration}" HorizontalAlignment="Stretch"/>
|
|
<Button VerticalAlignment="Stretch" Command="{Binding StepCommand}" CommandParameter="{Binding Steps}" DockPanel.Dock="Right" HorizontalAlignment="Right" Padding="8">step</Button>
|
|
<TextBox Text="{Binding Steps}" VerticalAlignment="Stretch" HorizontalAlignment="Right" DockPanel.Dock="Right" Padding="8" BorderThickness="1 1 0 1"/>
|
|
</DockPanel>
|
|
<DockPanel Style="{StaticResource Setting}">
|
|
<TextBlock Style="{StaticResource Header}" VerticalAlignment="Center" DockPanel.Dock="Left">Size</TextBlock>
|
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch" VerticalAlignment="Center">
|
|
<TextBox Text="{Binding Width, Mode=TwoWay}"/>
|
|
<TextBlock Text=" x "/>
|
|
<TextBox Text="{Binding Height, Mode=TwoWay}"/>
|
|
</StackPanel>
|
|
<Button VerticalAlignment="Center" Command="{Binding ChangeSizeCommand}" DockPanel.Dock="Right" HorizontalAlignment="Right">
|
|
<TextBlock Margin="2">change</TextBlock>
|
|
</Button>
|
|
</DockPanel>
|
|
<DockPanel Style="{StaticResource Setting}">
|
|
<TextBlock Style="{StaticResource Header}" VerticalAlignment="Center" DockPanel.Dock="Left">Cell Size</TextBlock>
|
|
<Slider Minimum="8" Maximum="32" Value="{Binding Size}" VerticalAlignment="Center" />
|
|
</DockPanel>
|
|
<DockPanel Style="{StaticResource Setting}">
|
|
<TextBlock Style="{StaticResource Header}" VerticalAlignment="Center" DockPanel.Dock="Left">Rule (born/survive)</TextBlock>
|
|
<TextBox Text="{Binding Rule, Mode=TwoWay}" HorizontalAlignment="Right" Padding="8"/>
|
|
</DockPanel>
|
|
</StackPanel>
|
|
</Grid>
|
|
</DockPanel>
|
|
</Window>
|