<Page x:Class="AutoDarkModeApp.PageApps"
      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:AutoDarkModeApp"
      xmlns:ui="http://schemas.modernwpf.com/2019"
      xmlns:uc="clr-namespace:AutoDarkModeApp.Controls"
      xmlns:p="clr-namespace:AutoDarkModeLib.Properties;assembly=AutoDarkModeLib"
      xmlns:fw="clr-namespace:SourceChord.FluentWPF;assembly=FluentWPF"
      mc:Ignorable="d"
      d:DesignWidth="650"
      Title="PageApps">
    <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="50" />
        </Grid.RowDefinitions>

        <!-- Header -->
        <TextBlock Margin="0,0,0,0"
                   TextWrapping="Wrap"
                   Text="{x:Static p:Resources.NavbarApps}"
                   Grid.Column="1"
                   Grid.Row="1"
                   FontFamily="Segoe UI Semilight"
                   FontSize="30" />

        <StackPanel Grid.Row="3"
                    Grid.Column="1"
                    Orientation="Vertical">

            <uc:Card Padding="20,15,15,15"
                     Grid.Row="3"
                     Grid.Column="1">
                <!-- Apps -->
                <Grid x:Name="GridApps"
                      Margin="0,0,0,0">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="Auto" />
                    </Grid.ColumnDefinitions>
                    <TextBlock Text="&#xE71D;"
                               Grid.Column="0"
                               HorizontalAlignment="Left"
                               VerticalAlignment="Center"
                               Margin="0,5,15,0"
                               Name="TextBlockApps"
                               FontFamily="Segoe MDL2 Assets"
                               FontSize="25" />
                    <TextBlock HorizontalAlignment="Left"
                               VerticalAlignment="Center"
                               Margin="0,0,0,0"
                               Grid.Column="1"
                               Text="{x:Static p:Resources.lblApps}"
                               FontSize="14"
                               Width="Auto" />
                    <ComboBox HorizontalAlignment="Left"
                              VerticalAlignment="Center"
                              Grid.Column="2"
                              Margin="0,0,0,0"
                              MinWidth="200"
                              Name="AppComboBox"
                              ToolTipService.ShowOnDisabled="True"
                              ToolTipService.InitialShowDelay="3"
                              ToolTipService.HasDropShadow="True"
                              SelectionChanged="AppComboBox_SelectionChanged"
                              MinHeight="30">

                        <ComboBoxItem IsSelected="True"
                                      Content="{x:Static p:Resources.cmbAdjTheme}" />
                        <ComboBoxItem Content="{x:Static p:Resources.cmbAlwWhite}" />
                        <ComboBoxItem Content="{x:Static p:Resources.cmbAlwDark}" />
                        <ComboBoxItem Content="{x:Static p:Resources.disabled}" />

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


            <!-- System -->

            <uc:Card Padding="20,15,15,15"
                     Margin="0,2,0,0">

                <ui:SimpleStackPanel>
                    <Grid x:Name="GridSystem"
                          Margin="0,0,0,0">

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

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


                        <TextBlock Text="&#xE977;"
                                   Grid.Row="0"
                                   Grid.Column="0"
                                   HorizontalAlignment="Left"
                                   VerticalAlignment="Center"
                                   Margin="0,0,15,0"
                                   Name="TextBlockSystem"
                                   FontFamily="Segoe MDL2 Assets"
                                   FontSize="25" />

                        <TextBlock Grid.Row="0"
                                   Grid.Column="1"
                                   HorizontalAlignment="Left"
                                   VerticalAlignment="Top"
                                   Margin="0,5,0,5"
                                   Text="{x:Static p:Resources.lblSystem}"
                                   FontSize="14" />

                        <ComboBox Grid.Row="0"
                                  Grid.Column="2"
                                  HorizontalAlignment="Left"
                                  VerticalAlignment="Center"
                                  Margin="0,0,0,0"
                                  MinWidth="200"
                                  Name="SystemComboBox"
                                  ToolTipService.ShowOnDisabled="True"
                                  ToolTipService.InitialShowDelay="3"
                                  ToolTipService.HasDropShadow="True"
                                  SelectionChanged="SystemComboBox_SelectionChanged"
                                  MinHeight="30">

                            <ComboBoxItem Name="SystemComboBoxItemSwitch"
                                          IsSelected="True"
                                          Content="{x:Static p:Resources.cmbAdjTheme}" />
                            <ComboBoxItem Name="SystemComboBoxItemLightOnly"
                                          Content="{x:Static p:Resources.cmbAlwWhite}" />
                            <ComboBoxItem Name="SystemComboBoxItemDarkOnly"
                                          Content="{x:Static p:Resources.cmbAlwDark}" />
                            <ComboBoxItem Name="SystemComboBoxItemAccentOnly"
                                          Content="{x:Static p:Resources.AppSystemComboBoxItemAccentOnly}" />
                            <ComboBoxItem Name="SystemComboBoxItemDisabled"
                                          Content="{x:Static p:Resources.disabled}" />
                        </ComboBox>
                    </Grid>

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


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


                        <CheckBox Grid.Row="1"
                                  x:Name="AccentColorCheckBox"
                                  Content="{x:Static p:Resources.cmbAccentColor}"
                                  Margin="0,15,0,0"
                                  VerticalAlignment="Top"
                                  Click="AccentColorCheckBox_Click"
                                  ToolTipService.ShowOnDisabled="true"
                                  ToolTipService.InitialShowDelay="3"
                                  ToolTipService.HasDropShadow="True" />

                        <!-- Accent Color Delay -->
                        <DockPanel LastChildFill="False"
                                   Grid.Row="2">
                            <TextBlock x:Name="TextBlockColorDelay"
                                       Margin="0,22,0,0"
                                       Text="{x:Static p:Resources.SettingsAccentColorTimeout}"
                                       FontSize="14" />
                            <ui:NumberBox Grid.Row="3"
                                          x:Name="NumberBoxColorDelay"
                                          Margin="0,15,0,0"
                                          VerticalAlignment="Center"
                                          HorizontalAlignment="Left"
                                          MinWidth="200"
                                          Minimum="0"
                                          Maximum="100000"
                                          SpinButtonPlacementMode="Inline"
                                          SmallChange="100"
                                          DockPanel.Dock="Right"
                                          LargeChange="100"
                                          ValueChanged="NumberBoxColorDelay_ValueChanged" />
                        </DockPanel>

                        <StackPanel Grid.Row="4"
                                    Name="StackPanelAdaptiveTaskbarAccent"
                                    Margin="0,0,0,0"
                                    Orientation="Vertical"
                                    Width="Auto"
                                    Height="Auto">


                            <TextBlock x:Name="TextBlockAdaptiveTaskbarAccent"
                                       Margin="0,15,0,15"
                                       Text="{x:Static p:Resources.AppsTextBlockAdaptiveTaskbarAccent}"
                                       FontSize="14" />

                            <RadioButton Name="RadioButtonAdaptiveTaskbarAccentOnLight"
                                         Content="{x:Static p:Resources.lblLightTheme}"
                                         IsChecked="True"
                                         Margin="30,0,0,0"
                                         Click="RadioButtonAdaptiveTaskbarAccentOnLight_Click" />

                            <RadioButton Name="RadioButtonAdaptiveTaskbarAccentOnDark"
                                         Content="{x:Static p:Resources.lblDarkTheme}"
                                         Margin="30,0,0,0"
                                         Click="RadioButtonAdaptiveTaskbarAccentOnDark_Click" />
                        </StackPanel>


                        <StackPanel Grid.Row="6"
                                    Name="StackPanelDWMPrevalence"
                                    Margin="0,10,0,0"
                                    Orientation="Vertical"
                                    Width="Auto"
                                    Height="Auto">

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

                            <CheckBox Name="CheckBoxDWMPrevalence"
                                      Content="{x:Static p:Resources.AppsCheckBoxDWMPrevalence}"
                                      Margin="0,0,0,0"
                                      VerticalAlignment="Top"
                                      Click="CheckBoxDWMPrevalence_Click" />

                            <StackPanel Name="StackPanelDWMPrevalenceOptions"
                                        Margin="0,5,0,0">
                                <RadioButton Name="RadioButtonDWMPrevalenceOnLight"
                                             Content="{x:Static p:Resources.lblLightTheme}"
                                             IsChecked="True"
                                             Margin="30,0,0,0"
                                             Click="RadioButtonDWMPrevalenceOnLight_Click" />

                                <RadioButton Name="RadioButtonDWMPrevalenceOnDark"
                                             Content="{x:Static p:Resources.lblDarkTheme}"
                                             Margin="30,0,0,0"
                                             Click="RadioButtonDWMPrevalenceOnDark_Click" />
                            </StackPanel>

                        </StackPanel>
                    </Grid>
                </ui:SimpleStackPanel>
            </uc:Card>
            
            <!-- Touch Keyboard -->
            <uc:Card Padding="20,15,15,15" 
                     Margin="0,2,0,0"
                     x:Name="CardTouchKeyboard">

                <Grid x:Name="GridTouchKeyboard"
                      Margin="0,0,0,0">

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

                    <TextBlock Text="&#xE765;"
                               Grid.Column="0"
                               HorizontalAlignment="Left"
                               VerticalAlignment="Center"
                               Margin="0,5,15,0"
                               Name="TextBlockTouchKeyboard"
                               FontFamily="Segoe MDL2 Assets"
                               FontSize="25" />
                    
                    <TextBlock  Grid.Column="1"
                                HorizontalAlignment="Left"                               
                                VerticalAlignment="Center"
                                Margin="0,0,0,0"
                                Text="{x:Static p:Resources.AppsLabelTouchKeyboard}"
                                FontSize="14"
                                Width="Auto" />

                    <ui:ToggleSwitch Name="ToggleTouchkeyboard"
                                     Grid.Column="2"
                                     HorizontalAlignment="Right"
                                     VerticalAlignment="Center"
                                     Margin="0,0,0,0"
                                     MinWidth="200"
                                     OffContent="{x:Static p:Resources.ToggleSwitchOff}"
                                     OnContent="{x:Static p:Resources.ToggleSwitchOn}"
                                     Toggled="ToggleTouchkeyboard_Toggled" />
                </Grid>
            </uc:Card>

            <!-- Color Filter -->
            <uc:Card Padding="20,15,15,15" 
                     Margin="0,2,0,0"
                     x:Name="CardColorFilter">

                <Grid x:Name="GridColorFilter"
                      Margin="0,0,0,0">

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

                    <TextBlock Text="&#xE790;"
                               Grid.Column="0"
                               HorizontalAlignment="Left"
                               VerticalAlignment="Center"
                               Margin="0,5,15,0"
                               FontFamily="Segoe MDL2 Assets"
                               FontSize="25" />

                    <TextBlock  Grid.Column="1"
                                HorizontalAlignment="Left"                               
                                VerticalAlignment="Center"
                                Margin="0,0,0,0"
                                Text="{x:Static p:Resources.cbSettingsColourFilter}"
                                FontSize="14"
                                Width="Auto" />

                    <ui:ToggleSwitch Name="ToggleColorFilter"
                                     Grid.Column="2"
                                     HorizontalAlignment="Right"
                                     VerticalAlignment="Center"
                                     Margin="0,0,0,0"
                                     MinWidth="200"
                                     OffContent="{x:Static p:Resources.ToggleSwitchOff}"
                                     OnContent="{x:Static p:Resources.ToggleSwitchOn}"
                                     Toggled="ToggleColorFilter_Toggled" />
                </Grid>
            </uc:Card>

            <!-- Office-->
            <uc:Card Padding="30,15,15,15" Margin="0,2,0,0">
                <Grid x:Name="GridOffice"
                      Margin="0,0,0,0">

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

                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>
                    
                    <Image HorizontalAlignment="Left"
                           Height="30"
                           Grid.Column="0"
                           Width="25"
                           Margin="-10,0,0,0"
                           VerticalAlignment="Center"
                           Source="/Resources/Office_Logo.png" />
                    
                    <TextBlock Name="TextBlockOfficeLabel"
                               Margin="15,9,0,0"
                               Grid.Column="1"
                               Grid.Row="0"
                               ToolTipService.ShowOnDisabled="True"
                               ToolTipService.InitialShowDelay="3"
                               ToolTipService.HasDropShadow="True"
                               Text="{x:Static p:Resources.lblOffice}"
                               FontSize="14" />

                    <ComboBox x:Name="OfficeComboBox"
                              Margin="15,5,0,0"
                              Grid.Column="2"
                              VerticalAlignment="Center"
                              Grid.Row="0"
                              MinWidth="200"
                              MinHeight="30"
                              SelectionChanged="OfficeComboBox_SelectionChanged">

                        <ComboBoxItem IsSelected="True"
                                      Content="{x:Static p:Resources.cmbAdjTheme}" />
                        <ComboBoxItem Content="{x:Static p:Resources.cmbAlwWhite}" />
                        <ComboBoxItem Content="{x:Static p:Resources.cmbAlwDark}" />
                        <ComboBoxItem Content="{x:Static p:Resources.LabelFollowSystemTheme}" />
                        <ComboBoxItem Content="{x:Static p:Resources.disabled}" />
                    </ComboBox>


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

                    <CheckBox Content="{x:Static p:Resources.cbOfficeWhiteTheme}"
                              x:Name="CheckBoxOfficeWhiteTheme"
                              Grid.Column="0"
                              Margin="-10,5,0,0"
                              Grid.ColumnSpan="2"
                              Grid.Row="2"
                              Click="CheckBoxOfficeWhiteTheme_Click" />
                </Grid>
            </uc:Card>
        </StackPanel>

        <!-- Dark Reader -->
        <TextBlock Text="{x:Static p:Resources.tbAppsTitleRecommendedTools}"
                   Grid.Column="1"
                   Grid.Row="4"
                   VerticalAlignment="Bottom"
                   Margin="0,0,0,120"
                   FontFamily="Segoe UI Semibold"
                   FontSize="14" />

        <TextBlock Text="&#xEA86;"
                   Grid.Column="1"
                   Grid.Row="4"
                   VerticalAlignment="Bottom"
                   Margin="0,100,0,60"
                   FontSize="25"
                   FontFamily="Segoe MDL2 Assets" />
        
        <StackPanel Orientation="Vertical"
                    Grid.Row="4"
                    Grid.Column="1"
                    Margin="40,0,0,0"
                    HorizontalAlignment="Left"
                    VerticalAlignment="Bottom">
            <TextBlock Text="Dark Reader"
                       Margin="0,0,0,0"
                       FontSize="14" />
            <TextBlock Text="{x:Static p:Resources.tbDarkReaderDescription}"
                       Margin="0,4,0,0"
                       TextWrapping="Wrap"
                       Width="350"
                       Grid.Column="1"
                       Grid.Row="1"
                       Foreground="Gray"
                       FontSize="14" />
            <Button Name="ButtonWikiBrowserExtension"
                    Content="{x:Static p:Resources.buttonDownloadExtension}"
                    Grid.Column="1"
                    Grid.Row="1"
                    Margin="0,10,0,0"
                    MinHeight="30"
                    MinWidth="180"
                    Width="Auto"
                    Click="ButtonWikiBrowserExtension_Click" />
        </StackPanel>

        <!-- Recommended Apps -->
        <TextBlock Text="&#xE71D;"
            Grid.Column="1"
            Grid.Row="5"
            VerticalAlignment="Top"
            Margin="0,42,0,0"
            FontSize="25"
            FontFamily="Segoe MDL2 Assets" />

        <StackPanel Orientation="Vertical"
             Grid.Row="5"
             Grid.Column="1"
             Margin="40,0,0,0"
             HorizontalAlignment="Left"
             VerticalAlignment="Top">
            <TextBlock Text="{x:Static p:Resources.RecommendedAppsTitle}"
                Margin="0,25,0,0"
                FontSize="14" />
            <TextBlock Text="{x:Static p:Resources.RecommendedAppsDescription}"
                Margin="0,4,0,0"
                TextWrapping="Wrap"
                Width="350"
                Grid.Column="1"
                Grid.Row="1"
                Foreground="Gray"
                FontSize="14" />
            <Button Name="ButtonRecommendedApps"
             Content="{x:Static p:Resources.RecommendedAppsButton}"
             Grid.Column="1"
             Grid.Row="1"
             Margin="0,10,0,0"
             MinHeight="30"
             MinWidth="320"
             Width="Auto"
             Click="ButtonRecommendedApps_Click" />
        </StackPanel>


    </Grid>
</Page>
