
<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="350" d:DesignHeight="500"
		Width="350" Height="500"
		MaxWidth="350" MaxHeight="500"
        x:Class="VeloeMinecraftLauncher.Views.VersionsDownloader"
        Icon="/Assets/avalonia-logo.ico"
        Title="Versions Downloader"
		TransparencyLevelHint="AcrylicBlur"
		Background="Transparent"
		CanResize="False"
		ExtendClientAreaToDecorationsHint="True"
		ExtendClientAreaChromeHints="NoChrome"
		ExtendClientAreaTitleBarHeightHint="-1"
		Closing="VersionDownloader_Closing">
	
	<Design.DataContext>
		<vm:VersionsDownloaderViewModel/>
	</Design.DataContext>

	<Panel>
		<ExperimentalAcrylicBorder IsHitTestVisible="False">
			<ExperimentalAcrylicBorder.Material>
				<ExperimentalAcrylicMaterial
					BackgroundSource="Digger"
					TintColor="{Binding InterfaceColor}"
					TintOpacity="1"
					MaterialOpacity="{Binding MaterialOpacity}" />
			</ExperimentalAcrylicBorder.Material>
		</ExperimentalAcrylicBorder>
		<DockPanel>
			<titlebars:TitleBarWindow
			  IsSeamless="False"
			  IsIconVisible="False"
			  IsMaximizeVisible="False"
			  TitleText="Versions"
			  DockPanel.Dock="Top">
			</titlebars:TitleBarWindow>
			<TabControl>
				<TabItem Header="Downloader">
					<Grid Margin="10" RowDefinitions="Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,*,Auto,Auto,Auto,Auto">
						<ComboBox
							ItemsSource="{Binding FilteredVersions}"
							PlaceholderText="Select version"
							SelectedItem="{Binding FilteredVersion}"
							IsEnabled="{Binding IsDownloaderTabControlsEnabled}"
							HorizontalAlignment="Stretch"
							Grid.Row="0" Grid.Column="0"/>
						<CheckBox
							IsChecked="{Binding ShowOld}"
							IsEnabled="{Binding IsDownloaderTabControlsEnabled}"
							Margin="0,10,0,0"
							Grid.Row="1" Grid.Column="0"
							Content="Show old"/>
						<CheckBox
							IsChecked="{Binding ShowSnaps}"
							IsEnabled="{Binding IsDownloaderTabControlsEnabled}"
							Margin="0,5,0,0"
							Grid.Row="2" Grid.Column="0"
							Content="Show snapshots"/>
						<CheckBox
							IsChecked="{Binding DownloadJava}"
							IsEnabled="{Binding IsDownloaderTabControlsEnabled}"
							Margin="0,5,0,0"
							Grid.Row="3" Grid.Column="0"
							Content="Download Java"/>
						<CheckBox
							IsChecked="{Binding InstallFabric}"
							IsVisible="{Binding InstallFabricVisible}"
							IsEnabled="{Binding IsDownloaderTabControlsEnabled}"
							Margin="0,5,0,0"
							Grid.Row="4" Grid.Column="0"
							Content="Install Fabric"/>
						<CheckBox
							IsChecked="{Binding InstallForge}"
							IsVisible="{Binding InstallForgeVisible}"
							IsEnabled="{Binding IsDownloaderTabControlsEnabled}"
							Margin="0,5,0,0"
							Grid.Row="5" Grid.Column="0"
							Content="Install Forge"/>
						<CheckBox
							IsChecked="{Binding InstallForgeOptifine}"
							IsVisible="{Binding InstallForgeOptifineVisible}"
							IsEnabled="{Binding IsDownloaderTabControlsEnabled}"
							Margin="0,5,0,0"
							Grid.Row="6" Grid.Column="0"
							Content="Install Optifine (Mod)"/>
						<CheckBox
							IsChecked="{Binding InstallOptifine}"
							IsVisible="{Binding InstallOptifineVisible}"
							IsEnabled="{Binding IsDownloaderTabControlsEnabled}"
							Margin="0,5,0,0"
							Grid.Row="7" Grid.Column="0"
							Content="Install Optifine (Vanilla)"/>
						<Button
							Content="{Binding DownloadButtonText}"
							HorizontalAlignment="Center"
							Command="{Binding OnStartBunttonClick}"
							IsEnabled="{Binding IsDownloaderTabControlsEnabled}"
							Margin="0,10,0,0"
							Grid.Row="9" Grid.Column="0"/>
						<ProgressBar
							Value="{Binding Progress}"
							Maximum="{Binding MaxProgressValue}"
							ShowProgressText="true"
							Margin="0,10,0,0"
							Grid.Row="10" Grid.Column="0"/>
						<TextBlock
							Text="{Binding TasksStatusLine}"
							Margin="0,10,0,0"
							Grid.Row="11" Grid.Column="0"/>
						<TextBlock
							Text="{Binding DownloadingFileName}"
							Grid.Row="12" Grid.Column="0"/>
					</Grid>
				</TabItem>
				<TabItem Header="Manager">
					<Grid Margin="10" RowDefinitions="Auto,*,Auto">
						<ComboBox
							ItemsSource="{Binding DownloadedVersions}"
							PlaceholderText="Select version"
							SelectedItem="{Binding DownloadedVersion}"
							IsEnabled="{Binding IsManagerTabControlsEnabled}"
							HorizontalAlignment="Stretch"
							Grid.Row="0"/>

							<TreeView
								ItemsSource="{Binding DownloadedVersionTree}"
							    IsEnabled="{Binding IsManagerTabControlsEnabled}"
								x:Name="treeView"
								Margin="0,10,0,0"
								Grid.Row="1">
								<TreeView.DataTemplates>
									<TreeDataTemplate DataType="vm:TreeNode" ItemsSource="{Binding SubNode}">
										<StackPanel>
											<TextBlock Text="{Binding Title}"/>
										</StackPanel>
									</TreeDataTemplate>
								</TreeView.DataTemplates>
							</TreeView>
						<Grid ColumnDefinitions="Auto,*" RowDefinitions="Auto" HorizontalAlignment="Center" Grid.Row="2">
							<Button
								Content="Delete"
								HorizontalAlignment="Center"
								Command="{Binding OnDeleteButtonClick}"
								IsEnabled="{Binding IsManagerTabControlsEnabled}"
								Margin="0,10,0,0"
								Grid.Row="0" Grid.Column="0"/>
							<Button
								Content="Open folder"
								HorizontalAlignment="Center"
								Command="{Binding OnOpenForlder}"
								IsEnabled="{Binding IsManagerTabControlsEnabled}"
								Margin="0,10,0,0"
								Grid.Row="0" Grid.Column="1"/>
						</Grid>
					</Grid>
				</TabItem>
			</TabControl>		
		</DockPanel>
	</Panel>
</Window>
