<Window x:Class="Microscopic_Traffic_Simulator.Views.MainWindowView.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"        
        xmlns:mainWindowView="clr-namespace:Microscopic_Traffic_Simulator.Views.MainWindowView"
        xmlns:viewModels="clr-namespace:Microscopic_Traffic_Simulator.ViewModels" 
        xmlns:converters="clr-namespace:Microscopic_Traffic_Simulator.Converters"
        x:Name="mainWindow"
        Tag="{DynamicResource MainWindow_Title}"
        Height="900" 
        Width="1100" Closing="mainWindow_Closing" Loaded="mainWindow_Loaded">
    <Window.Resources>
        <converters:FromBoolToStar x:Key="fromBoolToStart"/>
        <converters:FromUICultureNameToItemChecked x:Key="fromUICultureNameToItemChecked"/>
        <DataTemplate DataType="{x:Type viewModels:ConstructionViewModel}">
            <mainWindowView:ConstructionUserControl/>
        </DataTemplate>
        <DataTemplate DataType="{x:Type viewModels:SimulationControlViewModel}">
            <mainWindowView:SimulationControlUserControl/>
        </DataTemplate>
    </Window.Resources>
    
    <Window.Title>
        <MultiBinding 
            StringFormat="{}{0} - {1}{2}" 
            FallbackValue="Microscopic Traffic Simulatior - *new">
            <Binding ElementName="mainWindow" Path="Tag"></Binding>
            <Binding Path="HasChangesSaved" Converter="{StaticResource fromBoolToStart}">
            </Binding>
            <Binding Path="GeometricTopologyName"></Binding>
        </MultiBinding>
    </Window.Title>

    <Grid>        
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="*"></RowDefinition>
            <RowDefinition Height="Auto"></RowDefinition>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto"></ColumnDefinition>
            <ColumnDefinition Width="*"></ColumnDefinition>
            <ColumnDefinition Width="Auto"></ColumnDefinition>
        </Grid.ColumnDefinitions>
        <Grid.Resources>
            <Style TargetType="Border">
                <Setter Property="BorderBrush" 
                        Value="Gray">                    
                </Setter>
                <Setter Property="BorderThickness" 
                        Value="1">                    
                </Setter>
            </Style>
        </Grid.Resources>
        <!-- MAIN MENU -->
        <Menu IsMainMenu="True">
            <Grid.Row>0</Grid.Row>
            <Grid.Column>0</Grid.Column>
            <Grid.ColumnSpan>3</Grid.ColumnSpan>
            <MenuItem Header="{DynamicResource Menu_File}">
                <MenuItem Header="{DynamicResource Menu_New}"
                          InputGestureText=""                          
                          Command="{Binding Path=NewGeometricTopologyCommand}"
                          CommandParameter="{DynamicResource new}">
                </MenuItem>
                <MenuItem Header="{DynamicResource Menu_Open}"
                          InputGestureText=""
                          Command="{Binding Path=OpenGeometricTopologyCommand}">
                </MenuItem>
                <MenuItem Header="{DynamicResource Menu_Save}"
                          InputGestureText=""
                          Command="{Binding Path=SaveGeometricTopologyCommand}">
                </MenuItem>
                <MenuItem Header="{DynamicResource Menu_Save_As}"
                          InputGestureText=""
                          Command="{Binding Path=SaveGeometricTopologyAsCommand}">
                </MenuItem>
                <Separator></Separator>
                <MenuItem Header="{DynamicResource Menu_Exit}"
                          InputGestureText="Alt+F4"
                          Command="ApplicationCommands.Close">
                </MenuItem>
            </MenuItem>
            <MenuItem Header="{DynamicResource ResourceKey=Menu_Settings}">
                <MenuItem Header="{DynamicResource ResourceKey=Menu_Language}">
                    <MenuItem Header="English"
                              Command="{Binding Path=SwitchLanguageCommand}"                              
                              CommandParameter="en-US"
                              IsChecked="{Binding Path=UICultureName, Mode=OneWay, 
                                Converter={StaticResource fromUICultureNameToItemChecked}, 
                                ConverterParameter=en-US}">
                    </MenuItem>
                    <MenuItem Header="Slovenčina"
                              Command="{Binding Path=SwitchLanguageCommand}"                              
                              CommandParameter="sk-SK"
                              IsChecked="{Binding Path=UICultureName, Mode=OneWay, 
                                Converter={StaticResource fromUICultureNameToItemChecked}, 
                                ConverterParameter=sk-SK}">
                    </MenuItem>
                </MenuItem>
            </MenuItem>
        </Menu>
        <!-- TOP PANEL -->        
        <Border>
            <Grid.Row>1</Grid.Row>
            <Grid.Column>0</Grid.Column>
            <Grid.ColumnSpan>3</Grid.ColumnSpan>
            <ContentControl x:Name="topPanel" Content="{Binding CurrentTopPanelViewModel}"/>
        </Border>
        <!-- LEFT SIDE PANEL -->
        <Border>
            <Grid.Row>2</Grid.Row>
            <Grid.Column>0</Grid.Column>
        </Border>
        <!-- RIGHT SIDE PANEL -->
        <Border>
            <Grid.Row>2</Grid.Row>
            <Grid.Column>2</Grid.Column>    
        </Border>
        <!-- BOTTOM PANEL -->
        <Border>
            <Grid.Row>3</Grid.Row>
            <Grid.Column>0</Grid.Column>
            <Grid.ColumnSpan>3</Grid.ColumnSpan>
            <mainWindowView:BottomPanelUserControl x:Name="bottomPanelUserControl"/>
        </Border>
        <!-- CANVAS -->
        <Border>
            <Grid.Row>2</Grid.Row>
            <Grid.Column>1</Grid.Column>
            <mainWindowView:CanvasUserControl 
                x:Name="canvasUserControl"            
                DataContext="{Binding Path=CanvasViewModel}">                
            </mainWindowView:CanvasUserControl>
        </Border>
    </Grid>
</Window>
