<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"
        xmlns:enums="clr-namespace:StructureHelper.Infrastructure.Enums"
        xmlns:uc="clr-namespace:StructureHelper.Windows.UserControls"
        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}">
                        <Button.ToolTip>
                            <uc:ButtonToolTipEh HeaderText="Open file"
                                                IconContent="{StaticResource FileOpen}"
                                                DescriptionText="Open exsisting project from file"/>
                        </Button.ToolTip>
                        <Viewbox>
                            <ContentControl ContentTemplate="{DynamicResource FileOpen}"/>
                        </Viewbox>
                    </Button>
                    <Button Style="{StaticResource ToolButton}" 
                        Command="{Binding FileSave}">
                        <Button.ToolTip>
                            <uc:ButtonToolTipEh HeaderText="Save file"
                                                IconContent="{StaticResource FileSave}"
                                                DescriptionText="Save project to file"/>
                        </Button.ToolTip>
                        <Viewbox>
                            <ContentControl ContentTemplate="{DynamicResource FileSave}"/>
                        </Viewbox>
                    </Button>
                </ToolBar>
                <ToolBar ToolTip="Diagrams" Visibility="Hidden">
                    <Button Style="{StaticResource ToolButton}" Command="{Binding Add}" ToolTip="Diagrams">
                        <Viewbox>
                            <ContentControl ContentTemplate="{DynamicResource Diagrams}"/>
                        </Viewbox>
                    </Button>
                </ToolBar>
                <ToolBar ToolTip="Types of Analyses">
                    <Button Style="{DynamicResource ToolButton}" Command="{Binding AnalysesLogic.AddAnalysisCommand}" CommandParameter="{x:Static enums:AnalysisTypes.CrossSection}">
                        <Button.ToolTip>
                            <uc:ButtonToolTipEh HeaderText="NDM Cross-Section Analysis"
                                                IconContent="{StaticResource NdmCrossSection}"
                                                DescriptionText="Extended analysis of cross-section of bar elements for strength, strain and cracks"/>
                        </Button.ToolTip>
                        <Viewbox>
                            <ContentControl ContentTemplate="{DynamicResource NdmCrossSection}"/>
                        </Viewbox>
                    </Button>
                    <Button Style="{DynamicResource ToolButton}" Command="{Binding AnalysesLogic.AddAnalysisCommand}" CommandParameter="{x:Static enums:AnalysisTypes.BeamShear}">
                        <Button.ToolTip>
                            <uc:ButtonToolTipEh HeaderText="Beam shear Analysis"
                                                IconContent="{StaticResource BeamShear}"
                                                DescriptionText="Extended analysis of end of reinforced concrete beams for shear strength"/>
                        </Button.ToolTip>
                        <Viewbox>
                            <ContentControl ContentTemplate="{StaticResource BeamShear}"/>
                        </Viewbox>
                    </Button>
                </ToolBar>
                <ToolBar ToolTip="About...">
                        <Button Style="{DynamicResource ToolButton}" Command="{Binding ShowAboutCommand}">
                            <Button.ToolTip>
                                <uc:ButtonToolTipEh HeaderText="About..."
                                                IconContent="{StaticResource GetArea}"
                                                DescriptionText="Shows short details about program"/>
                            </Button.ToolTip>
                            <Viewbox>
                                <ContentControl ContentTemplate="{DynamicResource GetArea}"/>
                            </Viewbox>
                        </Button>
                    </ToolBar>
            </ToolBarTray>
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="0"/>
                    <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="Invert 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>
                        <Button Style="{StaticResource ToolButton24}" Command="{Binding CopyCommand}">
                            <Button.ToolTip>
                                <uc:ButtonToolTipEh HeaderText="Copy Analysis"
                                                IconContent="{StaticResource CopyAnalysis}"
                                                DescriptionText="Creates copy of selected analysis"/>
                            </Button.ToolTip>
                            <Viewbox Width="24" Height="24">
                                <ContentControl ContentTemplate="{DynamicResource CopyAnalysis}"/>
                            </Viewbox>
                        </Button>
                        <Button Style="{StaticResource ToolButton24}" Command="{Binding VersionsCommand}">
                            <Button.ToolTip>
                                <uc:ButtonToolTipEh HeaderText="Show version"
                                                IconContent="{StaticResource AnalysisVersions}"
                                                DescriptionText="Shows window of versions of selected analysis"/>
                            </Button.ToolTip>
                            <Viewbox Width="24" Height="24">
                                <ContentControl ContentTemplate="{DynamicResource AnalysisVersions}"/>
                            </Viewbox>
                        </Button>
                        <Button Style="{StaticResource ToolButton24}" Command="{Binding EditCommand}">
                            <Button.ToolTip>
                                <uc:ButtonToolTipEh HeaderText="Edit Analysis"
                                                IconContent="{StaticResource EditAnalysis}"
                                                DescriptionText="Edit selected analysis"/>
                            </Button.ToolTip>
                            <Viewbox Width="24" Height="24">
                                <ContentControl ContentTemplate="{DynamicResource EditAnalysis}"/>
                            </Viewbox>
                        </Button>
                        <Button Style="{StaticResource ToolButton24}" Command="{Binding DeleteCommand}">
                            <Button.ToolTip>
                                <uc:ButtonToolTipEh HeaderText="Delete Analysis"
                                                IconContent="{StaticResource DeleteEntity }"
                                                DescriptionText="Delete selected analysis"/>
                            </Button.ToolTip>
                            <Viewbox Width="24" Height="24">
                                <ContentControl ContentTemplate="{DynamicResource DeleteEntity}"/>
                            </Viewbox>
                        </Button>
                    </ToolBar>
                    <ToolBar HorizontalAlignment="Right">
                        <Button Style="{StaticResource ToolButton24}" Command="{Binding RunCommand}">
                            <Button.ToolTip>
                                <uc:ButtonToolTipEh HeaderText="Run Analysis"
                                                IconContent="{StaticResource RunAnalysis}"
                                                DescriptionText="Run selected analysis (not available if nothing selected)"/>
                            </Button.ToolTip>
                            <Viewbox Width="24" Height="24">
                                <ContentControl ContentTemplate="{DynamicResource RunAnalysis}"/>
                            </Viewbox>
                        </Button>

                    </ToolBar>
                    <ListBox Grid.Row="1"
                             ItemsSource="{Binding FilteredAnalyses}"
                             SelectedItem="{Binding SelectedAnalysis}"
                             MouseDoubleClick="ListBox_MouseDoubleClick">
                        <ListBox.ContextMenu>
                            <ContextMenu>
                                <MenuItem Header="Run" Command="{Binding RunCommand}" ToolTip="Run selected analysis">
                                    <MenuItem.Icon>
                                        <Viewbox Height="16" Width="16">
                                            <ContentControl ContentTemplate="{StaticResource RunAnalysis}"/>
                                        </Viewbox>
                                    </MenuItem.Icon>
                                </MenuItem>
                                <Separator/>
                                <MenuItem Header="Copy" Command="{Binding CopyCommand}" ToolTip="Create copy of analysis">
                                    <MenuItem.Icon>
                                        <Viewbox Height="16" Width="16">
                                            <ContentControl ContentTemplate="{StaticResource CopyAnalysis}"/>
                                        </Viewbox>
                                    </MenuItem.Icon>
                                </MenuItem>
                                <MenuItem Header="Versions" Command="{Binding VersionsCommand}" ToolTip="Shows all versions of analysis">
                                    <MenuItem.Icon>
                                        <Viewbox Height="16" Width="16">
                                            <ContentControl ContentTemplate="{StaticResource AnalysisVersions}"/>
                                        </Viewbox>
                                    </MenuItem.Icon>
                                </MenuItem>
                                <MenuItem Header="Edit" Command="{Binding EditCommand}" ToolTip="Create copy of analysis">
                                    <MenuItem.Icon>
                                        <Viewbox Height="16" Width="16">
                                            <ContentControl ContentTemplate="{StaticResource EditAnalysis}"/>
                                        </Viewbox>
                                    </MenuItem.Icon>
                                </MenuItem>
                                <MenuItem Header="Delete" Command="{Binding DeleteCommand}" ToolTip="Delete analysis">
                                    <MenuItem.Icon>
                                        <Viewbox Height="16" Width="16">
                                            <ContentControl ContentTemplate="{StaticResource DeleteEntity}"/>
                                        </Viewbox>
                                    </MenuItem.Icon>
                                </MenuItem>
                            </ContextMenu>
                        </ListBox.ContextMenu>
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <Grid>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="20"/>
                                        <ColumnDefinition Width="200"/>
                                        <ColumnDefinition Width="20"/>
                                        <ColumnDefinition Width="100"/>
                                        <ColumnDefinition Width="20"/>
                                        <ColumnDefinition Width="*"/>
                                    </Grid.ColumnDefinitions>
                                    <TextBlock Grid.Column="1" Text="{Binding Analysis.Name}"/>
                                    <TextBlock Grid.Column="3" Text="{Binding Analysis.Tags}"/>
                                    <TextBlock Grid.Column="5" Text="{Binding Analysis.Comment}"/>
                                </Grid>
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>
                </Grid>

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