<UserControl
    x:Class="DouYin.DownLoader.Views.Home" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:conv="clr-namespace:ValueConverters;assembly=ValueConverters" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:fl="clr-namespace:FlyleafLib.Controls.WPF;assembly=FlyleafLib"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:md="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:vm="clr-namespace:DouYin.DownLoader.ViewModels"
    d:DataContext="{d:DesignInstance Type=vm:HomeViewModel}"
    d:DesignHeight="680" d:DesignWidth="1080" mc:Ignorable="d">
    <UserControl.Resources>
        <conv:BoolToVisibilityConverter x:Key="IsShowProfileBoolToVisibilityConverter" />
        <Style x:Key="UserProfileLabel" TargetType="Label">
            <Setter Property="FontSize" Value="16" />

            <Setter Property="Foreground" Value="red" />
        </Style>
    </UserControl.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="auto" />
            <RowDefinition Height="auto" />
            <RowDefinition Height="auto" />
            <RowDefinition />
        </Grid.RowDefinitions>
        <DockPanel Margin="0,10">
            <TextBlock
                Width="60" Margin="10,0" VerticalAlignment="Center"
                Text="视频链接" />
            <TextBox
                MinWidth="600" MaxWidth="800" Margin="10,0"
                md:HintAssist.Hint="请输入地址,抖音地址栏中的地址"
                Text="{Binding Url}" />
            <Button
                Width="100" Margin="10,0" HorizontalAlignment="Right"
                Command="{Binding DownloadCommand}"
                Content="下载" />
        </DockPanel>

        <md:Card
            Grid.Row="1" Height="120" Margin="10"
            Visibility="{Binding IsShowProfile, Converter={StaticResource IsShowProfileBoolToVisibilityConverter}}">
            <DockPanel DataContext="{Binding UserProfile}">
                <Image
                    Width="112" Height="112" Margin="5"
                    Source="{Binding AvatorUrl}" />
                <StackPanel
                    Margin="5" VerticalAlignment="Top" Orientation="Vertical">
                    <StackPanel Orientation="Horizontal">
                        <Label
                            VerticalContentAlignment="Center" Content="昵称："
                            Style="{StaticResource UserProfileLabel}" />
                        <Label
                            VerticalContentAlignment="Center" d:Content="xxxx"
                            Content="{Binding NickName}"
                            Style="{StaticResource UserProfileLabel}" />
                        <Label
                            VerticalContentAlignment="Center" Content="关注："
                            Style="{StaticResource UserProfileLabel}" />
                        <Label
                            VerticalContentAlignment="Center" d:Content="47"
                            Content="{Binding FollowingCount}"
                            Style="{StaticResource UserProfileLabel}" />
                        <Label
                            VerticalContentAlignment="Center" Content="粉丝："
                            Style="{StaticResource UserProfileLabel}" />
                        <Label
                            VerticalContentAlignment="Center" d:Content="58888"
                            Content="{Binding FollowerCount}"
                            Style="{StaticResource UserProfileLabel}" />
                        <Label
                            VerticalContentAlignment="Center" Content="获赞："
                            Style="{StaticResource UserProfileLabel}" />
                        <Label
                            VerticalContentAlignment="Center" d:Content="888.25K"
                            Content="{Binding TotalFavoritedCount}"
                            Style="{StaticResource UserProfileLabel}" />
                        <Label
                            VerticalContentAlignment="Center" Content="作品数量："
                            Style="{StaticResource UserProfileLabel}" />
                        <Label
                            VerticalContentAlignment="Center" d:Content="888.25K"
                            Content="{Binding AwemeCount}"
                            Style="{StaticResource UserProfileLabel}" />
                    </StackPanel>
                    <StackPanel Orientation="Horizontal">

                        <Label
                            VerticalContentAlignment="Center" Content="抖音号："
                            Style="{StaticResource UserProfileLabel}" />
                        <Label
                            VerticalContentAlignment="Center" d:Content="47"
                            Content="{Binding UniqueId}"
                            Style="{StaticResource UserProfileLabel}" />

                        <Label
                            VerticalContentAlignment="Center" d:Content="58888"
                            Content="{Binding IPLocation}"
                            Style="{StaticResource UserProfileLabel}" />
                        <Label
                            VerticalContentAlignment="Center" Content="性别："
                            Style="{StaticResource UserProfileLabel}" />
                        <Label
                            VerticalContentAlignment="Center" d:Content="888.25K"
                            Content="{Binding Gender}"
                            Style="{StaticResource UserProfileLabel}" />
                        <Label
                            VerticalContentAlignment="Center" Content="年龄："
                            Style="{StaticResource UserProfileLabel}" />
                        <Label
                            VerticalContentAlignment="Center" d:Content="888.25K"
                            Content="{Binding UserAge}"
                            Style="{StaticResource UserProfileLabel}" />
                        <Label
                            VerticalContentAlignment="Center" Content="国家："
                            Style="{StaticResource UserProfileLabel}" />
                        <Label
                            VerticalContentAlignment="Center" d:Content="888.25K"
                            Content="{Binding Country}"
                            Style="{StaticResource UserProfileLabel}" />
                    </StackPanel>

                </StackPanel>
                <StackPanel
                    Margin="0,5" VerticalAlignment="Top" Orientation="Horizontal">
                    <Label Content="签名：" />
                    <TextBlock
                        MaxWidth="280" d:Text="📷艺术/彩/美学/视觉/治愈 ✨“艺术源于生活，又高于生活"
                        Text="{Binding Signature}"
                        TextWrapping="WrapWithOverflow" />
                </StackPanel>

            </DockPanel>
        </md:Card>
        <Grid Grid.Row="2">
            <DockPanel Grid.Row="1">
                <DockPanel Height="500">
                    <md:Card
                        Width="350" Margin="10,0,0,0" Padding="5"
                        Style="{StaticResource MaterialDesignOutlinedCard}">
                        <Image VerticalAlignment="Top" Source="{Binding DouYin.VideoCover, Mode=TwoWay}" />
                    </md:Card>
                    <md:Card
                        Width="350" Margin="10,0,0,0" Padding="5"
                        Style="{StaticResource MaterialDesignOutlinedCard}">
                        <!--<MediaElement Source="{Binding DouYin.Video, Mode=TwoWay}" />-->
                        <fl:FlyleafHost
                            AttachedDragMove="Both" KeyBindings="Both"
                            Player="{Binding Player, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}" />
                    </md:Card>
                    <md:Card
                        Margin="10,0,10,0" Padding="5"
                        Style="{StaticResource MaterialDesignOutlinedCard}">
                        <StackPanel
                            DockPanel.Dock="Right" FlowDirection="LeftToRight" Orientation="Vertical">
                            <DockPanel Margin="10">
                                <TextBlock
                                    HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="15"
                                    Text="用户昵称：" />
                                <TextBlock
                                    FontWeight="Bold"
                                    Style="{StaticResource DouYinText}"
                                    Text="{Binding DouYin.NikName}" />
                            </DockPanel>
                            <DockPanel Margin="10">
                                <TextBlock
                                    HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="15"
                                    Text="视频名称：" />
                                <TextBlock
                                    FontWeight="Bold"
                                    Style="{StaticResource DouYinText}"
                                    Text="{Binding DouYin.Title}" />
                            </DockPanel>
                            <DockPanel Margin="10">
                                <TextBlock
                                    HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="15"
                                    Text="标签：" />
                                <TextBlock
                                    FontWeight="Bold"
                                    Style="{StaticResource DouYinText}"
                                    Text="{Binding DouYin.VideoTag}" />
                            </DockPanel>
                            <DockPanel Margin="10">
                                <TextBlock
                                    HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="15"
                                    Text="点赞数：" />
                                <TextBlock
                                    FontWeight="Bold"
                                    Style="{StaticResource DouYinText}"
                                    Text="{Binding DouYin.DiggCount, StringFormat='0.## K'}" />
                            </DockPanel>
                            <DockPanel Margin="10">
                                <TextBlock
                                    HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="15"
                                    Text="收藏数：" />
                                <TextBlock
                                    FontWeight="Bold"
                                    Style="{StaticResource DouYinText}"
                                    Text="{Binding DouYin.CollectCount}" />
                            </DockPanel>
                            <DockPanel Margin="10">
                                <TextBlock
                                    HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="15"
                                    Text="分享数：" />
                                <TextBlock
                                    FontWeight="Bold"
                                    Style="{StaticResource DouYinText}"
                                    Text="{Binding DouYin.ShareCount}" />
                            </DockPanel>
                            <DockPanel Margin="10">
                                <TextBlock
                                    HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="15"
                                    Text="评论数：" />
                                <TextBlock
                                    FontWeight="Bold"
                                    Style="{StaticResource DouYinText}"
                                    Text="{Binding DouYin.CommentCount}" />
                            </DockPanel>
                        </StackPanel>
                    </md:Card>
                </DockPanel>
            </DockPanel>
        </Grid>
    </Grid>
</UserControl>
