<Window x:Class="StructureHelper.Windows.MainWindow.AnalysesManagerView"
        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:StructureHelper.Windows.MainWindow"
        mc:Ignorable="d"
        d:DataContext="{d:DesignInstance local:AnalysesManagerViewModel}"
        Title="Analyses Manager" Height="450" Width="800" MinHeight="400" MinWidth="600" WindowStartupLocation="CenterScreen">
    <Grid>
        <DockPanel>
            <Menu DockPanel.Dock="Top">
                <MenuItem Header="File" DataContext="{Binding FileLogic}">
                    <MenuItem Header="New" Command="{Binding FileNew}"/>
                    <MenuItem Header="Open" Command="{Binding FileOpen}"/>
                    <MenuItem Header="Save" Command="{Binding FileSave}"/>
                    <MenuItem Header="SaveAs" Command="{Binding FileSaveAs}"/>
                </MenuItem>
            </Menu>
            <ToolBarTray DockPanel.Dock="Top">
                <ToolBar DataContext="{Binding FileLogic}" ToolTip="File">
                    <Button Style="{StaticResource ToolButton}" 
                        Command="{Binding FileOpen}" ToolTip="Open file">
                        <Viewbox>
                            <ContentControl ContentTemplate="{DynamicResource FileOpen}"/>
                        </Viewbox>
                    </Button>
                    <Button Style="{StaticResource ToolButton}" 
                        Command="{Binding FileSave}" ToolTip="Save file">
                        <Viewbox>
                            <ContentControl ContentTemplate="{DynamicResource FileSave}"/>
                        </Viewbox>
                    </Button>
                </ToolBar>
                <ToolBar ToolTip="Diagrams">
                    <Button Style="{StaticResource ToolButton}" Command="{Binding AnalysesLogic.AddGraphEditorCommand}" ToolTip="Diagrams">
                        <Viewbox>
                            <ContentControl ContentTemplate="{DynamicResource Diagrams}"/>
                        </Viewbox>
                    </Button>
                </ToolBar>
                <ToolBar ToolTip="Cross-sections">
                    <Button Style="{DynamicResource ToolButton}" Command="{Binding AnalysesLogic.AddAnalysisCommand}" ToolTip="NDM Analysis">
                        <Viewbox>
                            <ContentControl ContentTemplate="{DynamicResource NdmCrossSection}"/>
                        </Viewbox>
                    </Button>
                </ToolBar>
            </ToolBarTray>
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="auto"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="30"/>
                        <RowDefinition Height="*"/>
                    </Grid.RowDefinitions>
                    <ToolBar HorizontalAlignment="Right">
                        <Button Style="{StaticResource ToolButton24}" Command="{Binding Add}" ToolTip="Select all">
                            <Viewbox Width="24" Height="24">
                                <ContentControl ContentTemplate="{DynamicResource SelectAll}"/>
                            </Viewbox>
                        </Button>
                        <Button Style="{StaticResource ToolButton24}" Command="{Binding Add}" ToolTip="DeSelect all">
                            <Viewbox Width="24" Height="24">
                                <ContentControl ContentTemplate="{DynamicResource DeSelectAll}"/>
                            </Viewbox>
                        </Button>
                        <Button Style="{StaticResource ToolButton24}" Command="{Binding Add}" ToolTip="Inver Selection">
                            <Viewbox Width="24" Height="24">
                                <ContentControl ContentTemplate="{DynamicResource InvertSelection}"/>
                            </Viewbox>
                        </Button>
                    </ToolBar>
                    <ListBox Grid.Row="1" MinWidth="200">

                    </ListBox>
                </Grid>
                <Grid Grid.Column="1" DataContext="{Binding AnalysesLogic}">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="30"/>
                        <RowDefinition Height="*"/>
                    </Grid.RowDefinitions>
                    <ToolBar HorizontalAlignment="Right">
                        <Button Style="{StaticResource ToolButton24}" Command="{Binding RunCommand}" ToolTip="Run Analysis">
                            <Viewbox Width="24" Height="24">
                                <ContentControl ContentTemplate="{DynamicResource RunAnalisis}"/>
                            </Viewbox>
                        </Button>
                        <Button Style="{StaticResource ToolButton24}" Command="{Binding EditCommand}" ToolTip="Edit Analysis">
                            <Viewbox Width="24" Height="24">
                                <ContentControl ContentTemplate="{DynamicResource EditAnalisis}"/>
                            </Viewbox>
                        </Button>
                        <Button Style="{StaticResource ToolButton24}" Command="{Binding DeleteCommand}" ToolTip="Delete Analysis">
                            <Viewbox Width="24" Height="24">
                                <ContentControl ContentTemplate="{DynamicResource DeleteAnalisis}"/>
                            </Viewbox>
                        </Button>
                    </ToolBar>
                    <ListBox Grid.Row="1" ItemsSource="{Binding FilteredAnalyses}" SelectedItem="{Binding SelectedAnalysis}">
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <Grid>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="20"/>
                                        <ColumnDefinition Width="200"/>
                                        <ColumnDefinition Width="20"/>
                                        <ColumnDefinition Width="*"/>
                                    </Grid.ColumnDefinitions>
                                    <TextBlock Grid.Column="1" Text="{Binding Analysis.Name}"/>
                                    <TextBlock Grid.Column="3" Text="{Binding Analysis.Tags}"/>
                                </Grid>
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>
                </Grid>

            </Grid>
        </DockPanel>
    </Grid>
</Window>
