<Window x:Class="SyncTrayzor.Pages.AboutView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:s="https://github.com/canton7/Stylet"
        xmlns:l="clr-namespace:SyncTrayzor.Localization"
        Height="400" 
        Width="250" MinWidth="250"
        WindowStyle="None" SizeToContent="Height"
        ShowInTaskbar="False"
        FlowDirection="{x:Static l:Localizer.FlowDirection}">
    <Window.Resources>
        <s:BoolToVisibilityConverter x:Key="NoNewVersionVisibility" TrueVisibility="Collapsed" FalseVisibility="Visible"/>
        <Style x:Key="DonateStyle" TargetType="TextBlock">
            <Setter Property="TextAlignment" Value="Center"/>
            <Setter Property="Margin" Value="0,25"/>
            <Setter Property="TextWrapping" Value="Wrap"/>
        </Style>
    </Window.Resources>
    <DockPanel LastChildFill="False" Margin="10">
        <TextBlock DockPanel.Dock="Top" FontWeight="Bold" FontSize="25" HorizontalAlignment="Center" Margin="0,0,0,20">SyncTrayzor</TextBlock>
        <TextBlock DockPanel.Dock="Top" Margin="0,5" Text="{l:Loc AboutView_Version, ValueBinding={Binding Version}}"/>
        <TextBlock DockPanel.Dock="Top" Margin="0,5" Text="{l:Loc AboutView_SyncthingVersion, ValueBinding={Binding SyncthingVersion}}"/>
        <StackPanel DockPanel.Dock="Top" Orientation="Vertical" Margin="0,5"
                    Visibility="{Binding NewerVersion, Converter={x:Static s:BoolToVisibilityConverter.Instance}}">
            <TextBlock Foreground="Red" Text="{l:Loc AboutView_NewAppVersionAvailable, ValueBinding={Binding NewerVersion}}"/>
            <TextBlock>
                <Hyperlink Command="{s:Action DownloadNewerVersion}">
                    <TextBlock Text="{l:Loc AboutView_DownloadNewVersion}"/>
                </Hyperlink>
            </TextBlock>
        </StackPanel>
        <TextBlock DockPanel.Dock="Top" Margin="0,5,0,0" Text="{l:Loc AboutView_CreatedByAuthor}"/>
        <TextBlock DockPanel.Dock="Top" Margin="0,0,0,5" Text="{l:Loc AboutView_ReleasedLicense}"/>

        <Grid DockPanel.Dock="Top">
            <TextBlock Margin="0,5" Text="{l:Loc TranslatorAttributation}" TextWrapping="Wrap"
                       Width="{Binding Parent.ActualWidth, RelativeSource={RelativeSource Self}}"
                       Visibility="{Binding ShowTranslatorAttributation, Converter={x:Static s:BoolToVisibilityConverter.InverseInstance}}"/>
        </Grid>

        <TextBlock DockPanel.Dock="Top"
                   Visibility="{Binding DonationManager.HaveDonated, Converter={x:Static s:BoolToVisibilityConverter.Instance}}"
                   Style="{StaticResource DonateStyle}"
                   Width="{Binding Parent.ActualWidth, RelativeSource={RelativeSource Self}}">
            <TextBlock Text="{l:Loc AboutView_DonateThanks}"/><LineBreak/>
            <Hyperlink s:View.ActionTarget="{Binding DonationManager}" Command="{s:Action Donate}">
                <TextBlock Text="{l:Loc AboutView_DonateAgain_Link}"/>
            </Hyperlink>
        </TextBlock>

        <TextBlock DockPanel.Dock="Top"
                   Visibility="{Binding DonationManager.HaveDonated, Converter={x:Static s:BoolToVisibilityConverter.InverseInstance}}"
                   Style="{StaticResource DonateStyle}"
                   FontSize="14"
                   Width="{Binding Parent.ActualWidth, RelativeSource={RelativeSource Self}}">
            <TextBlock Text="{l:Loc AboutView_Donate_Text}" TextWrapping="Wrap"/><LineBreak/>
            <Hyperlink s:View.ActionTarget="{Binding DonationManager}" Command="{s:Action Donate}">
                <TextBlock Text="{l:Loc AboutView_Donate_Link}"/>
            </Hyperlink>
        </TextBlock>
        
        <TextBlock DockPanel.Dock="Top" Margin="0,5">
            <Hyperlink Command="{s:Action ShowHomepage}">
                <TextBlock Text="{Binding HomepageUrl}"/>
            </Hyperlink>
        </TextBlock>
        
        <TextBlock DockPanel.Dock="Top" Margin="0,5">
            <Hyperlink Command="{s:Action ShowLicenses}">
                <TextBlock Text="{l:Loc AboutView_ShowOtherLicenses}"/>
            </Hyperlink>
        </TextBlock>
        <Button DockPanel.Dock="Bottom" Command="{s:Action Close}" IsDefault="True" IsCancel="True"
                HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0,5,0,0"
                Style="{StaticResource DialogButton}"
                Content="{l:Loc Generic_Dialog_Close}"/>
    </DockPanel>
</Window>
