<ui:Page x:Class="AutoDarkModeApp.Pages.PageWallpaperPicker"
         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:ui="http://schemas.modernwpf.com/2019"
         xmlns:p="clr-namespace:AutoDarkModeLib.Properties;assembly=AutoDarkModeLib"
         xmlns:local="clr-namespace:AutoDarkModeApp.Pages"
         xmlns:uc="clr-namespace:AutoDarkModeApp.Controls"
         mc:Ignorable="d"
         d:DesignWidth="470"
         Title="PageWallpaperPicker"
         Loaded="Page_Loaded">

    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="0.4*" />
            <ColumnDefinition Width="10*"
                              MaxWidth="1000"
                              MinWidth="450" />
            <ColumnDefinition Width="0.4*" />
        </Grid.ColumnDefinitions>

        <Grid.RowDefinitions>
            <RowDefinition Height="20" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="20" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <TextBlock Grid.Row="1"
                   Grid.Column="1"
                   Name="TextBlockBackButton"
                   Margin="0,13,0,0"
                   FontFamily="Segoe MDL2 Assets"
                   FontSize="20"
                   Text="&#xe830;"
                   Cursor="Hand"
                   MouseDown="TextBlockBackButton_MouseDown" />

        <TextBlock Grid.Row="1"
                   Grid.Column="1"
                   Margin="35,0,0,0"
                   FontFamily="Segoe UI Semilight"
                   FontSize="30"
                   Text="{x:Static p:Resources.WallpaperTextBlockHeader}" />

        <uc:Card  Padding="30, 15, 15, 15"
                  Grid.Row="3"
                  Grid.Column="1">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>
                <TextBlock Text="{x:Static p:Resources.WallpaperToggleSwitch}"
                           Grid.Column="0"
                           VerticalAlignment="Center" />
                <ui:ToggleSwitch Name="ToggleSwitchWallpaper"
                                 OffContent="{x:Static p:Resources.ToggleSwitchOff}"
                                 OnContent="{x:Static p:Resources.ToggleSwitchOn}"
                                 Margin="0,0,0,0"
                                 Grid.Column="1"
                                 HorizontalAlignment="Right"
                                 VerticalAlignment="Center"
                                 Toggled="ToggleSwitchWallpaper_Toggled" />
            </Grid>
        </uc:Card>

        <uc:Card Grid.Row="4"
                 Grid.Column="1"
                 Padding="30,15,15,15"
                 Margin="0,2,0,0">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>
                <TextBlock Grid.Column="0"
                           Margin="0,0,0,0"
                           VerticalAlignment="Center"
                           FontSize="14"
                           Text="{x:Static p:Resources.WallpaperComboBoxMode}" />

                <ComboBox Name="ComboBoxModeSelection"
                          Grid.Column="1"
                          Margin="0,0,0,0"
                          MinWidth="250"
                          SelectionChanged="ComboBoxModeSelection_SelectionChanged">

                    <ComboBoxItem Content="{x:Static p:Resources.WallpaperComboBoxItemLight}"
                                  Name="ComboBoxModeSelectionLightTheme" />
                    <ComboBoxItem Content="{x:Static p:Resources.WallpaperComboBoxItemDark}"
                                  Name="ComboBoxModeSelectionDarkTheme" />
                </ComboBox>
            </Grid>
        </uc:Card>

        <uc:Card Grid.Row="5"
                 Grid.Column="1"
                 Padding="30,15,15,15"
                 Margin="0,2,0,0">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>
                <TextBlock Grid.Column="0"
                           Margin="0,0,0,0"
                           VerticalAlignment="Center"
                           FontSize="14"
                           Text="{x:Static p:Resources.WallpaperComboBoxType}" />

                <ComboBox Name="ComboBoxWallpaperTypeSelection"
                          VerticalAlignment="Center"
                          Grid.Column="1"
                          Margin="0,0,0,0"
                          MinWidth="250"
                          SelectionChanged="ComboBoxWallpaperTypeSelection_SelectionChanged">

                    <ComboBoxItem Content="{x:Static p:Resources.WallpaperComboBoxItemPicture}"
                                  Name="ComboBoxBackgroundSelectionGlobal" />
                    <ComboBoxItem Content="{x:Static p:Resources.WallpaperComboBoxItemPictureMM}"
                                  Name="ComboBoxBackgroundSelectionIndividual" />
                    <ComboBoxItem Content="{x:Static p:Resources.WallpaperComboBoxItemSolidColor}"
                                  Name="ComboBoxBackgroundSelectionSolidColor" />

                </ComboBox>
            </Grid>
        </uc:Card>

        <uc:Card Grid.Row="6"
                 Grid.Column="1"
                 Padding="30,15,15,15"
                 x:Name="GridMonitorSelect"
                 Margin="0,2,0,0">
            <Grid>

                <Grid.RowDefinitions>
                    <RowDefinition />
                    <RowDefinition />
                </Grid.RowDefinitions>

                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>

                <TextBlock Text="{x:Static p:Resources.WallpaperComboBoxMonitor}"
                           VerticalAlignment="Center"
                           Grid.Row="0"
                           FontSize="14"
                           Grid.Column="0" />

                <ComboBox Name="ComboBoxMonitorSelection"
                          Grid.Column="1"
                          VerticalAlignment="Center"
                          Margin="0,0,0,0"
                          Grid.Row="0"
                          MinWidth="250"
                          SelectionChanged="ComboBoxMonitorSelection_SelectionChanged" />

                <ui:HyperlinkButton Name="CleanMonitorButton"
                                    Content="{x:Static p:Resources.WallpaperHyperLinkRemoveDisconnected}"
                                    Margin="0,10,0,0"
                                    Grid.Row="1"
                                    Grid.ColumnSpan="2"
                                    VerticalAlignment="Center"
                                    Grid.Column="0"
                                    PreviewMouseDown="CleanMonitorButton_PreviewMouseDown"
                                    PreviewKeyDown="CleanMonitorButton_PreviewKeyDown" />

            </Grid>
        </uc:Card>

        <uc:Card Padding="30,15,15,15"
                 Grid.Row="7"
                 Margin="0,2,0,0"
                 Grid.Column="1"
                 x:Name="GridWallpaperPosition">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition />
                    <RowDefinition />
                </Grid.RowDefinitions>

                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>


                <TextBlock Text="{x:Static p:Resources.WallpaperTextBlockPosition}"
                           VerticalAlignment="Center"
                           Grid.Row="0"
                           TextWrapping="Wrap"
                           FontSize="14"
                           Grid.Column="0" />

                <ComboBox Name="ComboBoxWallpaperPositionSelection"
                          VerticalAlignment="Center"
                          Grid.Column="1"
                          Margin="0,0,0,0"
                          MinWidth="250"
                          SelectedIndex="0"
                          SelectionChanged="ComboBoxWallpaperPositionSelection_SelectionChanged">

                    <ComboBoxItem Content="{x:Static p:Resources.WallpaperComboBoxItemFill}"
                                  Name="ComboBoxWallpaperPositionFill" />
                    <ComboBoxItem Content="{x:Static p:Resources.WallpaperComboBoxItemFit}"
                                  Name="ComboBoxWallpaperPositionFit" />
                    <ComboBoxItem Content="{x:Static p:Resources.WallpaperComboBoxItemStretch}"
                                  Name="ComboBoxWallpaperPositionStretch" />

                </ComboBox>

            </Grid>
        </uc:Card>


        <TextBlock Margin="0,30,0,10"
                   Name="WallpaperHeader"
                   Grid.Row="8"
                   Grid.Column="1"
                   FontFamily="Segoe UI Semibold"
                   FontSize="14"
                   Text="{x:Static p:Resources.WallpaperTextBlockHeader}" />


        <uc:Card x:Name="GridWallpaper"
                 Grid.Row="9"
                 Padding="30,15,15,15"
                 Grid.Column="1">
            <Grid Margin="0,0,0,0">

                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>

                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="2*" />
                    <ColumnDefinition Width="9*" />
                </Grid.ColumnDefinitions>


                <Grid Grid.Row="0"
                      Grid.ColumnSpan="3">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="Auto" />
                    </Grid.ColumnDefinitions>

                    <TextBlock Margin="0,0,0,0"
                               Padding="0,0,2,0"
                               FontSize="14"
                               Grid.Column="0"
                               Text="{x:Static p:Resources.WallpaperTextBlockChooseWallpaper}"
                               HorizontalAlignment="Left"
                               VerticalAlignment="Center"
                               TextWrapping="Wrap" />

                    <Button Name="ButtonFilePicker"
                            Grid.Column="1"
                            VerticalAlignment="Center"
                            HorizontalAlignment="Right"
                            Margin="0,0,0,0"
                            MinWidth="140"
                            Content="{x:Static p:Resources.dbFilePicker}"
                            Click="ButtonFilePicker_Click" />
                </Grid>

                <Separator Margin="-30,15,-15,0"
                           Grid.ColumnSpan="2"
                           Grid.Row="2"
                           Background="{DynamicResource Win11Border}" />


                <TextBlock Margin="0,20,0,0"
                           FontSize="14"
                           Grid.Row="3"
                           Grid.Column="0"
                           Text="{x:Static p:Resources.WallpaperTextBlockImagePath}"
                           HorizontalAlignment="Left"
                           TextWrapping="Wrap" />

                <TextBlock Name="TextBlockImagePath"
                           Margin="0,20,0,0"
                           Grid.Column="1"
                           Grid.Row="3"
                           HorizontalAlignment="Right"
                           FontSize="14"
                           TextWrapping="Wrap" />

                <ui:SimpleStackPanel Margin="-5,25,7,5"
                                     Grid.Row="4"
                                     Grid.ColumnSpan="2"
                                     Name="StackPanelImagePreview"
                                     MaxHeight="350"
                                     HorizontalAlignment="Left">
                    <Border BorderThickness="10"
                            CornerRadius="10"
                            BorderBrush="#101010">
                        <Image Name="ImagePreview"
                               Margin="0,0,0,0"
                               MaxHeight="330"
                               Stretch="Uniform"
                               HorizontalAlignment="Left" />
                    </Border>

                </ui:SimpleStackPanel>
            </Grid>
        </uc:Card>

        <ui:SimpleStackPanel x:Name="SolidColorPicker"
                             Grid.Row="10"
                             Grid.Column="1">
            <TextBlock Margin="0,30,0,10"
                       FontFamily="Segoe UI Semibold"
                       FontSize="14"
                       Text="{x:Static p:Resources.WallpaperColor}" />
            <uc:Card Padding="30,10,15,0"
                     Grid.Row="10"
                     Grid.Column="1"
                     Visibility="Visible">
                <Grid Margin="0,0,0,0">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="70" />
                        <ColumnDefinition Width="100" />
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="Auto" />
                    </Grid.ColumnDefinitions>

                    <Rectangle HorizontalAlignment="Left"
                               Name="ColorPreview"
                               Grid.Column="0"
                               Grid.Row="1"
                               Margin="0,0,0,6"
                               Width="50"
                               Height="50"
                               Stroke="Gray"
                               StrokeDashArray="1 2" />
                    <TextBox Text="#"
                             Grid.Column="1"
                             Grid.Row="1"
                             HorizontalAlignment="Left"
                             ui:ControlHelper.Header="{x:Static p:Resources.WallpaperTextBoxHeaderHex}"
                             Width="100"
                             TextChanged="HexColorTextBox_TextChanged"
                             Name="HexColorTextBox"
                             Margin="0,5,0,20"
                             FontSize="14"
                             TextWrapping="Wrap" />

                    <Button Name="ButtonColorSet"
                            Grid.Row="1"
                            Grid.Column="3"
                            Height="33"
                            Margin="20,12,0,0"
                            Width="80"
                            Content="{x:Static p:Resources.offsetButton}"
                            Click="ButtonColorSet_Click" />
                </Grid>
            </uc:Card>
        </ui:SimpleStackPanel>
    </Grid>
</ui:Page>