Click here to Skip to main content
15,885,546 members
Articles / Desktop Programming / WPF

C.B.R.

Rate me:
Please Sign up or sign in to vote.
4.96/5 (52 votes)
22 Oct 2012GPL329 min read 124.2K   1.8K   132  
Comic and electronic publication reader with library management, extended file conversion, and devices support.
<UserControl x:Class="CBR.Views.ConvertView"
             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" 
             mc:Ignorable="d" 
             xmlns:Converters="clr-namespace:CBR.Components.Converters" Loaded="UserControl_Loaded">
    <Grid Margin="15" HorizontalAlignment="Left" VerticalAlignment="Top">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="2*" />
            <ColumnDefinition Width="20" />
            <ColumnDefinition Width="2*" />
            <ColumnDefinition Width="20" />
            <ColumnDefinition Width="Auto" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <StackPanel Grid.ColumnSpan="5">
            <TextBlock Style="{StaticResource TitleLabel}" Margin="5">Converter</TextBlock>
            <Line Style="{StaticResource DashedSeparator}" X1="0" X2="1" />
        </StackPanel>

        <StackPanel Grid.Row="1" Orientation="Vertical" Margin="10" Name="stack1">
            <TextBlock Style="{StaticResource SubTitleLabel}" Margin="5">Source(s)</TextBlock>
            <RadioButton GroupName="Source" Margin="5" Name="rbOneSource" Click="rbSource_Click">Single file</RadioButton>
            <Grid IsEnabled="{Binding ElementName=rbOneSource, Path=IsChecked}" Margin="5">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>
                <TextBox Name="tbSingleFileSource"></TextBox>
                <Button HorizontalAlignment="Right" Grid.Column="1" Name="btSingleSource" Width="22" Click="btSingleSource_Click">...</Button>
            </Grid>
            <RadioButton GroupName="Source" Margin="5" Name="rbMultipleSource" Click="rbSource_Click">Folder content (recursively)</RadioButton>
            <Grid IsEnabled="{Binding ElementName=rbMultipleSource, Path=IsChecked}" Margin="5">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>
                <TextBox HorizontalAlignment="Stretch" Grid.Column="0" Name="tbFolderSource"></TextBox>
                <Button HorizontalAlignment="Right" Grid.Column="1" Name="btFolderSource" Width="22" Click="btFolderSource_Click">...</Button>
            </Grid>


            <Line Style="{StaticResource DashedSeparator}" X1="0" X2="1" />

            <TextBlock Style="{StaticResource SubTitleLabel}" Margin="5">Format</TextBlock>
            <RadioButton GroupName="InputFormat" Margin="5" Name="rbInputFiles" IsEnabled="{Binding ElementName=rbMultipleSource, Path=IsChecked}">Image files</RadioButton>
            <RadioButton GroupName="InputFormat" Margin="5" Name="rbInputPDF" IsEnabled="{Binding ElementName=rbMultipleSource, Path=IsChecked}">PDF files</RadioButton>
            <RadioButton GroupName="InputFormat" Margin="5" Name="rbInputRAR" IsEnabled="{Binding ElementName=rbMultipleSource, Path=IsChecked}">RAR/CBR files</RadioButton>
            <RadioButton GroupName="InputFormat" Margin="5" Name="rbInputZIP" IsEnabled="{Binding ElementName=rbMultipleSource, Path=IsChecked}">ZIP/CBZ files</RadioButton>
            <RadioButton GroupName="InputFormat" Margin="5" Name="rbInputXPS" IsEnabled="{Binding ElementName=rbMultipleSource, Path=IsChecked}">XPS files</RadioButton>
            
        </StackPanel>

        <Line Grid.Column="1" Grid.Row="1"  X1="0" Y2="1" Style="{StaticResource VerticalSeparator}" />

        <StackPanel Grid.Column="2" Grid.Row="1" Margin="10" Name="stack2">
            
            <TextBlock Style="{StaticResource SubTitleLabel}" Margin="5">Destination(s)</TextBlock>
            <RadioButton GroupName="Destination" Margin="5" Name="rbSameAsSource" Click="rbSameAsSource_Click">Same as the source</RadioButton>
            <RadioButton GroupName="Destination" Margin="5" Name="rbInOneFolder">In a unique folder to define below :</RadioButton>
            <Grid IsEnabled="{Binding ElementName=rbInOneFolder, Path=IsChecked}" Margin="5">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>
                <TextBox HorizontalAlignment="Stretch" Grid.Column="0" Name="tbDestinationFolder"></TextBox>
                <Button HorizontalAlignment="Right" Grid.Column="1" Name="btFolderDestination" Width="22" Click="btFolderDestination_Click">...</Button>
            </Grid>
            <Line Style="{StaticResource DashedSeparator}" X1="0" X2="1" />
            
            <TextBlock Style="{StaticResource SubTitleLabel}" Margin="5">Format</TextBlock>
            <RadioButton GroupName="OutputFormat" Margin="5" Name="rbOutputFile">Image files</RadioButton>
            <RadioButton GroupName="OutputFormat" Margin="5" Name="rbOutputCBZ" >CBZ files</RadioButton>
            <RadioButton GroupName="OutputFormat" Margin="5" Name="rbOutputXPS">XPS files</RadioButton>

            <Line Style="{StaticResource DashedSeparator}" X1="0" X2="1" />
        
            <TextBlock Style="{StaticResource SubTitleLabel}" Margin="5">Control</TextBlock>
            <CheckBox Margin="5" Name="chkVerify">Verify page/image count</CheckBox>
            <CheckBox Margin="5" Name="chkUpdate" IsEnabled="{Binding ElementName=rbOutputFile, Path=IsChecked, Converter={x:Static Converters:InvertBooleanConverter.Instance}}">Update library</CheckBox>

        </StackPanel>

        <Line Grid.Column="3" Grid.Row="1" Grid.RowSpan="2"  X1="0" Y2="1" Style="{StaticResource VerticalSeparator}" />

        <StackPanel Grid.Row="1" Grid.Column="5" Orientation="Vertical" Margin="10" >
            <Button Width="80" Height="80" Margin="10" ToolTip="Convert with the selected parameters" Content="Convert" Name="btnConvert" Click="btnConvert_Click" />
            <Button Width="80" Height="80" Margin="10" ToolTip="Convert with the selected parameters" Content="Cancel" Name="btnCancel" Click="btnCancel_Click" Visibility="Hidden" />
        </StackPanel>

        <StackPanel Grid.Row="2" Grid.ColumnSpan="3">
            <TextBlock Style="{StaticResource SubTitleLabel}" Margin="5">Result(s)</TextBlock>
            <TextBlock Margin="5" TextWrapping="WrapWithOverflow" TextTrimming="WordEllipsis" Foreground="Red" ForceCursor="True">Before deleting your files, allways check the resulting file.</TextBlock>
            <TextBlock Margin="5">Current conversion step</TextBlock>
            <ListBox Margin="10" Height="120" Name="lbResults"></ListBox>
            <ProgressBar Height="22" Name="progressResults" Visibility="Hidden" IsIndeterminate="True"></ProgressBar>
        </StackPanel>
    </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 GNU General Public License (GPLv3)


Written By
Architect
France France
WPF and MVVM fan, I practice C # in all its forms from the beginning of the NET Framework without mentioning C ++ / MFC and other software packages such as databases, ASP, WCF, Web & Windows services, Application, and now Core and UWP.
In my wasted hours, I am guilty of having fathered C.B.R. and its cousins C.B.R. for WinRT and UWP on the Windows store.
But apart from that, I am a great handyman ... the house, a rocket stove to heat the jacuzzi and the last one: a wood oven for pizza, bread, and everything that goes inside

https://guillaumewaser.wordpress.com/
https://fouretcompagnie.wordpress.com/

Comments and Discussions