Click here to Skip to main content
15,886,137 members
Articles / Desktop Programming / WPF

ScanX - A Registry Cleaner

Rate me:
Please Sign up or sign in to vote.
4.95/5 (92 votes)
29 Jan 2012CPOL11 min read 171.5K   12.5K   208  
C#/WPF - ScanX: Creating a commercial quality Registry cleaner.
<UserControl x:Class="ScanX.Panels.ScanResultsPanel"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:local="clr-namespace:ScanX"
             Height="Auto" Width="Auto" 
             HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
             SnapsToDevicePixels="True" Visibility="Collapsed">

    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/Resources/ControlStyles.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="60" />
        </Grid.RowDefinitions>
        <Grid.Resources>
                            
        </Grid.Resources>
        <ListBox ItemsSource="{Binding}" IsSynchronizedWithCurrentItem="True" SelectionMode="Extended"  Grid.Row="0" Name="lstResults" Margin="4"
                 Height="Auto" Width="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" MouseLeftButtonUp="CheckBox_MouseLeftButtonUp">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Border VerticalAlignment="Stretch" HorizontalAlignment="Stretch"
                            BorderThickness="0.5" BorderBrush="#66111199">
                        <Grid Width="Auto">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="80"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>
                            <StackPanel Grid.Row="0" Orientation="Horizontal" Width="Auto" Height="Auto">
                                <CheckBox IsChecked="{Binding Check}" Margin="8,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Center" />
                                <Image Width="40" Height="40" Source="{Binding ImagePath}" Margin="4" />
                            </StackPanel>
                            <StackPanel Grid.Column="1" Margin="2" Height="Auto" Orientation="Vertical">
                                <StackPanel Orientation="Horizontal" HorizontalAlignment="Left">
                                    <TextBlock Text="Importance:" FontSize="12" FontWeight="DemiBold" Margin="2"/>
                                    <ProgressBar Maximum="10" Minimum="1" Value="{Binding Scope}" Width="72" Height="14" Margin="2">
                                        <ProgressBar.Template>
                                            <ControlTemplate>
                                                <Grid>
                                                    <Rectangle Name="PART_Track" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="1" Height="14" Width="66">
                                                        <Rectangle.Fill>
                                                            <ImageBrush ImageSource="..\Images\starsbg.png" Stretch="None" AlignmentX="Left" AlignmentY="Top" />
                                                        </Rectangle.Fill>
                                                    </Rectangle>
                                                    <Rectangle Name="PART_Indicator" HorizontalAlignment="Left" VerticalAlignment="Top"  Margin="1" Height="14">
                                                        <Rectangle.Fill>
                                                            <ImageBrush ImageSource="..\Images\stars.png" Stretch="None" AlignmentX="Left" AlignmentY="Top" />
                                                        </Rectangle.Fill>
                                                    </Rectangle>
                                                </Grid>
                                            </ControlTemplate>
                                        </ProgressBar.Template>
                                    </ProgressBar>
                                    <TextBlock Text="Scan Phase: " FontSize="12" FontWeight="DemiBold" Margin="2"/>
                                    <TextBlock Text="{Binding Name}" FontSize="12" Margin="2,2,0,0"/>
                                    <TextBlock Text="Root Key: " FontSize="12" FontWeight="DemiBold" Margin="12,2,0,0"/>
                                    <TextBlock Text="{Binding Root}" FontSize="12" Margin="2,2,0,0"/>
                                </StackPanel>
                                <StackPanel Orientation="Horizontal" HorizontalAlignment="Left">
                                    <TextBlock Text="SubKey: " FontWeight="DemiBold" Margin="2"/>
                                    <TextBlock Text="{Binding Key}" Margin="2,2,0,0"/>
                                </StackPanel>
                                <StackPanel Orientation="Horizontal" HorizontalAlignment="Left">
                                    <TextBlock Text="Value: " FontWeight="DemiBold" Margin="2"/>
                                    <TextBlock Text="{Binding Value}" Margin="0,2,0,0"/>
                                </StackPanel>
                                <StackPanel Orientation="Horizontal" HorizontalAlignment="Left">
                                    <TextBlock Text="Data: " FontWeight="DemiBold" Margin="2"/>
                                    <TextBlock Text="{Binding Data}" Margin="0,2,0,0"/>
                                </StackPanel>
                            </StackPanel>
                        </Grid>
                    </Border>
                </DataTemplate>
            </ListBox.ItemTemplate>
            <ListBox.ContextMenu>
                <ContextMenu Name="mnuContext">
                    <MenuItem Header="Select Item" Click="MenuItem_Clicked"/>
                    <MenuItem Header="Deselect Item" Click="MenuItem_Clicked"/>
                    <MenuItem Header="Select All" Click="MenuItem_Clicked"/>
                    <MenuItem Header="Deselect All" Click="MenuItem_Clicked"/>
                    <Separator/>
                    <MenuItem Header="Go to Key" Click="MenuItem_Clicked"/>
                    <MenuItem Header="Go to Folder" Click="MenuItem_Clicked"/>
                    <MenuItem Header="Item Details" Click="MenuItem_Clicked"/>
                    <Separator/>
                    <MenuItem Header="Help" Click="MenuItem_Clicked"/>
                </ContextMenu>
            </ListBox.ContextMenu>
        </ListBox>
        <DockPanel Grid.Row="1" Margin="2" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" >
            <Button Name="btnSelectAll" DockPanel.Dock="Left" Click="Start_Clicked" Width="100" Height="30" HorizontalAlignment="Right" Margin="25,2,10,2" Foreground="#FCFCFC" >
                Select All
            </Button>
            <Button Name="btnDeselectAll" DockPanel.Dock="Left" Click="Start_Clicked" Width="100" Height="30" HorizontalAlignment="Right" Margin="2,2,10,2" Foreground="#FCFCFC">
                Deselect All
            </Button>
            <Button Name="btnRemove" DockPanel.Dock="Right" Click="Start_Clicked" Width="140" Height="30" HorizontalAlignment="Right" Margin="2,2,25,2" Foreground="#FCFCFC">
                Remove Selected
            </Button>
        </DockPanel>
    </Grid>
    
</UserControl>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Network Administrator vtdev.com
Canada Canada
Network and programming specialist. Started in C, and have learned about 14 languages since then. Cisco programmer, and lately writing a lot of C# and WPF code, (learning Java too). If I can dream it up, I can probably put it to code. My software company, (VTDev), is on the verge of releasing a couple of very cool things.. keep you posted.

Comments and Discussions