<UserControl x:Class="Machinations.ProgramControl"
             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:wpf="clr-namespace:Machinations.WPF"
             xmlns:converters="clr-namespace:Machinations.WPF.Converters"
<<<<<<< working copy
             xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
=======
             xmlns:machinations="clr-namespace:Machinations"
>>>>>>> merge rev
             mc:Ignorable="d" 
             DataContext="{Binding RelativeSource={RelativeSource Self}}">
    <UserControl.Resources>
        <BooleanToVisibilityConverter x:Key="BoolToVisConverter" />
        <converters:InverseBoolToVisibilityConverter x:Key="InverseBoolToVisibilityConverter"/>
        <Style TargetType="ToggleButton">
            <Setter Property="Width" Value ="40"/>
            <Setter Property="Height" Value ="40"/>
            <Setter Property="Background" Value ="AliceBlue"/>
            <Setter Property="Margin" Value="1"/>
        </Style>
        <Style TargetType="Button">
            <Setter Property="Background" Value ="AliceBlue"/>
            <Setter Property="Margin" Value="1"/>
        </Style>
    </UserControl.Resources>
    <Grid Height="800" Width="240">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <TabControl Grid.Row="0" Margin="5" MaxHeight="300" MaxWidth="300" Visibility="{Binding Running, Converter={StaticResource InverseBoolToVisibilityConverter}}">
            <TabItem Header="Graph" MinWidth="40" HorizontalAlignment="Center">
<<<<<<< working copy
                <local:GraphControl x:Name="GraphControl"/>
            </TabItem>
            <TabItem Header="Players" MinWidth="40" HorizontalAlignment="Center">
                <Grid>
                   <Grid.RowDefinitions>
                       <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                    </Grid.RowDefinitions>
                    <Grid Grid.Row="0">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="100"/>
                            <ColumnDefinition Width="100"/>
                        </Grid.ColumnDefinitions>
                        <TextBox Text="Enable players" Margin="2"/>
                        <CheckBox Grid.Column="1" IsChecked="{Binding WithPlayers}" Margin="2"/>
                    </Grid>
                    <ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Auto" MaxHeight="230">
                        <ListView ItemsSource="{Binding Players}">
                        <ListView.ItemTemplate>
                            <DataTemplate>
                                <Grid>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="80"/>
                                        <ColumnDefinition Width="100"/>
                                    </Grid.ColumnDefinitions>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="Auto"/>
                                        <RowDefinition Height="Auto"/>
                                        <RowDefinition Height="Auto"/>
                                    </Grid.RowDefinitions>
                                    <TextBlock Text="Name:"/>
                                    <TextBox Grid.Row="0" Grid.Column="1" Text="{Binding Name}"/>
                                    <TextBlock Text="Color:" Grid.Row="1" Grid.Column ="0"/>
                                    <xctk:ColorPicker Grid.Row="1" Grid.Column ="1" SelectedColor="{Binding Color}"/>
                                    <Button Grid.Row ="2" Grid.Column="1" Content="Delete" Tag="{Binding Name}" Click="DeletePlayer"/>
                                </Grid>
                            </DataTemplate>
                        </ListView.ItemTemplate>
                    </ListView>
                    </ScrollViewer>
                    <Button Grid.Row ="2" Content="Create Player" Click="AddPlayer" Margin="50,0"/>
                </Grid>
=======
                <machinations:GraphControl x:Name="GraphControl"/>
>>>>>>> merge rev
            </TabItem>
            <TabItem Header="File" MinWidth="40" HorizontalAlignment="Center">
                <StackPanel>
                    <Button Content="New" Click="Restart_OnClick"/>
                    <Button Content="Open" Click="OpenButtonClick"/>
                    <Button Content="Import" Click="ImportButtonClick"/>
                    <Button Content="Save" Click="SaveButtonClick"/>
                    <Button Content="Export selection"/>
                </StackPanel>
            </TabItem>
            <TabItem Header="Settings" MinWidth="40" HorizontalAlignment="Center">
                <StackPanel Orientation="Vertical">
                    <ToggleButton Content="AutoSave" Width="200" Height="20" IsChecked="{Binding Settings.AutoSave}"/>
                    <Button Content="Change component folder" ToolTip="{Binding Settings.ComponentPath}" Click="ChangeComponentFolder"/>
                </StackPanel>
            </TabItem>
        </TabControl>
        <Grid Grid.Row="1" Visibility="{Binding Running, Converter={StaticResource InverseBoolToVisibilityConverter}}">
            <wpf:UserComponentControlView x:Name="UserComponents" Visibility="{Binding Running, Converter={StaticResource InverseBoolToVisibilityConverter}}"/>
        </Grid>
        <Grid Grid.Row="2" Visibility="{Binding Running, Converter={StaticResource InverseBoolToVisibilityConverter}}">
            <wpf:ComponentsSettings x:Name="ComponentsSettings" Visibility="{Binding Running, Converter={StaticResource InverseBoolToVisibilityConverter}}"/>
        </Grid>
        <Button Name="RunButton" Grid.Row ="3" Content="Start" FontSize="25" Click="RunButtonClick" Height="50" Margin="10" Background="LightGreen"/>
        <Grid Grid.Row="0" Visibility="{Binding Running, Converter={StaticResource BoolToVisConverter}}">
            <wpf:SimulationControl x:Name="MySimulationControl"/>
        </Grid>
    </Grid>
</UserControl>
