<Page x:Class="Update.View.PgUpdate"
      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" 
      xmlns:local="clr-namespace:Update.View"
      mc:Ignorable="d" 
      d:DesignHeight="450" d:DesignWidth="800"
      Title="PgUpdate">
    <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>
            <StackPanel Orientation="Horizontal">
                <TextBlock Style="{StaticResource h1}">
                    当前版本号: v<Run Text="{Binding InstallWizard.CurrentInstallZipVersion,Mode=OneWay}"/>
                </TextBlock>
                <TextBlock Margin="10,2"
                    VerticalAlignment="Center"
                    Visibility="{Binding InstallWizard.HasNewestInstallZip,Converter={StaticResource visbilityconv},ConverterParameter=HiddenWhenTrue}"
                    Foreground="Red" FontSize="20" 
                    Text="(已经为最新版本)" />
            </StackPanel>
            <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">
                        <StackPanel 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>
                            <TextBlock VerticalAlignment="Center" Margin="2" 
                                       Visibility="{Binding IsAutoRun,Converter={StaticResource visbilityconv}}"
                                       Text="开机启动" />
                        </StackPanel>
                    </Grid>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
    </Grid>
</Page>