<UserControl
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:tree="clr-namespace:CommonTools.TreeListView.Tree;assembly=CommonTools"
    xmlns:ct="clr-namespace:CommonTools;assembly=CommonTools"
    x:Class="Little_System_Cleaner.Registry_Cleaner.Controls.Start"
    x:Name="UserControl"
    DataContext="{Binding RelativeSource={RelativeSource Self}}"
    MinWidth="579" 
    MinHeight="384" 
    mc:Ignorable="d" Loaded="UserControl_Loaded" Unloaded="UserControl_Unloaded">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="30"  />
            <RowDefinition Height="290*" />
            <RowDefinition Height="50" />
        </Grid.RowDefinitions>

        <Border CornerRadius="5" VerticalAlignment="Top" Grid.Row="0">
            <Border.Effect>
                <DropShadowEffect Color="#FF474747" />
            </Border.Effect>
            <Border.Background>
                <RadialGradientBrush>
                    <GradientStop Color="White" Offset="0"/>
                    <GradientStop Color="Gray" Offset="1"/>
                </RadialGradientBrush>
            </Border.Background>
            <Grid>
                <Label FontSize="14" Margin="8,0,0,0" Foreground="White" HorizontalAlignment="Left">Registry Cleaner</Label>
                <Label FontSize="14" Foreground="White" HorizontalAlignment="Right">Step 1 of 3</Label>
            </Grid>
        </Border>
        <Button Margin="0,5,0,5" Padding="8,0,8,0" Grid.Row="3" Click="buttonScan_Click" HorizontalAlignment="Center">
            <StackPanel Orientation="Horizontal" VerticalAlignment="Center">
                <Image Margin="0,0,5,0" VerticalAlignment="Center" Width="24" Height="24" Source="/Little_System_Cleaner;component/Resources/registry cleaner/scan-registry.png" />
                <TextBlock VerticalAlignment="Center" FontSize="16" Text="Scan Now" TextWrapping="Wrap"/>
			</StackPanel>
        </Button>
        
        <TabControl Grid.Row="1" Margin="0,10,0,0">
            <TabItem Header="Sections">
                <tree:TreeList x:Name="_tree" MinHeight="290" MinWidth="563">
                    <tree:TreeList.View>
                        <GridView AllowsColumnReorder="False">
                            <GridView.Columns>
                                <GridViewColumn Header="Section">
                                    <GridViewColumn.CellTemplate>
                                        <DataTemplate>
                                            <StackPanel Orientation="Horizontal">
                                                <tree:RowExpander/>
                                                <CheckBox IsChecked="{Binding IsChecked}" />
                                                <Image Source="{Binding bMapImg}" Width="16" Height="16" />
                                                <TextBlock Text="{Binding SectionName}" />
                                            </StackPanel>
                                        </DataTemplate>
                                    </GridViewColumn.CellTemplate>
                                </GridViewColumn>
                                <GridViewColumn Header="Description" Width="50" DisplayMemberBinding="{Binding Description}"/>
                            </GridView.Columns>
                        </GridView>
                    </tree:TreeList.View>
                </tree:TreeList>
            </TabItem>
            <TabItem Header="Options">
                <StackPanel>
                    <GroupBox Header="Select a folder to backup deleted registry entries" x:Name="groupBox1" VerticalAlignment="Top">
                        <Grid Margin="5" Height="26">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="483*" />
                                <ColumnDefinition Width="66" />
                            </Grid.ColumnDefinitions>
                            <Button x:Name="buttonBrowseBackupDir" Margin="2,0,0,0" Padding="8,0,8,0" Content="Browse..." Grid.Column="1" Click="buttonBrowseBackupDir_Click" />
                            <TextBox Margin="0,0,1,0" x:Name="textBoxBackups" IsReadOnly="True" Grid.Column="0" VerticalContentAlignment="Center" />
                        </Grid>
                    </GroupBox>
                    <GroupBox Header="Options" x:Name="groupBox3">
                        <StackPanel Margin="5,5,5,5">
                            <CheckBox Name="checkBoxLog" HorizontalAlignment="Left" VerticalAlignment="Top" Click="Option_Click">Log registry scan and repairs</CheckBox>
                            <CheckBox Name="checkBoxShowLog" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,5,0,0" Click="Option_Click">Show log after finished scanning</CheckBox>
                            <CheckBox Name="checkBoxAutoRescan" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,5,0,0" Click="Option_Click">Re-scan after repairing registry issues</CheckBox>
                            <CheckBox Name="checkBoxDelBackup" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,5,0,0" Click="Option_Click">Delete backup file after restoring the registry</CheckBox>
                            <CheckBox Name="checkBoxIgnoreRemMedia" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,5,0,0" Click="Option_Click">Ignore missing files on removable media</CheckBox>
                            <CheckBox Name="checkBoxShowErrors" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,5,0,0" Click="Option_Click">Show error messages from backing up and deleting invalid registry keys</CheckBox>
                            <CheckBox Name="checkBoxDeleteOnBackupError" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,5,0,0" Click="Option_Click">Delete registry keys that couldn't be backed up</CheckBox>
                            <CheckBox Name="checkBoxAutoRepair" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,5,0,0" Click="Option_Click">Automatically repair registry items (not recommended)</CheckBox>
                            <CheckBox Name="checkBoxAutoExit" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,5,0,0" Click="Option_Click">Exit program after repairing registry (not recommended)</CheckBox>
                        </StackPanel>
                    </GroupBox>
                </StackPanel>
            </TabItem>
            <TabItem Header="Ignore List">
                <Grid>
                    <Label Content="Right click to add, edit or remove entries" Height="28" HorizontalContentAlignment="Center"  VerticalAlignment="Top" d:LayoutOverrides="Height"/>
                    <ListView x:Name="listView1" Margin="0,29,0,8" d:LayoutOverrides="GridBox" ItemsSource="{Binding ExcludeArray}">
                        <ListView.ContextMenu>
                            <ContextMenu>
                                <MenuItem x:Name="menuItemAddFile" Header="Add File" Click="menuItemAddFile_Click" />
                                <MenuItem x:Name="menuItemAddFolder" Header="Add Folder" Click="menuItemAddFolder_Click" />
                                <MenuItem x:Name="menuItemAddRegKey" Header="Add Registry Path" Click="menuItemAddRegKey_Click" />
                                <Separator />
                                <MenuItem x:Name="menuItemEdit" Header="Edit Entry" Click="menuItemEdit_Click" />
                                <Separator />
                                <MenuItem x:Name="menuItemRemove" Header="Remove Item" Click="menuItemRemove_Click" />
                            </ContextMenu>
                        </ListView.ContextMenu>
                        <ListView.View>
                            <GridView >
                                <GridViewColumn Header="Registry keys, files, and folders to ignore" Width="250" DisplayMemberBinding="{Binding Item}" />
                            </GridView>
                        </ListView.View>
                    </ListView>
                </Grid>
            </TabItem>
            <TabItem Header="Restore Registry">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="30" />
                        <RowDefinition Height="284*" />
                        <RowDefinition Height="40" />
                    </Grid.RowDefinitions>
                    <Label Height="26" HorizontalAlignment="Center" Grid.Row="0">Select a file below to restore your registry to a previous state</Label>
                    <ListView IsSynchronizedWithCurrentItem="True" Name="listViewFiles" ItemsSource="{Binding RestoreFiles}" SelectionMode="Single" Grid.Row="1">
                        <ListView.View>
                            <GridView AllowsColumnReorder="False">
                                <GridViewColumn Header="File" Width="100" DisplayMemberBinding="{Binding File}" />
                                <GridViewColumn Header="Date" Width="100"  DisplayMemberBinding="{Binding Date}" />
                                <GridViewColumn Header="Size" Width="100"  DisplayMemberBinding="{Binding Size}" />
                            </GridView>
                        </ListView.View>
                    </ListView>
                    <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Height="30" Grid.Row="2">
                        <Button Name="buttonRestore" Click="buttonRestore_Click" Margin="0,0,5,0" Padding="8,0,8,0">
                            <StackPanel Orientation="Horizontal" VerticalAlignment="Center">
                                <Image Margin="0,0,5,0" Source="/Little_System_Cleaner;component/Resources/registry cleaner/restore/restore.png" Width="16" Height="16" VerticalAlignment="Center" />
                                <TextBlock VerticalAlignment="Center">Restore</TextBlock>
                            </StackPanel>
                        </Button>
                        <Button Name="buttonBrowse" Click="buttonBrowse_Click" Margin="0,0,5,0" Padding="8,0,8,0">
                            <StackPanel Orientation="Horizontal" VerticalAlignment="Center">
                                <Image Margin="0,0,5,0" Source="/Little_System_Cleaner;component/Resources/registry cleaner/restore/browse.png" Width="16" Height="16" VerticalAlignment="Center" />
                                <TextBlock VerticalAlignment="Center">Browse Directory</TextBlock>
                            </StackPanel>
                        </Button>
                        <Button Name="buttonRefresh" Click="buttonRefresh_Click" Margin="0,0,5,0"  Padding="8,0,8,0">
                            <StackPanel Orientation="Horizontal" VerticalAlignment="Center">
                                <Image Margin="0,0,5,0" Source="/Little_System_Cleaner;component/Resources/registry cleaner/restore/refresh.png" Width="16" Height="16" VerticalAlignment="Center" />
                                <TextBlock VerticalAlignment="Center">Refresh</TextBlock>
                            </StackPanel>
                        </Button>
                    </StackPanel>
                </Grid>
            </TabItem>
        </TabControl>
        
    </Grid>
</UserControl>
