<Page x:Class="Install.View.PgInstall"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
      mc:Ignorable="d" 
      xmlns:local="clr-namespace:Install.View"
      d:DesignHeight="392" d:DesignWidth="596"
	Title="PgInstall" >


    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="auto" />
            <RowDefinition Height="174*" />
            <RowDefinition Height="auto" />
            <RowDefinition Height="auto" />
        </Grid.RowDefinitions>
        <Grid >
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="390*" />
                <ColumnDefinition Width="auto" />
            </Grid.ColumnDefinitions>
            <TextBlock Text="安装项目" Style="{StaticResource h1}" />
            <StackPanel Orientation="Horizontal" Grid.Column="1">
                <Button Margin="5" Command="{Binding DownloadCmd}" Visibility="{Binding InstallWizard.HasNewestInstallZip,Converter={StaticResource visbilityconv}}">
                    <TextBlock Margin="10,2">
                        点击下载 最新版本 v<Run Foreground="Red" FontSize="20" Text="{Binding InstallWizard.NewestInstallZipVersion,Mode=OneWay}"/>
                    </TextBlock>
                </Button>
            </StackPanel>
        </Grid>
        
        <ListBox Margin="5" Name="listBox1" Grid.Row="1" ItemsSource="{Binding Items}">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Grid Margin="3">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="auto"/>
                            <ColumnDefinition/>
                        </Grid.ColumnDefinitions>
                        <CheckBox IsChecked="{Binding IsSelected}" VerticalAlignment="Center" Margin="5"/>
                        <StackPanel Grid.Column="1"  Orientation="Horizontal" DataContext="{Binding Item}">
                            <Image Height="30" Width="30" >
                                <Image.Source>
                                    <MultiBinding Converter="{StaticResource iconConv}">
                                        <Binding Path="ProcessName"/>
                                        <Binding Path="DataContext.Icons" ElementName="listBox1"/>
                                    </MultiBinding>
                                </Image.Source>
                            </Image>
                            <StackPanel Margin="2">
                                <StackPanel Orientation="Horizontal">
                                    <TextBlock Text="{Binding Name}" FontSize="15" Margin="2"/>
                                    <TextBlock Text="{Binding Version}" Foreground="{StaticResource AccentBaseColorBrush}"/>
                                </StackPanel>
                                <TextBlock Text="{Binding ProcessName}" Foreground="{StaticResource GrayBrush4}"/>
                            </StackPanel>
                            <CheckBox IsChecked="{Binding IsAutoRun}" Margin="2" Content="开机启动" VerticalAlignment="Center" />
                        </StackPanel>
                    </Grid>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
        <Grid Grid.Row="2">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="auto" />
                <ColumnDefinition Width="346*" />
                <ColumnDefinition Width="auto" />
            </Grid.ColumnDefinitions>
            <TextBlock FontWeight="Bold" Margin="5" Text="安装路径" />
            <TextBlock Grid.Column="1" Margin="2" Text="{Binding InstallPath}" />
            <!--<Button Grid.Column="2" Content="+" Height="23" Margin="5" Width="40" Command="{Binding SelectPathCmd}" />-->
        </Grid>
        <Grid Style="{StaticResource BottomPanel}" Grid.Row="3" >
            <StackPanel Style="{StaticResource BtnSp}">
                <Button Content="下一步" Style="{StaticResource NormalBtn}" Command="{Binding NextCmd}" />
            </StackPanel>
        </Grid>
    </Grid>
</Page>
