<Window xmlns="https://github.com/avaloniaui"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:vm="using:VeloeMinecraftLauncher.ViewModels"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
		xmlns:titlebars="using:VeloeMinecraftLauncher.Views.TitleBar"
        mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
		Width="800" Height="450"
		MaxWidth="800" MaxHeight="450"
        x:Class="VeloeMinecraftLauncher.Views.MainWindow"
        Icon="/Assets/avalonia-logo.ico"
        Title="VeloeMinecraftLauncher"
		TransparencyLevelHint="AcrylicBlur"
		Background="Black"
		CanResize="False"
		ExtendClientAreaToDecorationsHint="True"
		ExtendClientAreaChromeHints="NoChrome"
		ExtendClientAreaTitleBarHeightHint="-1">

	<Window.Background>
		<ImageBrush
				Source="avares://VeloeMinecraftLauncher/Assets/background.png"
				Stretch="Fill"
				Opacity="0.9"
				/>
	</Window.Background>
	
    <Design.DataContext>
        <vm:MainWindowViewModel/>
    </Design.DataContext>
	
	<Panel>

		

		<DockPanel>			
			<titlebars:TitleBarWindow
			  IsSeamless="False"
			  IsIconVisible="False"
			  IsMaximizeVisible="False"
			  TitleText="Veloe Minecraft Launcher"
			  DockPanel.Dock="Top"
			  ZIndex="997">
			</titlebars:TitleBarWindow>
			
			<Grid DockPanel.Dock="Left">
				<Grid.RowDefinitions>
					<RowDefinition Height="0"></RowDefinition>
					<RowDefinition Height="*"></RowDefinition>
					<RowDefinition Height="40" ></RowDefinition>
					<RowDefinition Height="0"></RowDefinition>
				</Grid.RowDefinitions>
				<Grid.ColumnDefinitions>
					<ColumnDefinition Width="*"></ColumnDefinition>
				</Grid.ColumnDefinitions>
				<Button
					ZIndex="999"
					Grid.Row="1"
					HorizontalAlignment="Right"
					VerticalAlignment="Top"
					Command="{Binding DownloadUpdate}"
					IsVisible="{Binding IsUpdateAvailable}">
					Update Available
				</Button>
				<TextBlock
					ZIndex="998"
					Grid.Row="1"
					HorizontalAlignment="Right"
					VerticalAlignment="Bottom"
					Text="{Binding StartButtonOutput}"
					Margin="5">
				</TextBlock>
				<TabControl
					Grid.Row="1"
					HorizontalAlignment="Stretch">
					<TabItem
						Header="Servers"
						VerticalContentAlignment="Center">
						<StackPanel
							Name = "ServersStackPanel"
							Orientation="Horizontal"
							HorizontalAlignment="Stretch">
						</StackPanel>						
					</TabItem>
					<TabItem>
						<TabItem.Header>
							<TextBlock VerticalAlignment="Center">Console</TextBlock>
						</TabItem.Header>
						<Panel
							VerticalAlignment="Stretch"
							HorizontalAlignment="Stretch"								
							Margin="0 0 0 5">
							<Border Background="Black" Opacity="0.2" CornerRadius="5" />
							<ScrollViewer
								Name="ConsoleScroll"
								HorizontalScrollBarVisibility="Auto"
								VerticalAlignment="Stretch"
								HorizontalAlignment="Stretch">
								<TextBlock
									Text="{Binding ConsoleText}"
									VerticalAlignment="Stretch"
									Width="760"
									Margin="5,5,5,5"
									TextWrapping="Wrap"
									ScrollViewer.VerticalScrollBarVisibility="Visible"
									MaxLines="99999">
								</TextBlock>
							</ScrollViewer>
						</Panel>
					</TabItem>
					<TabItem>
						<TabItem.Header>
							<TextBlock VerticalAlignment="Center">Changelog</TextBlock>
						</TabItem.Header>
						<Panel
							VerticalAlignment="Stretch"
							HorizontalAlignment="Stretch"
							Margin="0 0 0 5">
							<Border Background="Black" Opacity="0.2" CornerRadius="5" />
							<ScrollViewer
								HorizontalScrollBarVisibility="Auto"
								VerticalAlignment="Stretch"
								HorizontalAlignment="Stretch">
								<StackPanel
									Name="ChangeLogStackPanel"
									Width="760"
									Margin="5,5,5,5">								
								</StackPanel>
							</ScrollViewer>
						</Panel>
					</TabItem>
				</TabControl>
				<StackPanel
					Grid.Row="2"
					Orientation="Horizontal"
					HorizontalAlignment="Center">
					<Button
						Content="{Binding DownloadButton}"
						Command="{Binding OnClickCommand}">
					</Button>
					<Button
						Content="{Binding SettingsButton}"
						Command="{Binding OpenSettings}">
					</Button>
					<TextBlock
						Margin="3">
					</TextBlock>
					<ComboBox
						Items="{Binding DownloadedVersions}"
						PlaceholderText="Select version"
						SelectedItem="Binding DownloadedVersion"
						SelectedIndex="{Binding DownloadedIndex}"
						Width="220"
						VerticalAlignment="Center"
						HorizontalAlignment="Center">
					</ComboBox>
					<TextBlock
						Margin="3">
					</TextBlock>
					<TextBox
						Text="{Binding Username}"
						Watermark="Username"
						MinWidth="190"
						MaxWidth="220"
						VerticalAlignment="Center"
						HorizontalAlignment="Center">
						<TextBox.Styles>
							<Style Selector="DataValidationErrors">
								<Setter Property="Template" Value="{DynamicResource TooltipDataValidationContentTemplate}" />
								<Setter Property="ErrorTemplate" Value="{DynamicResource TooltipDataValidationErrorTemplate}" />
							</Style>
						</TextBox.Styles>
					</TextBox>
					<TextBlock
						Margin="3">
					</TextBlock>
					<Button
						Content="{Binding StartButton}"
						Command="{Binding StartMinecraft}"
						IsEnabled="{Binding IsStartButtonEnabled}">
					</Button>
				</StackPanel>
				<StackPanel Orientation="Horizontal" Grid.Row="2">
					<TextBox Text="{Binding ArgumentsBox}" TextWrapping="Wrap" Width="680" Height="200" IsVisible="false"></TextBox>
					<Button Content="{Binding StartButton}" Command="{Binding StartMinecraftCustom}" IsVisible="false"></Button>
				</StackPanel>
			</Grid>
		</DockPanel>
	</Panel>	
</Window>
