<UserControl
    x:Class="PDF_Master.Views.HomeContent"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:cus="clr-namespace:PDF_Master.CustomControl"
    xmlns:customControl="clr-namespace:PDF_Master.CustomControl"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:homePanel="clr-namespace:PDF_Master.Views.HomePanel"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:prism="http://prismlibrary.com/"
    xmlns:viewmodels="clr-namespace:PDF_Master.ViewModels"
    d:DataContext="{d:DesignInstance Type=viewmodels:HomeContentViewModel}"
    d:DesignHeight="450"
    d:DesignWidth="800"
    prism:ViewModelLocator.AutoWireViewModel="True"
    AllowDrop="True"
    DragEnter="UserControl_DragEnter"
    DragLeave="UserControl_DragLeave"
    DragOver="UserControl_DragOver"
    Drop="UserControl_Drop"
    mc:Ignorable="d">
    <UserControl.InputBindings>
        <KeyBinding Command="{Binding OpenFileCommand}" Gesture="Ctrl+O" />
        <KeyBinding Command="{Binding CreateBlackPDFCommand}" Gesture="Ctrl+N" />
    </UserControl.InputBindings>
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="../Styles/CustomBtnStyle.xaml" />
            </ResourceDictionary.MergedDictionaries>
            <DataTemplate x:Key="PromotionDataTemplate">
                <StackPanel
                    Margin="0,10,0,10"
                    Background="White"
                    Cursor="Hand"
                    Orientation="Horizontal">
                    <Image
                        Width="16"
                        Height="16"
                        Margin="0,0,10,0"
                        Source="{Binding ImagePath}" />
                    <TextBlock
                        FontSize="14"
                        Foreground="#6B6F7D"
                        Text="{Binding Content}" />
                </StackPanel>
            </DataTemplate>
        </ResourceDictionary>
    </UserControl.Resources>
    <Grid Background="{StaticResource color.sys.layout.mg}">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="270" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        <!--  左侧菜单栏  -->
        <StackPanel>
            <RadioButton
                x:Name="Home"
                Height="64"
                Margin="32,32,32,0"
                Command="{Binding ShowToolCommand}"
                CommandParameter="Guid"
                Foreground="#FFFFFF"
                GroupName="home"
                Style="{StaticResource HomeContentLeftBtn}">
                
                <StackPanel Orientation="Horizontal">
                    <Image
                         Margin="0,0,8,0"
                    Width="28"
                    Height="28"
                    Source="pack://application:,,,/PDF Master;component/Resources/HomeIcon/home.png" />
                    <TextBlock
                        Width="156"
                        Foreground="{StaticResource color.sys.text.neutral.lv1}"
                        FontWeight="DemiBold"
                        VerticalAlignment="Center"
                        FontFamily="Segoe UI"
                        FontSize="16"
                        Text="Home" />
                </StackPanel>
            </RadioButton>
            <RadioButton
                Height="64"
                Margin="32,8,32,0"
                Command="{Binding ShowToolCommand}"
                CommandParameter="ChatGPTAITranslationContent"
                Foreground="#FFFFFF"
                GroupName="home"
                Style="{StaticResource HomeContentLeftBtn}">
                <StackPanel Orientation="Horizontal">
                    <Image
                         Margin="0,0,8,0"
                    Width="28"
                    Height="28"
                    Source="pack://application:,,,/PDF Master;component/Resources/HomeIcon/Translation.png" />
                    <TextBlock
                        Width="156"
                        Foreground="{StaticResource color.sys.text.neutral.lv1}"
                        FontWeight="DemiBold"
                        VerticalAlignment="Center"
                        FontFamily="Segoe UI"
                        FontSize="16"
                        Text="AI Translation" />
                </StackPanel>
            </RadioButton>
            <RadioButton
                Height="64"
                Margin="32,8,32,0"
                Command="{Binding ShowToolCommand}"
                CommandParameter="ChatGPTAIRewritingContent"
                Foreground="#FFFFFF"
                GroupName="home"
                Style="{StaticResource HomeContentLeftBtn}">
                <StackPanel Orientation="Horizontal">
                    <Image
                        Margin="0,0,8,0"
                    Width="28"
                    Height="28"
                    Source="pack://application:,,,/PDF Master;component/Resources/HomeIcon/Rewriting.png" />
                    <TextBlock
                        Width="156"
                        Foreground="{StaticResource color.sys.text.neutral.lv1}"
                        FontWeight="DemiBold"
                        VerticalAlignment="Center"
                        FontFamily="Segoe UI"
                        FontSize="16"
                        Text="AI Rewriting" />
                </StackPanel>
            </RadioButton>
            <RadioButton
                Height="64"
                Margin="32,8,32,0"
                Command="{Binding ShowToolCommand}"
                CommandParameter="ChatGPTAIErrorCorrectionContent"
                Foreground="#FFFFFF"
                GroupName="home"
                Style="{StaticResource HomeContentLeftBtn}">
                <StackPanel Orientation="Horizontal">
                    <Image
                         Margin="0,0,8,0"
                    Width="28"
                    Height="28"
                    Source="pack://application:,,,/PDF Master;component/Resources/HomeIcon/Error_Correction.png" />
                    <TextBlock
                        Width="156"
                        Foreground="{StaticResource color.sys.text.neutral.lv1}"
                        FontWeight="DemiBold"
                        VerticalAlignment="Center"
                        FontFamily="Segoe UI"
                        FontSize="16"
                        Text="AI Error Correction" />
                </StackPanel>
            </RadioButton>
            <Button
                Visibility="Collapsed"
                x:Name="BtnOpenPDF"
                Height="40"
                Margin="32,8,32,0"
                Command="{Binding OpenFileCommand}"
                Foreground="#FFFFFF"
                Style="{StaticResource btn.brand}">
                <StackPanel Orientation="Horizontal">
                    <TextBlock
                        x:Name="TxbOpenPDF"
                        VerticalAlignment="Center"
                        FontFamily="Segoe UI"
                        FontSize="16"
                        Text="{Binding T_OpenFiles}" />
                </StackPanel>
            </Button>

            <Grid Margin="32,16,32,24"  Visibility="Collapsed">
                <Button
                    x:Name="BtnCreatPDF"
                    Height="40"
                    Command="{Binding CreateFromOtherFile}"
                    Content="{Binding T_CreatePDF}"
                    FontSize="16"
                    Initialized="BtnCreatPDF_Initialized"
                    Style="{StaticResource btn.sec}">
                    <Button.ContextMenu>
                        <ContextMenu Name="ContextCreatePDF" Closed="ContextCreatePDF_Closed">
                            <MenuItem Command="{Binding CreateBlackPDFCommand}" Header="{Binding T_CreatePDFToNew}" />
                            <MenuItem
                                Command="{Binding CreateFromHtmlCommnd}"
                                Header="New From Web Page"
                                Visibility="Collapsed" />
                            <MenuItem Command="{Binding CreateFromScanner}" Header="Import From Scanner" />
                        </ContextMenu>
                    </Button.ContextMenu>
                </Button>
                <Button
                    Name="BtnExpand"
                    Width="26"
                    Height="32"
                    Margin="4"
                    HorizontalAlignment="Right"
                    Click="BtnExpand_Click"
                    Style="{StaticResource btn.icon-fill}">
                    <Path
                        Width="12"
                        Height="12"
                        Data="M6 7.56434L2.03039 3.59473L0.969727 4.65539L5.46967 9.15533C5.76256 9.44822 6.23743 9.44822 6.53033 9.15533L11.0303 4.65539L9.9696 3.59473L6 7.56434Z"
                        Fill="{StaticResource color.icon.arrow.gray.def}" />
                </Button>
            </Grid>

            <customControl:CustomIconToggleBtn
                x:Name="BtnGuid"
                Width="216"
                Height="40"
                Margin="0,24,0,0"
                HorizontalContentAlignment="Left"
                Click="ToggleBtnSelect_Click"
                Command="{Binding ShowToolCommand}"
                CommandParameter="Guid"
                Style="{StaticResource ToggleBtnSelectStyle}"
                Tag="GridMode"
                Visibility="Collapsed">
                <StackPanel Margin="8,0,8,0" Orientation="Horizontal">
                    <Path Data="M3.8655 5.79653C3.32363 6.16977 3 6.78565 3 7.44363V15C3 16.1046 3.89543 17 5 17H9V13.1785C9 12.6262 9.44772 12.1785 10 12.1785C10.5523 12.1785 11 12.6262 11 13.1785V17H15C16.1046 17 17 16.1046 17 15V7.44363C17 6.78565 16.6764 6.16977 16.1345 5.79653L11.1345 2.3526C10.4514 1.88206 9.54865 1.88206 8.8655 2.3526L3.8655 5.79653Z" Fill="{Binding ElementName=BtnGuid, Path=Foreground}" />
                    <TextBlock
                        x:Name="TxbHome"
                        Margin="8,0,0,0"
                        VerticalAlignment="Center"
                        FontFamily="SF Pro Text"
                        FontSize="14"
                        Text="Home" />
                </StackPanel>
            </customControl:CustomIconToggleBtn>

            <customControl:CustomIconToggleBtn
                x:Name="BtnTool"
                Width="216"
                Height="40"
                HorizontalContentAlignment="Left"
                Click="ToggleBtnSelect_Click"
                Command="{Binding ShowToolCommand}"
                CommandParameter="Tools"
                Style="{StaticResource ToggleBtnSelectStyle}"
                Tag="GridMode"
                Visibility="Collapsed">
                <StackPanel Margin="8,0,8,0" Orientation="Horizontal">
                    <Path Data="M3.8655 5.79653C3.32363 6.16977 3 6.78565 3 7.44363V15C3 16.1046 3.89543 17 5 17H9V13.1785C9 12.6262 9.44772 12.1785 10 12.1785C10.5523 12.1785 11 12.6262 11 13.1785V17H15C16.1046 17 17 16.1046 17 15V7.44363C17 6.78565 16.6764 6.16977 16.1345 5.79653L11.1345 2.3526C10.4514 1.88206 9.54865 1.88206 8.8655 2.3526L3.8655 5.79653Z" Fill="{Binding ElementName=BtnTool, Path=Foreground}" />
                    <TextBlock
                        x:Name="TxbTool"
                        Margin="8,0,0,0"
                        VerticalAlignment="Center"
                        FontFamily="SF Pro Text"
                        FontSize="14"
                        Text="Tool" />
                </StackPanel>
            </customControl:CustomIconToggleBtn>

            <customControl:CustomIconToggleBtn
                x:Name="BtnCloud"
                Width="216"
                Height="40"
                HorizontalContentAlignment="Left"
                Click="ToggleBtnSelect_Click"
                Command="{Binding ShowToolCommand}"
                CommandParameter="Cloud"
                Style="{StaticResource ToggleBtnSelectStyle}"
                Tag="GridMode"
                Visibility="Collapsed">
                <StackPanel Margin="8,0,8,0" Orientation="Horizontal">
                    <Path Data="M14.95 16.5H5.5C3.01472 16.5 1 14.4853 1 12C1 9.51472 3.01472 7.5 5.5 7.5L5.52018 7.50004C5.74751 4.9771 7.86787 3 10.45 3C13.1838 3 15.4 5.21619 15.4 7.95C15.4 8.10931 15.3925 8.26686 15.3778 8.42232C17.4134 8.63601 19 10.3577 19 12.45C19 14.6701 17.2137 16.4729 15 16.4997V16.5H14.95Z" Fill="{Binding ElementName=BtnCloud, Path=Foreground}" />
                    <TextBlock
                        x:Name="TxbCloud"
                        Margin="8,0,0,0"
                        VerticalAlignment="Center"
                        FontFamily="SF Pro Text"
                        FontSize="14"
                        Text="Cloud" />
                </StackPanel>
            </customControl:CustomIconToggleBtn>

        </StackPanel>
        <homePanel:PromotionContent Grid.Row="1" Visibility="Collapsed" />
        <!--  右侧内容区域  -->
        <ContentControl
            Grid.RowSpan="2"
            Grid.Column="1"
            prism:RegionManager.RegionName="{Binding ToolRegionName}" />
        <cus:LoadingControl
            Grid.RowSpan="2"
            Grid.ColumnSpan="2"
            Visibility="{Binding IsLoading}" />
    </Grid>
</UserControl>