Click here to Skip to main content
12,299,775 members (59,938 online)
Click here to Skip to main content

Stats

72.7K views
3K downloads
121 bookmarked
Posted

WPF Book Reader

, 10 May 2012 GPL3
A WPF book reader for cbz/cbr files
BookReader.exe.manifest
ICSharpCode.SharpZipLib.dll
SevenZipSharp.dll
WPFToolkit.dll
Dependencies
7z.dll
BookReader.application
BookReader.exe
BookReader
ClassDiagram.cd
Dependencies
7-zip.dll
7z.dll
ICSharpCode.SharpZipLib.dll
SevenZipSharp.dll
WPFToolkit.dll
Properties
app.manifest
Reader
Catalog
Common
Images
RAR
ZIP
Resources
TheRedPushPin.png
XAML
BookReader.application
BookReader.exe
BookReader.exe.manifest
7z.dll
SevenZipSharp.dll
WPFToolkit.dll
Release
BookReader.application
BookReader.exe
BookReader.exe.manifest
Dependencies
7z.dll
pdftohtml.exe
SevenZipSharp.dll
WPFToolkit.dll
BookReader.csproj.user
BookReader.csproj.vspscc
7z.dll
pdftohtml.exe
SevenZipSharp.dll
WPFToolkit.dll
app.manifest
acroread.png
document.png
ecran.png
exit.png
FitHeight.png
FitWidth.png
info.png
open_folder.png
refresh.png
Search.png
Theme
TheRedPushPin.png
tools.png
BookReader.csproj.user
ClassDiagram.cd
7-zip.dll
7z.dll
ICSharpCode.SharpZipLib.dll
SevenZipSharp.dll
WPFToolkit.dll
app.manifest
TheRedPushPin.png
BookReader.application
BookReader.exe
BookReader.exe.manifest
BookReader.vshost.exe
7z.dll
pdftohtml.exe
SevenZipSharp.dll
WPFToolkit.dll
BookReader.csproj.user
BookReader.csproj.vspscc
7z.dll
pdftohtml.exe
SevenZipSharp.dll
WPFToolkit.dll
app.manifest
acroread.png
book.ico
document.png
ecran.png
exit.png
FitHeight.png
FitWidth.png
info.png
open_folder.png
refresh.png
Search.png
TheRedPushPin.png
tools.png
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:BookReader" >
    
    <local:BookmarkToVisibilityConverter x:Key="BookmarkToVisibilityConverter"/>
    
    <!-- TOOLTIP style and associated datatemplate -->
    <Style x:Key="TransparentToolTipStyle" TargetType="{x:Type ToolTip}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ToolTip}">
                    <Border >
                        <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <DataTemplate x:Key="MetadataTemplate" DataType="{x:Type local:BaseBook}">
        <Grid >
            <Grid.Resources>
                <Style TargetType="{x:Type TextBlock}" x:Key="TextBlockBase">
                    <Setter Property="Foreground" Value="Silver"/>
                </Style>
                <Style TargetType="{x:Type TextBlock}" x:Key="{x:Type TextBlock}" BasedOn="{StaticResource TextBlockBase}">
                </Style>
                <Style TargetType="{x:Type TextBlock}" x:Key="Data" BasedOn="{StaticResource TextBlockBase}">
                    <Setter Property="Foreground" Value="White"/>
                    <Setter Property="FontWeight" Value="Bold"/>
                </Style>
            </Grid.Resources>
            <Border Padding="2,2,2,2" CornerRadius="8" BorderBrush="#40000000" BorderThickness="2">
                <Border CornerRadius="6" ClipToBounds="True" Padding="6,6,6,6">
                    <Border.Background>
                        <LinearGradientBrush EndPoint="0.75,0.319" StartPoint="0.213,0.672">
                            <GradientStop Color="#99000000"/>
                            <GradientStop Color="#EA000000" Offset="1"/>
                        </LinearGradientBrush>
                    </Border.Background>
					<Grid>
						<Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="80"/>
                                    <ColumnDefinition Width="Auto"/>
                                </Grid.ColumnDefinitions>
                                <Grid.RowDefinitions>
                                    <RowDefinition />
                                    <RowDefinition />
									<RowDefinition />
                                </Grid.RowDefinitions>
								<TextBlock Grid.Column="1" Grid.Row="0" Text="{Binding Path=FileName}" FontSize="14" DockPanel.Dock="Left" Style="{StaticResource Data}" />
								<TextBlock Grid.Column="1" Grid.Row="1" Text="{Binding Path=FilePath}" />
								<Image Grid.Column="0" Grid.RowSpan="3" Source="{Binding Path=Cover}" Width="70"/>
								<Grid Grid.Column="1" Grid.Row="2">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto"/>
                                    <ColumnDefinition Width="12" />
                                    <ColumnDefinition Width="Auto"/>
                                </Grid.ColumnDefinitions>
                                <Grid.RowDefinitions>
                                    <RowDefinition />
                                    <RowDefinition />
                                </Grid.RowDefinitions>
                                <TextBlock Grid.Column="0" Grid.Row="0" Text="File size:" />
                                <TextBlock Grid.Column="2" Grid.Row="0" Text="{Binding Path=Size}"  Style="{StaticResource Data}"/>
                                <TextBlock Grid.Column="0" Grid.Row="1" Text="Page count:" />
                                <TextBlock Grid.Column="2" Grid.Row="1" Text="{Binding Path=NbPages}"  Style="{StaticResource Data}"/>
                            </Grid>
					</Grid>
                </Border>
            </Border>
        </Grid>
    </DataTemplate>
    <!-- END TOOLTIP -->
    
    <!-- CATALOG style and associated datatemplate -->
    <Style x:Key="CatalogCoverStyle" TargetType="{x:Type ListBox}">
        <!-- Swap out the default items panel with a WrapPanel so that
           the images will be arranged with a different layout. -->
        <Setter Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <WrapPanel />
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>
        <!-- Set this attached property to 'Disabled' so that the 
           ScrollViewer in the ListBox will never show a horizontal 
           scrollbar, and the WrapPanel it contains will be constrained 
           to the width of the ScrollViewer's viewable surface. -->
        <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled" />
    </Style>

    <!-- Style for an individual generic item -->
    <Style TargetType="{x:Type ListBoxItem}">
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ListBoxItem}" >
                    <Border SnapsToDevicePixels="True" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="{TemplateBinding Background}">
                        <ContentPresenter />
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsSelected" Value="True">
                            <Setter Property="Background" Value="#445B6249"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <DataTemplate DataType="{x:Type local:BaseBook }">
        <Grid Margin="6">
            <!-- Image Template -->
            <Border BorderBrush="Black" BorderThickness="4" CornerRadius="5" Margin="6">
                <Grid Margin="0,0,0,0">
                    <Image Source="{Binding Path=Cover}" Width="70">
                        <Image.ToolTip>
                            <ToolTip Style="{DynamicResource TransparentToolTipStyle}">
                                <ContentControl Content="{Binding}" ContentTemplate="{StaticResource MetadataTemplate}"/>
                            </ToolTip>
                        </Image.ToolTip>
                    </Image>
                    <Image Source="TheRedPushPin.png" Height="30" HorizontalAlignment="Right" VerticalAlignment="Top"
					Visibility="{Binding Path=Bookmark, Converter={StaticResource BookmarkToVisibilityConverter}}"></Image>
                </Grid>
            </Border>
        </Grid>
    </DataTemplate>

</ResourceDictionary>

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 GNU General Public License (GPLv3)

Share

About the Author

Guillaume Waser
Architect XEROX
France France
No Biography provided

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.160525.2 | Last Updated 10 May 2012
Article Copyright 2009 by Guillaume Waser
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid