<Window xmlns="https://github.com/avaloniaui"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:gif="clr-namespace:Avalonia.Labs.Gif;assembly=Avalonia.Labs.Gif"
        xmlns:local="clr-namespace:Mlaumcherb.Client.Avalonia"
        x:Class="Mlaumcherb.Client.Avalonia.зримое.MainWindow"
        Name="window"
        Title="млаумчерб"
        Icon="avares://млаумчерб/капитал/кубе.ico"
        FontFamily="{StaticResource MonospaceFont}" FontSize="18"
        MinWidth="800" MinHeight="400"
        Width="800" Height="600"
        WindowStartupLocation="CenterScreen">
    <Grid RowDefinitions="* 30">
        <Image Grid.RowSpan="2" Stretch="UniformToFill"
               Source="avares://млаумчерб/капитал/фоне.png"/>
        
        <Grid Grid.Row="0" Margin="10">
            <Grid.ColumnDefinitions>
                <ColumnDefinition MinWidth="150"/>
                <ColumnDefinition Width="2" />
                <ColumnDefinition MinWidth="300"/>
                <ColumnDefinition Width="2" />
                <ColumnDefinition MinWidth="150"/>
            </Grid.ColumnDefinitions>
            
            <GridSplitter Grid.Column="1" Background="Transparent" ResizeDirection="Columns" />
            <GridSplitter Grid.Column="3" Background="Transparent" ResizeDirection="Columns"/>
            
            <!-- Central panel -->
            <Border Grid.Column="2"
                    Classes="dark_tr_bg white_border">
                <Grid>
                    <Grid.RowDefinitions>* 60</Grid.RowDefinitions>
                    <ScrollViewer Grid.Row="0" 
                              HorizontalScrollBarVisibility="Disabled"
                              VerticalScrollBarVisibility="Auto">
                        <StackPanel Margin="10" Spacing="6">
                            <TextBlock>Ник:</TextBlock>
                            <TextBox Background="Transparent"
                                     Text="{Binding #window.PlayerName}"/>
                            
                            <TextBlock>Версия игры:</TextBlock>
                            <ComboBox Name="InstalledVersionCatalogComboBox"/>
                            <Button Name="RescanInstalledVersionsButton" 
                                    Click="RescanInstalledVersionsButton_OnClick"
                                    Classes="button_dark">
                                Обновить список
                            </Button>
                            <Button Name="DeleteVersionButton" 
                                    Click="DeleteVersionButton_OnClick"
                                    Classes="button_dark">
                                Удалить версию
                            </Button>
                            
                            <Expander Header="Добавление версий"
                                      BorderThickness="1" BorderBrush="Gray"
                                      Padding="4">
                                <StackPanel Spacing="6">
                                    <TextBlock>Источник:</TextBlock>
                                    <ComboBox Name="RemoteVersionCatalogComboBox"/>
                                    <WrapPanel>
                                        <CheckBox Name="ReleaseVersionTypeCheckBox" IsChecked="True">релиз</CheckBox>
                                        <CheckBox Name="SnapshotVersionTypeCheckBox">снапшот</CheckBox>
                                        <CheckBox Name="OldVersionTypeCheckBox">старое</CheckBox>
                                        <CheckBox Name="OtherVersionTypeAlphaCheckBox">другое</CheckBox>
                                    </WrapPanel>
                                    <Button Name="SearchVersionsButton"
                                            Click="SearchVersionsButton_OnClick"
                                            Classes="button_dark">
                                        Поиск
                                    </Button>
                                    <TextBlock>Доступные версии:</TextBlock>
                                    <ComboBox Name="RemoteVersionCatalogItemsComboBox"/>
                                    <Button Name="AddVersionButton" IsEnabled="False"
                                        Click="AddVersionButton_OnClick"
                                        Classes="button_dark">
                                        Добавить
                                    </Button>
                                </StackPanel>
                            </Expander>
                            
                            <TextBlock>
                                <Run>Выделенная память:</Run>
                                <TextBox Background="Transparent" Padding="0"
                                         BorderThickness="1"
                                         BorderBrush="#777777"
                                         Text="{Binding #window.MemoryLimit}">
                                </TextBox>
                                <Run>Мб</Run>
                            </TextBlock>
                            <Slider Minimum="2048" Maximum="8192"
                                    Value="{Binding #window.MemoryLimit}">
                            </Slider>
                            
                            <CheckBox IsChecked="{Binding #window.UpdateGameFiles}">
                                Обновить файлы игры
                            </CheckBox>
                            <CheckBox IsChecked="{Binding #window.EnableJavaDownload}">
                                Скачивать джаву
                            </CheckBox>
                            <CheckBox IsChecked="{Binding #window.RedirectGameOutput}">
                                Выводить лог игры в лаунчер
                            </CheckBox>
                        </StackPanel>
                    </ScrollViewer>
                    <Button Name="LaunchButton" Grid.Row="1"
                            Margin="10" Padding="4"
                            Classes="button_no_border"
                            Background="#BBfd7300"
                            Click="Запуск">
                        Запуск
                    </Button>
                </Grid>
            </Border>
            
            <!-- Left panel -->
            <Border Grid.Column="0"
                    Classes="dark_tr_bg white_border">
                <Grid RowDefinitions="36 *">
                    <Border Classes="white_border" Margin="-1" Padding="4">
                        <DockPanel>
                            <TextBlock FontWeight="Bold"
                                       DockPanel.Dock="Left">
                                Лог
                            </TextBlock>
                            <Button Click="ClearLogPanel"
                                    Classes="menu_button"
                                    DockPanel.Dock="Right"
                                    HorizontalAlignment="Right">
                                очистить
                            </Button>
                        </DockPanel>
                    </Border>
                    <ScrollViewer Name="LogScrollViewer" Grid.Row="1" 
                                  HorizontalScrollBarVisibility="Disabled"
                                  VerticalScrollBarVisibility="Visible"
                                  Background="Transparent">
                        <StackPanel Name="LogPanel" 
                                    VerticalAlignment="Top"/>
                    </ScrollViewer>
                </Grid>
            </Border>
            
            <!-- Right panel -->
            <Border Grid.Column="4"
                    Classes="dark_tr_bg white_border">
                <Grid RowDefinitions="36 *">
                    <Border Classes="white_border" Margin="-1" Padding="4">
                        <DockPanel>
                            <TextBlock FontWeight="Bold"
                                       DockPanel.Dock="Left">
                                Загрузки
                            </TextBlock>
                            <Button Click="ClearDownloadsPanel"
                                    Classes="menu_button"
                                    DockPanel.Dock="Right"
                                    HorizontalAlignment="Right">
                                очистить
                            </Button>
                        </DockPanel>
                    </Border>
                    <ScrollViewer Grid.Row="1" 
                                  HorizontalScrollBarVisibility="Disabled"
                                  VerticalScrollBarVisibility="Visible"
                                  Background="Transparent" 
                                  Padding="1">
                        <StackPanel Name="DownloadsPanel" 
                                    VerticalAlignment="Top"/>    
                    </ScrollViewer>
                </Grid>
            </Border>
        </Grid>
        <Border Grid.Row="1" Background="#954808B0">
            <Grid>
                <StackPanel Orientation="Horizontal" HorizontalAlignment="Left">
                    <Button Classes="menu_button button_no_border" Click="ОткрытьПапкуЛаунчера">папка лаунчера</Button>
                    <Border Classes="menu_separator"/>
                    <Button Classes="menu_button button_no_border" Click="ОткрытьФайлЛогов">лог-файл</Button>
                </StackPanel>
                <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
                    <Button Classes="menu_button button_no_border" Click="ОткрытьРепозиторий">исходный код</Button>
                    <gif:GifImage 
                        Width="30" Height="30" Stretch="Uniform"
                        Source="avares://млаумчерб/капитал/лисик.gif"/>
                </StackPanel>
            </Grid>
        </Border>
    </Grid>
</Window>
