<glitonea:WindowEx x:Class="Saradomin.View.Windows.MainWindow"
                   xmlns="https://github.com/avaloniaui"
                   xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                   xmlns:controls="clr-namespace:Saradomin.View.Controls"
                   xmlns:glitonea="clr-namespace:Glitonea.Controls;assembly=Glitonea"
                   xmlns:mvvm="clr-namespace:Glitonea.Mvvm;assembly=Glitonea"
                   xmlns:vm="clr-namespace:Saradomin.ViewModel.Windows"
                   DataContext="{mvvm:DataContextSource vm:MainWindowViewModel}"
                   Title="{Binding Title, Mode=TwoWay}"
                   Width="800"
                   Height="550"
                   Background="{StaticResource WindowBackgroundBrush}"
                   CanResize="False"
                   Icon="avares://Saradomin/Resources/Icons/saradomin.ico"
                   SystemDecorations="None"
                   WindowStartupLocation="CenterScreen">
    <Grid>
        <Grid HorizontalAlignment="Stretch"
              VerticalAlignment="Stretch"
              Background="Black"
              IsVisible="{Binding DimContent}"
              Opacity="0.7"
              ZIndex="99999" />
        <Border BorderBrush="{StaticResource DarkBorderBrush}"
                BorderThickness="2">
            <Grid RowDefinitions="24,*,32">
                <Grid Grid.Row="0"
                      Margin="0,-1,0,0"
                      Background="{StaticResource DarkBackgroundBrush}"
                      ColumnDefinitions="Auto,*,Auto"
                      PointerPressed="TitleBar_MouseDown">

                    <Button Grid.Column="0"
                            Classes="CloseButton"
                            Command="{Binding ExitApplication}"
                            IsVisible="{Binding Launcher.PlaceCloseButtonOnLeft}" />

                    <TextBlock Grid.Column="1"
                               Grid.ColumnSpan="4"
                               HorizontalAlignment="Stretch"
                               VerticalAlignment="Center"
                               FontSize="14"
                               FontWeight="Light"
                               Foreground="{StaticResource AccentBrush}"
                               Text="{Binding Title, Mode=TwoWay}"
                               TextAlignment="Center" />

                    <Button Grid.Column="2"
                            Classes="CloseButton"
                            Command="{Binding ExitApplication}"
                            IsVisible="{Binding !Launcher.PlaceCloseButtonOnLeft}" />
                </Grid>
<!--
                <Grid Grid.Row="1"
                      Margin="0,2,4,0"
                      HorizontalAlignment="Right"
                      VerticalAlignment="Top"
                      ColumnDefinitions="Auto,Auto,Auto,Auto"
                      Grid.ZIndex="1">
                    <Button Grid.Column="0"
                            Classes="OutsideNavigator"
                            Command="{Binding LaunchPage}"
                            CommandParameter="issues"
                            Content="found a bug?"
                            CornerRadius="8,0,0,8" />

                    <Button Grid.Column="1"
                            Classes="OutsideNavigator"
                            Command="{Binding LaunchPage}"
                            CommandParameter="hiscores"
                            Content="hi-scores" />

                    <Button Grid.Column="2"
                            Classes="OutsideNavigator"
                            Command="{Binding LaunchPage}"
                            CommandParameter="discord"
                            Content="discord" />

                    <Button Grid.Column="3"
                            Classes="OutsideNavigator"
                            Command="{Binding LaunchPage}"
                            CommandParameter="forums"
                            Content="forums"
                            CornerRadius="0,8,8,0" />
                </Grid>
-->
                <TabControl Grid.Row="1"
                            Background="Transparent"
                            BorderBrush="{StaticResource DarkBorderBrush}"
                            Padding="0"
                            Classes="PageSelector">
                    <TabItem Width="95"
                             HorizontalContentAlignment="Center"
                             CornerRadius="0,0,0,8"
                             Header="what's new">
                        <Border Margin="4,4,4,0"
                                Background="{StaticResource MediumBackgroundBrush}"
                                BorderBrush="{StaticResource SemiLightMediumBorderBrush}"
                                BorderThickness="1,1,1,0"
                                ClipToBounds="True"
                                CornerRadius="6,6,0,0">
                            <ScrollViewer HorizontalAlignment="Stretch"
                                          Classes="MainViewScrollViewer"
                                          ClipToBounds="True"
                                          HorizontalScrollBarVisibility="Hidden"
                                          VerticalScrollBarVisibility="Visible">
                                <TextBlock Classes="NewsRenderView"
                                           MaxWidth="768"
                                           Inlines="{Binding HtmlInlines}"
                                           HorizontalAlignment="Stretch"
                                           VerticalAlignment="Stretch" 
                                           TextWrapping="Wrap"/>
                            </ScrollViewer>
                        </Border>
                    </TabItem>

                    <TabItem Width="95"
                             HorizontalContentAlignment="Center"
                             CornerRadius="0,0,0,0"
                             Header="settings">
                        <Border Margin="4,4,4,0"
                                Background="{StaticResource MediumBackgroundBrush}"
                                BorderBrush="{StaticResource SemiLightMediumBorderBrush}"
                                BorderThickness="1,1,1,0"
                                CornerRadius="6,6,0,0">
                            <ScrollViewer Classes="MainViewScrollViewer"
                                          HorizontalScrollBarVisibility="Hidden"
                                          VerticalScrollBarVisibility="Visible">
                                <controls:SettingsView VerticalAlignment="Stretch" 
                                                       MaxHeight="500"/>
                            </ScrollViewer>
                        </Border>
                    </TabItem>
                    
                    <!--<TabItem Width="95"
                             HorizontalContentAlignment="Center"
                             CornerRadius="0,0,8,0"
                             Header="singleplayer">
                        <Border Margin="4,4,4,0"
                                Background="{StaticResource MediumBackgroundBrush}"
                                BorderBrush="{StaticResource SemiLightMediumBorderBrush}"
                                BorderThickness="1,1,1,0"
                                CornerRadius="6,6,0,0">
                            <ScrollViewer Classes="MainViewScrollViewer"
                                          HorizontalScrollBarVisibility="Hidden"
                                          VerticalScrollBarVisibility="Visible">
                                <controls:SingleplayerView VerticalAlignment="Stretch" />
                            </ScrollViewer>
                        </Border>
                    </TabItem>-->
                </TabControl>

                <Border Grid.Row="2"
                        Background="Transparent"
                        BorderBrush="{StaticResource DarkMediumBorderBrush}"
                        BorderThickness="0,1,0,0">
                    <Button Width="NaN"
                            Height="NaN"
                            Margin="0"
                            HorizontalAlignment="Stretch"
                            VerticalAlignment="Stretch"
                            Classes="OutsideNavigator"
                            Command="{Binding ExecuteLaunchSequence}"
                            Content="{Binding LaunchText}">
                    </Button>
                </Border>
            </Grid>
        </Border>
    </Grid>
</glitonea:WindowEx>
