Click here to Skip to main content
15,886,422 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.3K   1.8K   132  
Comic and electronic publication reader with library management, extended file conversion, and devices support.
<Fluent:RibbonWindow x:Class="CBR.Views.MainView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:Fluent="clr-namespace:Fluent;assembly=Fluent"
        xmlns:Controls="clr-namespace:CBR.Components.Controls"
        xmlns:Converters="clr-namespace:CBR.Components.Converters"
        xmlns:Views="clr-namespace:CBR.Views"
        MinWidth="850" MinHeight="600" Title="{Binding Title}"
        Icon="/CBR;Component/Resources/Images/book.ico"
        ResizeMode="CanResizeWithGrip" WindowState="Normal"
        Drop="RibbonWindow_Drop" AllowDrop="True" Loaded="RibbonWindow_Loaded" Closing="RibbonWindow_Closing">

    <Grid Name="MainGrid">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <!--#################################################################################################-->
        <!--RIBBON CONTROL-->
        <Fluent:Ribbon Grid.Row="0" HorizontalAlignment="Stretch" Name="ribbonMain" AutomaticStateManagement="True"
                       Title="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=Title}" SelectedTabChanged="ribbonMain_SelectedTabChanged">

            <!--#################################################################################################-->
            <!--Backstage Items-->

            <Fluent:Ribbon.Menu>
                <Fluent:Backstage Header="{LocalizationExtension ResModul=CBR, Key=RibbonTab.File, DefaultValue=File}" Background="Green" IsOpen="{Binding BackStageIsOpen, Mode=TwoWay}">
                    <Fluent:BackstageTabControl Name="backstage" SelectedIndex="{Binding BackStageIndex, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">

                        <Fluent:Button Header="{LocalizationExtension ResModul=CBR.Backstage, Key=Command.Open, DefaultValue=_Open}" SizeDefinition="Small"
                               Icon="/CBR;Component/Resources/Images/32x32/open_folder.png"
                               LargeIcon="/CBR;Component/Resources/Images/32x32/open_folder.png" 
                               Command="{Binding CatalogOpenCommand}"/>

                        <Fluent:Button Header="{LocalizationExtension ResModul=CBR.Backstage, Key=Command.Save, DefaultValue=_Save}"
                                       Icon="/CBR;Component/Resources/Images/32x32/save.png"
                                       LargeIcon="/CBR;Component/Resources/Images/32x32/save.png"
                                       Command="{Binding CatalogSaveCommand}"/>
                        <Fluent:Button Header="{LocalizationExtension ResModul=CBR.Backstage, Key=Command.SaveAs, DefaultValue=_Save as}"
                                       Icon="/CBR;Component/Resources/Images/32x32/save_as.png"
                                       LargeIcon="/CBR;Component/Resources/Images/32x32/save_as.png"
                                       Command="{Binding CatalogSaveAsCommand}"/>

                        <Fluent:Button Header="{LocalizationExtension ResModul=CBR.Backstage, Key=Command.New, DefaultValue=_New}"
                                       Icon="/CBR;Component/Resources/Images/32x32/library_new.png"
                                       LargeIcon="/CBR;Component/Resources/Images/32x32/library_new.png"
                                        Command="{Binding CatalogNewCommand}"
                                       />

                        <Fluent:BackstageTabItem Header="{LocalizationExtension ResModul=CBR.Backstage, Key=Panel.Info, DefaultValue=Info}" Fluent:KeyTip.Keys="I">
                            <Views:InfoView x:Name="InfoView" />
                        </Fluent:BackstageTabItem>

                        <Fluent:BackstageTabItem Header="{LocalizationExtension ResModul=CBR.Backstage, Key=Panel.Recent, DefaultValue=Recent}" Fluent:KeyTip.Keys="R">
                            <Views:RecentFileView x:Name="RecentFileView" />
                        </Fluent:BackstageTabItem>

                        <Fluent:BackstageTabItem Visibility="Collapsed" Header="{LocalizationExtension ResModul=CBR.Backstage, Key=Panel.New, DefaultValue=New}" Fluent:KeyTip.Keys="N">
                            <Views:CreateView x:Name="CreateView" />
                        </Fluent:BackstageTabItem>

                        <Fluent:BackstageTabItem Header="{LocalizationExtension ResModul=CBR.Backstage, Key=Panel.Options, DefaultValue=Options}" Fluent:KeyTip.Keys="O" >
                            <Views:OptionsView x:Name="OptionView" />
                        </Fluent:BackstageTabItem>

                        <Fluent:BackstageTabItem Header="{LocalizationExtension ResModul=CBR.Backstage, Key=Panel.Convert, DefaultValue=Convert}"  Fluent:KeyTip.Keys="C" >
                            <Views:ConvertView x:Name="ConvertView" />
                        </Fluent:BackstageTabItem>

                        <Fluent:BackstageTabItem Header="{LocalizationExtension ResModul=CBR.Backstage, Key=Panel.Device, DefaultValue=Devices}" Fluent:KeyTip.Keys="D" >
                            <Views:DeviceConfigView x:Name="DeviceConfigView" />
                        </Fluent:BackstageTabItem>

                        <Fluent:Button Header="{LocalizationExtension ResModul=CBR.Backstage, Key=Command.Exit, DefaultValue=Exit}"
                                       Command="{Binding SysExitCommand}"
                                       Icon="/CBR;Component/Resources/Images/32x32/exit.png"
                                       LargeIcon="/CBR;Component/Resources/Images/32x32/exit.png" />
                        
                    </Fluent:BackstageTabControl>
                </Fluent:Backstage>
            </Fluent:Ribbon.Menu>

            <!--#################################################################################################-->
            <!--Contextual Tab Groups-->
            <!--Visibility="{Binding Path=IsInEditMode, Converter={x:Static Converters:BoolToVisibilityConverter.Instance}}"-->
            <Fluent:Ribbon.ContextualGroups>

                <Fluent:RibbonContextualTabGroup x:Name="EditorGroup" Background="Magenta" BorderBrush="DarkMagenta"
                    Header="{LocalizationExtension ResModul=CBR, Key=RibbonTab.Editor, DefaultValue=Editor}"
                    Visibility="{Binding HasBook, Converter={x:Static Converters:BoolToVisibilityConverter.Instance}, ConverterParameter=true}" />

                <Fluent:RibbonContextualTabGroup x:Name="DeviceGroup" Background="Blue" BorderBrush="DarkBlue"
                    Header="{LocalizationExtension ResModul=CBR, Key=RibbonTab.Device, DefaultValue=Devices}"
                    Visibility="{Binding HasDevice, Converter={x:Static Converters:BoolToVisibilityConverter.Instance}, ConverterParameter=true}" />

            </Fluent:Ribbon.ContextualGroups>

            <!--#################################################################################################-->
            <!--Quick Access Toolbar Items-->
            <Fluent:Ribbon.QuickAccessItems>
                <Fluent:QuickAccessMenuItem Target="{Binding ElementName=btnFullScreen}" IsChecked="True"/>
            </Fluent:Ribbon.QuickAccessItems>

            <Fluent:Ribbon.ToolBarItems>
                <Fluent:Button Size="Small" Icon="/CBR;Component/Resources/Images/32x32/help.png" Name="btnHelp" Command="{Binding SysHelpCommand}">
                    <Fluent:Button.ToolTip>
                        <Fluent:ScreenTip
                            Title="{LocalizationExtension ResModul=CBR, Key=ScreenTip.HelpTitle, DefaultValue=_Help}"
                            Text="{LocalizationExtension ResModul=CBR, Key=ScreenTip.Help, DefaultValue=You can get online help by clicking on this button.}"
                            Image="/CBR;Component/Resources/Images/32x32/help.png"
                            Width="190" IsRibbonAligned ="True"/>
                    </Fluent:Button.ToolTip>
                </Fluent:Button>
            </Fluent:Ribbon.ToolBarItems>

            <!--#################################################################################################-->
            <!--################   library / books tab   ################-->

            <Fluent:RibbonTabItem Header="{LocalizationExtension ResModul=CBR, Key=RibbonTab.Library, DefaultValue=Library}" Name="ribbonTabLibrary">

                <Fluent:RibbonGroupBox Header="{LocalizationExtension ResModul=CBR, Key=Group.Library, DefaultValue=Library}" IsLauncherVisible="false" >

                    <Fluent:Button Header="{LocalizationExtension ResModul=CBR, Key=Button.New, DefaultValue=_New}" SizeDefinition="Large"
                                    Icon="/CBR;Component/Resources/Images/32x32/library_new.png"
                                    LargeIcon="/CBR;Component/Resources/Images/32x32/library_new.png"
                                    ToolTip="Create a new library"
                                    Command="{Binding CatalogNewCommand}"
                                   />

                    <Fluent:Button Header="{LocalizationExtension ResModul=CBR, Key=Button.Open, DefaultValue=_Open}" SizeDefinition="Large"
                                   Icon="/CBR;Component/Resources/Images/32x32/library_open.png"
                                   LargeIcon="/CBR;Component/Resources/Images/32x32/library_open.png"
                                   ToolTip="Open a library"
                                   Command="{Binding CatalogOpenCommand}"/>

                    <Fluent:Button Header="{LocalizationExtension ResModul=CBR, Key=Button.Close, DefaultValue=_Close}" SizeDefinition="Large"
                                   Icon="/CBR;Component/Resources/Images/32x32/library_close.png"
                                   LargeIcon="/CBR;Component/Resources/Images/32x32/library_close.png"
                                   ToolTip="Close the current library"
                                   Command="{Binding CatalogCloseCommand}" />

                    <Separator></Separator>

                    <Fluent:Button Header="{LocalizationExtension ResModul=CBR, Key=Button.Refresh, DefaultValue=_Refresh}" SizeDefinition="Large"
                                   Icon="/CBR;Component/Resources/Images/32x32/refresh.png"
                                   LargeIcon="/CBR;Component/Resources/Images/32x32/refresh.png"
                                   ToolTip="Refresh the explorer content based on the library book folder"
                                   Command="{Binding CatalogRefreshCommand}" />

                    <Fluent:DropDownButton Header="{LocalizationExtension ResModul=CBR, Key=Button.ExplorerView, DefaultValue=_Explorer View}" SizeDefinition="Large"
                                   Icon="/CBR;Component/Resources/Images/32x32/library_view.png"
                                   LargeIcon="/CBR;Component/Resources/Images/32x32/library_view.png"
                                   ToolTip="Change the explorer display">
                        <!--<Fluent:MenuItem Header="{LocalizationExtension ResModul=CBR, Key=ContextMenu.Details, DefaultValue=Details}" IsCheckable="True"
                                         Command="{Binding SysExplorerViewCommand}" CommandParameter="Details" 
                                         IsChecked="{Binding ElementName=ExplorerView, Path=DataContext.IsExplorerViewThumb, Converter={x:Static Converters:InvertBooleanConverter.Instance}}"
                                         Icon="/CBR;Component/Resources/Images/16x16/view_details.png" />
                        <Fluent:MenuItem Header="{LocalizationExtension ResModul=CBR, Key=ContextMenu.Thumbnail, DefaultValue=Thumbnail}" IsCheckable="True"
                                         Command="{Binding SysExplorerViewCommand}" CommandParameter="Thumbnail" 
                                         IsChecked="{Binding ElementName=ExplorerView, Path=DataContext.IsExplorerViewThumb}"
                                         Icon="/CBR;Component/Resources/Images/16x16/view_thumb.png"/>-->

                        <Fluent:MenuItem Header="{LocalizationExtension ResModul=CBR, Key=ContextMenu.ViewGrid, DefaultValue=Grid}"
                                         Command="{Binding ElementName=ExplorerView, Path=DataContext.ViewModeCommand}" CommandParameter="ExplorerGridView" 
                                         IsChecked="{Binding ElementName=ExplorerView, Path=DataContext.IsViewGrid, Mode=OneWay}"
                                         Icon="/CBR;Component/Resources/Images/16x16/view_details.png" IsCheckable="True" />
                        <Fluent:MenuItem Header="{LocalizationExtension ResModul=CBR, Key=ContextMenu.ThumbnailSimple, DefaultValue=Thumbnail simple}"
                                         Command="{Binding ElementName=ExplorerView, Path=DataContext.ViewModeCommand}" CommandParameter="ExplorerImageView" 
                                         IsChecked="{Binding ElementName=ExplorerView, Path=DataContext.IsViewThumbSimple, Mode=OneWay}"
                                         Icon="/CBR;Component/Resources/Images/16x16/view_thumb.png" IsCheckable="True" />
                        <Fluent:MenuItem Header="{LocalizationExtension ResModul=CBR, Key=ContextMenu.ExplorerView.ThumbnailDetails, DefaultValue=Thumbnail details}"
                                         Command="{Binding ElementName=ExplorerView, Path=DataContext.ViewModeCommand}" CommandParameter="ExplorerImageDetailView" 
                                         IsChecked="{Binding ElementName=ExplorerView, Path=DataContext.IsViewThumbDetails, Mode=OneWay}"
                                         Icon="/CBR;Component/Resources/Images/16x16/view_thumb.png" IsCheckable="True"/>

                    </Fluent:DropDownButton>
                </Fluent:RibbonGroupBox>

                <Fluent:RibbonGroupBox Header="{LocalizationExtension ResModul=CBR, Key=Group.Books, DefaultValue=Books}" IsLauncherVisible="True" LauncherCommand="Open" >

                    <Fluent:DropDownButton Header="{LocalizationExtension ResModul=CBR, Key=Button.Add, DefaultValue=_Add}" SizeDefinition="Large"
                                   Icon="/CBR;Component/Resources/Images/32x32/book_add.png"
                                   LargeIcon="/CBR;Component/Resources/Images/32x32/book_add.png"
                                   ToolTip="Add comics files to the library" >
                        <Fluent:MenuItem Command="{Binding BookAddCommand}" CommandParameter="One" 
                            Header="{LocalizationExtension ResModul=CBR, Key=ContextMenu.AddMenuItem, DefaultValue=Add a file}" />
                        <Fluent:MenuItem Command="{Binding BookAddCommand}" CommandParameter="Recursive"
                            Header="{LocalizationExtension ResModul=CBR, Key=ContextMenu.AddFolderMenuItem, DefaultValue=Recursively from folder}" />
                    </Fluent:DropDownButton>

                    <Fluent:Button Header="{LocalizationExtension ResModul=CBR, Key=Button.Remove, DefaultValue=Re_move}" SizeDefinition="Large"
                                   Icon="/CBR;Component/Resources/Images/32x32/book_remove.png"
                                   LargeIcon="/CBR;Component/Resources/Images/32x32/book_remove.png"
                                   ToolTip="Remove the explorer selection from the library"
                                   Command="{Binding BookRemoveCommand}"
                                   CommandParameter="{Binding ElementName=ExplorerView, Path=DataContext.Books.CurrentItem}" />

                    <Separator></Separator>

                    <Fluent:Button Header="{LocalizationExtension ResModul=CBR, Key=Button.Read, DefaultValue=_Read}" SizeDefinition="Large"
                                   Icon="/CBR;Component/Resources/Images/32x32/book_read.png"
                                   LargeIcon="/CBR;Component/Resources/Images/32x32/book_read.png"
                                   ToolTip="Read the explorer selection"
                                   Command="{Binding BookReadCommand}"
                                   CommandParameter="{Binding ElementName=ExplorerView, Path=DataContext.Books.CurrentItem}" />

                    <Fluent:Button Header="{LocalizationExtension ResModul=CBR, Key=Button.Protect, DefaultValue=_Protect}" SizeDefinition="Large"
                                   Icon="/CBR;Component/Resources/Images/32x32/book_protect.png"
                                   LargeIcon="/CBR;Component/Resources/Images/32x32/book_protect.png"
                                   ToolTip="Protect the explorer selection"
                                   Command="{Binding BookProtectCommand}"
                                   CommandParameter="{Binding ElementName=ExplorerView, Path=DataContext.Books.CurrentItem}" />

                    <Fluent:ToggleButton Header="{LocalizationExtension ResModul=CBR, Key=Button.Edit, DefaultValue=_Edit}" SizeDefinition="Large"
                                   Icon="/CBR;Component/Resources/Images/32x32/book_edit.png"
                                   LargeIcon="/CBR;Component/Resources/Images/32x32/book_edit.png"
                                   ToolTip="Edit the explorer selection"
                                   Command="{Binding BookEditCommand}"
                                   CommandParameter="{Binding ElementName=ExplorerView, Path=DataContext.Books.CurrentItem}" />

                    <Fluent:Button Header="{LocalizationExtension ResModul=CBR, Key=Button.Delete, DefaultValue=_Delete}" SizeDefinition="Large"
                                   Icon="/CBR;Component/Resources/Images/32x32/book_delete.png"
                                   LargeIcon="/CBR;Component/Resources/Images/32x32/book_delete.png"
                                   ToolTip="Delete the explorer selection"
                                   Command="{Binding BookDeleteCommand}"
                                   CommandParameter="{Binding ElementName=ExplorerView, Path=DataContext.Books.CurrentItem}" />
                    
                    <Separator></Separator>

                    <Fluent:Button Header="{LocalizationExtension ResModul=CBR, Key=Button.Open, DefaultValue=_Open}" SizeDefinition="Large"
                                   Icon="/CBR;Component/Resources/Images/32x32/book_open.png"
                                   LargeIcon="/CBR;Component/Resources/Images/32x32/book_open.png"
                                   ToolTip="Open a book without adding it to the library"
                                   Command="{Binding BookOpenCommand}" />

                    <Fluent:Button Header="{LocalizationExtension ResModul=CBR, Key=Button.Close, DefaultValue=_Close}" SizeDefinition="Large"
                                   Icon="/CBR;Component/Resources/Images/32x32/book_close.png"
                                   LargeIcon="/CBR;Component/Resources/Images/32x32/book_close.png"
                                   ToolTip="Close the currently opened book"
                                   Command="{Binding BookCloseCommand}" />
                 
                </Fluent:RibbonGroupBox>

                <Fluent:RibbonGroupBox Header="{LocalizationExtension ResModul=CBR, Key=Group.Pages, DefaultValue=Pages}" IsLauncherVisible="False" >

                    <Fluent:Button Header="{LocalizationExtension ResModul=CBR, Key=Button.Mark, DefaultValue=_Bookmark}" SizeDefinition="Large"
                                   Icon="/CBR;Component/Resources/Images/32x32/page_mark.png"
                                   LargeIcon="/CBR;Component/Resources/Images/32x32/page_mark.png"
                                   ToolTip="Put a bookmark on the current page"
                                   Command="{Binding BookmarkCommand}" />

                    <Fluent:Button Header="{LocalizationExtension ResModul=CBR, Key=Button.MarkGoto, DefaultValue=_Goto}" SizeDefinition="Large"
                                   Icon="/CBR;Component/Resources/Images/32x32/page_goto_mark.png"
                                   LargeIcon="/CBR;Component/Resources/Images/32x32/page_goto_mark.png"
                                   ToolTip="Go to the bookmark on the open book"
                                   Command="{Binding GotoBookmarkCommand}" />

                    <Fluent:Button Header="{LocalizationExtension ResModul=CBR, Key=Button.MarkClear, DefaultValue=C_lear}" SizeDefinition="Large"
                                   Icon="/CBR;Component/Resources/Images/32x32/page_clear_mark.png"
                                   LargeIcon="/CBR;Component/Resources/Images/32x32/page_clear_mark.png"
                                   ToolTip="Clear the bookmark on the open book"
                                   Command="{Binding ClearBookmarkCommand}" />

                    <Separator></Separator>

                    <Fluent:ToggleButton Header="{LocalizationExtension ResModul=CBR, Key=Button.FitWidth, DefaultValue=Fit _width}" SizeDefinition="Large"
                                   Icon="/CBR;Component/Resources/Images/32x32/fit_width.png"
                                   LargeIcon="/CBR;Component/Resources/Images/32x32/fit_width.png"
                                   ToolTip="Check the fit mode to be on page width"
                                   GroupName="FitGroup" IsChecked="{Binding IsFitModeWidth}"
                                   Command="{Binding FitModeCommand}" CommandParameter="Width" />

                    <Fluent:ToggleButton Header="{LocalizationExtension ResModul=CBR, Key=Button.FitHeight, DefaultValue=Fit _height}" SizeDefinition="Large"
                                   Icon="/CBR;Component/Resources/Images/32x32/fit_height.png"
                                   LargeIcon="/CBR;Component/Resources/Images/32x32/fit_height.png"
                                   ToolTip="Check the fit mode to be on page height"
                                   GroupName="FitGroup" IsChecked="{Binding IsFitModeHeight}"
                                   Command="{Binding FitModeCommand}" CommandParameter="Height" />

                </Fluent:RibbonGroupBox>

                <Fluent:RibbonGroupBox Header="{LocalizationExtension ResModul=CBR, Key=Group.Programm, DefaultValue=Programm}" IsLauncherVisible="false" >

                    <Fluent:Button Header="{LocalizationExtension ResModul=CBR, Key=Button.FullScreen, DefaultValue=_Full Screen}" SizeDefinition="Large"
                                   Icon="/CBR;Component/Resources/Images/32x32/full_screen.png"
                                   LargeIcon="/CBR;Component/Resources/Images/32x32/full_screen.png"
                                   ToolTip="Put the application in full screen mode"
                                   Click="btnFullScreen_Click" />

                    <Separator></Separator>

                    <Fluent:DropDownButton Header="{LocalizationExtension ResModul=CBR, Key=Button.Language, DefaultValue=_Language}" SizeDefinition="Large"
                                   Icon="/CBR;Component/Resources/Images/32x32/localize.png"
                                   LargeIcon="/CBR;Component/Resources/Images/32x32/localize.png"
                                   ToolTip="Language management" ResizeMode="Both">
                        <Fluent:Gallery ItemsSource="{Binding Languages}" MinItemsInRow="1" MaxItemsInRow="2"
                                        Orientation="Horizontal" SelectionChanged="languageGallery_SelectionChanged">
                            <Fluent:Gallery.ItemTemplate>
                                <DataTemplate>
                                    <StackPanel>
                                        <Image Source="{Binding Icon}" Width="16" Height="16" />
                                        <TextBlock Text="{Binding ToDisplay}" />
                                    </StackPanel>
                                </DataTemplate>
                            </Fluent:Gallery.ItemTemplate>
                            <Fluent:Gallery.ItemContainerStyle>
                                <Style TargetType="{x:Type Fluent:GalleryItem}"  BasedOn="{StaticResource {x:Type Fluent:GalleryItem}}">
                                    <Setter Property="Fluent:GalleryItem.IsSelected" Value="{Binding IsChecked}"/>
                                </Style>
                            </Fluent:Gallery.ItemContainerStyle>
                        </Fluent:Gallery>
                        <Fluent:MenuItem Header="{LocalizationExtension ResModul=CBR, Key=ContextMenu.Localize, DefaultValue=Localize}"
                                         Icon="/CBR;Component/Resources/Images/32x32/localize.png" Size="Middle" Click="btnLocalize_Click" />
                    </Fluent:DropDownButton>

                    <Fluent:Button Header="{LocalizationExtension ResModul=CBR, Key=Button.About, DefaultValue=_About}" SizeDefinition="Large" Click="btnAbout_Click"
                                   Icon="/CBR;Component/Resources/Images/32x32/info.png"
                                   LargeIcon="/CBR;Component/Resources/Images/32x32/info.png"
                                   ToolTip="Display the information dialog"/>

                    <Fluent:Button Header="{LocalizationExtension ResModul=CBR, Key=Button.Exit, DefaultValue=_Exit}" SizeDefinition="Large" Command="{Binding SysExitCommand}"
                                   Icon="/CBR;Component/Resources/Images/32x32/exit.png"
                                   LargeIcon="/CBR;Component/Resources/Images/32x32/exit.png"
                                   ToolTip="Exit the programm"/>

                </Fluent:RibbonGroupBox>

            </Fluent:RibbonTabItem>

            <!--#################################################################################################-->
            <!-- Contextual Tabs -->

            <Fluent:RibbonTabItem Header="{LocalizationExtension ResModul=CBR, Key=RibbonTab.Book, DefaultValue=Book}" Group="{Binding ElementName=EditorGroup}" Name="ribbonTabBook"
                IsSelected="{Binding Path=IsInEditMode, Mode=OneWay}"
                Visibility="{Binding IsInEditMode, Converter={x:Static Converters:BoolToVisibilityConverter.Instance}, ConverterParameter=true}">

                <Fluent:RibbonGroupBox Header="{LocalizationExtension ResModul=CBR, Key=Group.Books, DefaultValue=Books}" IsLauncherVisible="True" LauncherCommand="Open" >

                    <Fluent:Button Header="{LocalizationExtension ResModul=CBR, Key=Button.Save, DefaultValue=_Save}" SizeDefinition="Large"
                                   Icon="/CBR;Component/Resources/Images/32x32/book_save.png"
                                   LargeIcon="/CBR;Component/Resources/Images/32x32/book_save.png"
                                   ToolTip="Save the currently edited book"
                                   Command="{Binding BookSaveCommand}"/>

                    <Fluent:Button Header="{LocalizationExtension ResModul=CBR, Key=Button.Close, DefaultValue=_Close}" SizeDefinition="Large"
                                   Icon="/CBR;Component/Resources/Images/32x32/book_close.png"
                                   LargeIcon="/CBR;Component/Resources/Images/32x32/book_close.png"
                                   ToolTip="Close the currently edited book"
                                   Command="{Binding BookCloseCommand}"/>

                    <Separator></Separator>

                    <Fluent:Button Header="{LocalizationExtension ResModul=CBR, Key=Button.Protect, DefaultValue=_Protect}" SizeDefinition="Large"
                                   Icon="/CBR;Component/Resources/Images/32x32/book_protect.png"
                                   LargeIcon="/CBR;Component/Resources/Images/32x32/book_protect.png"
                                   ToolTip="Protect the explorer selection"
                                   Command="{Binding BookProtectCommand}"
                                   CommandParameter="{Binding Path=BookViewModel.Data}" />

                    <Fluent:ToggleButton Header="{LocalizationExtension ResModul=CBR, Key=Button.Edit, DefaultValue=_Edit}" SizeDefinition="Large"
                                   Icon="/CBR;Component/Resources/Images/32x32/book_edit.png"
                                   LargeIcon="/CBR;Component/Resources/Images/32x32/book_edit.png"
                                   ToolTip="Edit the currently opened book"
                                   Command="{Binding BookEditCommand}" />

                    <Fluent:Button Header="{LocalizationExtension ResModul=CBR, Key=Button.Delete, DefaultValue=_Delete}" SizeDefinition="Large"
                                   Icon="/CBR;Component/Resources/Images/32x32/book_delete.png"
                                   LargeIcon="/CBR;Component/Resources/Images/32x32/book_delete.png"
                                   ToolTip="Delete the explorer selection"
                                   Command="{Binding BookDeleteCommand}"
                                   CommandParameter="{Binding Path=BookViewModel.Data}" />

                </Fluent:RibbonGroupBox>

                <Fluent:RibbonGroupBox Header="{LocalizationExtension ResModul=CBR, Key=Group.Reading, DefaultValue=Reading}" IsLauncherVisible="False" >

                    <Fluent:Button Header="{LocalizationExtension ResModul=CBR, Key=Button.Mark, DefaultValue=_Bookmark}" SizeDefinition="Large"
                                   Icon="/CBR;Component/Resources/Images/32x32/page_mark.png"
                                   LargeIcon="/CBR;Component/Resources/Images/32x32/page_mark.png"
                                   ToolTip="Put a bookmark on the current page"
                                   Command="{Binding BookmarkCommand}" />

                    <Fluent:Button Header="{LocalizationExtension ResModul=CBR, Key=Button.MarkGoto, DefaultValue=_Goto}" SizeDefinition="Large"
                                   Icon="/CBR;Component/Resources/Images/32x32/page_goto_mark.png"
                                   LargeIcon="/CBR;Component/Resources/Images/32x32/page_goto_mark.png"
                                   ToolTip="Go to the bookmark on the open book"
                                   Command="{Binding GotoBookmarkCommand}" />

                    <Fluent:Button Header="{LocalizationExtension ResModul=CBR, Key=Button.MarkClear, DefaultValue=C_lear}" SizeDefinition="Large"
                                   Icon="/CBR;Component/Resources/Images/32x32/page_clear_mark.png"
                                   LargeIcon="/CBR;Component/Resources/Images/32x32/page_clear_mark.png"
                                   ToolTip="Clear the bookmark on the open book"
                                   Command="{Binding ClearBookmarkCommand}" />

                    <Separator></Separator>

                    <Fluent:Button Header="{LocalizationExtension ResModul=CBR, Key=Button.Previous, DefaultValue=_Previous}" SizeDefinition="Large"
                                   Icon="/CBR;Component/Resources/Images/32x32/page_clear_mark.png"
                                   LargeIcon="/CBR;Component/Resources/Images/32x32/page_previous.png"
                                   ToolTip="Go to the previous page"
                                   Command="{Binding BookChangePageCommand}" CommandParameter="-1" />

                    <Fluent:Button Header="{LocalizationExtension ResModul=CBR, Key=Button.Next, DefaultValue=_Next}" SizeDefinition="Large"
                                   Icon="/CBR;Component/Resources/Images/32x32/page_clear_mark.png"
                                   LargeIcon="/CBR;Component/Resources/Images/32x32/page_next.png"
                                   ToolTip="Go to the next page"
                                   Command="{Binding BookChangePageCommand}" CommandParameter="1" />

                    <Fluent:TextBox x:Name="PageNumber" InputWidth="30" Header="Goto" 
                                    HorizontalAlignment="Left" VerticalAlignment="Center" Margin="10,30,10,0" 
                                    PreviewKeyUp="PageNumber_PreviewKeyUp" />

                    <Fluent:Button Header="{LocalizationExtension ResModul=CBR, Key=Button.First, DefaultValue=_First}" SizeDefinition="Large"
                                   Icon="/CBR;Component/Resources/Images/32x32/page_clear_mark.png"
                                   LargeIcon="/CBR;Component/Resources/Images/32x32/page_first.png"
                                   ToolTip="Go to the first page"
                                   Command="{Binding BookGotoPageCommand}" CommandParameter="1" />

                    <Fluent:Button Header="{LocalizationExtension ResModul=CBR, Key=Button.Last, DefaultValue=_Last}" SizeDefinition="Large"
                                   Icon="/CBR;Component/Resources/Images/32x32/page_clear_mark.png"
                                   LargeIcon="/CBR;Component/Resources/Images/32x32/page_last.png"
                                   ToolTip="Go to the last page"
                                   Command="{Binding BookGotoLastPageCommand}" />

                    <Separator></Separator>

                    <Fluent:ToggleButton Header="{LocalizationExtension ResModul=CBR, Key=Button.FitWidth, DefaultValue=Fit _width}" SizeDefinition="Large"
                                   Icon="/CBR;Component/Resources/Images/32x32/fit_width.png"
                                   LargeIcon="/CBR;Component/Resources/Images/32x32/fit_width.png"
                                   ToolTip="Check the fit mode to be on page width"
                                   GroupName="FitGroup2" IsChecked="{Binding IsFitModeWidth}"
                                   Command="{Binding FitModeCommand}" CommandParameter="Width" />

                    <Fluent:ToggleButton Header="{LocalizationExtension ResModul=CBR, Key=Button.FitHeight, DefaultValue=Fit _height}" SizeDefinition="Large"
                                   Icon="/CBR;Component/Resources/Images/32x32/fit_height.png"
                                   LargeIcon="/CBR;Component/Resources/Images/32x32/fit_height.png"
                                   ToolTip="Check the fit mode to be on page height"
                                   GroupName="FitGroup2" IsChecked="{Binding IsFitModeHeight}"
                                   Command="{Binding FitModeCommand}" CommandParameter="Height" />

                    <Separator></Separator>

                    <Fluent:Button Header="{LocalizationExtension ResModul=CBR, Key=Button.FullScreen, DefaultValue=_Full Screen}" SizeDefinition="Large"
                                   Icon="/CBR;Component/Resources/Images/32x32/full_screen.png"
                                   LargeIcon="/CBR;Component/Resources/Images/32x32/full_screen.png"
                                   ToolTip="Put the application in full screen mode"
                                   Click="btnFullScreen_Click" />

                </Fluent:RibbonGroupBox>

                <Fluent:RibbonGroupBox Header="{LocalizationExtension ResModul=CBR, Key=Group.Simulate, DefaultValue=Simulate}" IsLauncherVisible="False">

                    <Fluent:Button Header="Test book" SizeDefinition="Large"
                                   Icon="/CBR;Component/Resources/Images/32x32/book_test.png"
                                   LargeIcon="/CBR;Component/Resources/Images/32x32/book_test.png"
                                   DataContext="{Binding BookViewModel}"
                                   Command="{Binding DebugBookCommand}"/>

                    <Fluent:Button Header="Test page" SizeDefinition="Large"
                                   Icon="/CBR;Component/Resources/Images/32x32/page_test.png"
                                   LargeIcon="/CBR;Component/Resources/Images/32x32/page_test.png"
                                   DataContext="{Binding BookViewModel}"
                                   Command="{Binding DebugPageCommand}"/>

                    <Fluent:Button Header="Phone view" SizeDefinition="Large"
                                   Icon="/CBR;Component/Resources/Images/32x32/page_test.png"
                                   LargeIcon="/CBR;Component/Resources/Images/32x32/page_test.png"
                                   DataContext="{Binding BookViewModel}"
                                   Command="{Binding SimulateCommand}"/>

                    <Fluent:ToggleButton Header="Display zones" SizeDefinition="Large"
                                   Icon="/CBR;Component/Resources/Images/32x32/picture_zone.png"
                                   LargeIcon="/CBR;Component/Resources/Images/32x32/picture_zone.png"
                                   ToolTip="Display or hide zones"
                                   DataContext="{Binding BookViewModel}"
                                   Command="{Binding }"/>

                </Fluent:RibbonGroupBox>

            </Fluent:RibbonTabItem>

            <Fluent:RibbonTabItem Header="{LocalizationExtension ResModul=CBR, Key=RibbonTab.Phone, DefaultValue=Phone}" Group="{Binding ElementName=DeviceGroup}" Name="ribbonTabPhone" Visibility="Collapsed" IsEnabled="False">

                <Fluent:RibbonGroupBox Header="{LocalizationExtension ResModul=CBR, Key=Group.Phone, DefaultValue=Phone}" IsLauncherVisible="False" >

                    <Fluent:Button Header="Open" SizeDefinition="Large"
                                   Icon="/CBR;Component/Resources/Images/32x32/book_open.png"
                                   LargeIcon="/CBR;Component/Resources/Images/32x32/book_open.png" />

                    <Fluent:Button Header="Close" SizeDefinition="Large"
                                   Icon="/CBR;Component/Resources/Images/32x32/book_close.png"
                                   LargeIcon="/CBR;Component/Resources/Images/32x32/book_close.png" />

                    <Fluent:Button Header="Refresh" SizeDefinition="Large"
                                   Icon="/CBR;Component/Resources/Images/32x32/book_close.png"
                                   LargeIcon="/CBR;Component/Resources/Images/32x32/book_close.png" />

                    <Fluent:Button Header="Informations" SizeDefinition="Large"
                                   Icon="/CBR;Component/Resources/Images/32x32/book_close.png"
                                   LargeIcon="/CBR;Component/Resources/Images/32x32/book_close.png" />

                </Fluent:RibbonGroupBox>
                <Fluent:RibbonGroupBox Header="Content" IsLauncherVisible="False" >

                    <Fluent:Button Header="Add folder" SizeDefinition="Large"
                                   Icon="/CBR;Component/Resources/Images/32x32/picture_zone.png"
                                   LargeIcon="/CBR;Component/Resources/Images/32x32/picture_zone.png" />

                    <Fluent:Button Header="Add file" SizeDefinition="Large"
                                   Icon="/CBR;Component/Resources/Images/32x32/picture_order.png"
                                   LargeIcon="/CBR;Component/Resources/Images/32x32/picture_order.png" />

                    <Fluent:Button Header="Delete" SizeDefinition="Large"
                                   Icon="/CBR;Component/Resources/Images/32x32/picture_time.png"
                                   LargeIcon="/CBR;Component/Resources/Images/32x32/picture_time.png" />

                    <Fluent:Button Header="Download" SizeDefinition="Large"
                                   Icon="/CBR;Component/Resources/Images/32x32/picture_time.png"
                                   LargeIcon="/CBR;Component/Resources/Images/32x32/picture_time.png" />

                </Fluent:RibbonGroupBox>

            </Fluent:RibbonTabItem>

            <Fluent:RibbonTabItem Header="{LocalizationExtension ResModul=CBR, Key=RibbonTab.USB, DefaultValue=USB}"
                                  Group="{Binding ElementName=DeviceGroup}" Name="ribbonTabUSB"
                Visibility="{Binding HasUSBDevice, Converter={x:Static Converters:BoolToVisibilityConverter.Instance}, ConverterParameter=true}"
                IsEnabled="{Binding HasUSBDevice, Converter={x:Static Converters:BoolToVisibilityConverter.Instance}, ConverterParameter=true}" 
                DataContext="{Binding USBDeviceViewModel}">

                <Fluent:RibbonGroupBox Header="{LocalizationExtension ResModul=CBR, Key=Group.Device, DefaultValue=Device}" IsLauncherVisible="False" >

                    <Fluent:ComboBox Header="{LocalizationExtension ResModul=CBR, Key=Combo.Disks, DefaultValue=Disks}"
                                     IsEditable="False" MinWidth="240" Height="22" BorderBrush="Gainsboro" Foreground="#FF222222" IsReadOnly="True"
                                     IsTextSearchEnabled="False" ResizeMode="Both" Fluent:KeyTip.Keys="FF"  SizeDefinition="Large" Margin="4"
                                     ItemsSource="{Binding Drives}" DisplayMemberPath="Name" SelectedItem="{Binding CurrentDrive}" >
                    </Fluent:ComboBox>

                    <Fluent:ComboBox Header="{LocalizationExtension ResModul=CBR, Key=Combo.Device, DefaultValue=Device}"
                                     IsEditable="False" MinWidth="240" Height="22" BorderBrush="Gainsboro" Foreground="#FF222222" GroupBy="Manufacturer"
                                     IsTextSearchEnabled="True" ResizeMode="Both" Fluent:KeyTip.Keys="FF" SizeDefinition="Large" Margin="4" IsReadOnly="True"
                                     ItemsSource="{Binding DeviceTypes}" DisplayMemberPath="Model" SelectedItem="{Binding CurrentDriveType}" >
                    </Fluent:ComboBox>

                </Fluent:RibbonGroupBox>

                <Fluent:RibbonGroupBox Header="{LocalizationExtension ResModul=CBR, Key=Group.Content, DefaultValue=Content}" IsLauncherVisible="False">
                                       
                    <Fluent:Button Header="Refresh" SizeDefinition="Large"
                                   Icon="/CBR;Component/Resources/Images/32x32/device_refresh.png"
                                   LargeIcon="/CBR;Component/Resources/Images/32x32/device_refresh.png" />
                    
                    <Separator></Separator>

                    <Fluent:Button Header="Synchronize" SizeDefinition="Large"
                                   Icon="/CBR;Component/Resources/Images/32x32/device_sync.png"
                                   LargeIcon="/CBR;Component/Resources/Images/32x32/device_sync.png" />

                </Fluent:RibbonGroupBox>

                <Fluent:RibbonGroupBox IsLauncherVisible="False" >

                    <Fluent:DropDownButton Header="View" SizeDefinition="Large"
                                   Icon="/CBR;Component/Resources/Images/32x32/device_view.png"
                                   LargeIcon="/CBR;Component/Resources/Images/32x32/device_view.png"
                                   ToolTip="Change the explorer display">
                        <Fluent:MenuItem Header="Details" IsCheckable="True"
                                         IsChecked="{Binding ElementName=ExplorerView, Path=DataContext.IsExplorerViewThumb, Converter={x:Static Converters:InvertBooleanConverter.Instance}}"
                                         Icon="/CBR;Component/Resources/Images/16x16/view_details.png" />
                        <Fluent:MenuItem Header="Thumbnail" IsCheckable="True"
                                         IsChecked="{Binding ElementName=ExplorerView, Path=DataContext.IsExplorerViewThumb}"
                                         Icon="/CBR;Component/Resources/Images/16x16/view_thumb.png"/>
                    </Fluent:DropDownButton>
                </Fluent:RibbonGroupBox>

            </Fluent:RibbonTabItem>
            
        </Fluent:Ribbon>

        <!--#################################################################################################-->
        <!--CONTENT-->

        <Grid Grid.Row="1">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="200"/>
                <ColumnDefinition Width="15"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>

            <!--EXPLORER VIEW -->
            <Views:ExplorerView x:Name="ExplorerView" />

            <!--SPLITTER -->
            <Controls:SplitterExpander Grid.Column="1" Orientation="Vertical" GridIndex="0" x:Name="Splitter" />

            <!--DOC VIEW -->
            <ContentControl Grid.Column="2" Content="{Binding Path=ViewModels}" Style="{StaticResource ContentViewStyle}"
                            ContentTemplate="{StaticResource ContentViewTemplate}"/>

        </Grid>

        <!--#################################################################################################-->
        <!-- STATUS BAR -->

        <StatusBar Grid.Row="2" Height="23" VerticalAlignment="Bottom" Foreground="White" ForceCursor="True">
            <StatusBar.ItemsPanel>
                <ItemsPanelTemplate>
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="1.1*"></ColumnDefinition>
                            <ColumnDefinition Width="3*"></ColumnDefinition>
                            <ColumnDefinition Width="2.5*"></ColumnDefinition>
                            <ColumnDefinition Width="40"></ColumnDefinition>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                        </Grid.ColumnDefinitions>
                    </Grid>
                </ItemsPanelTemplate>
            </StatusBar.ItemsPanel>
            <!-- book info -->
            <Fluent:StatusBarItem Grid.Column="0">
                <StackPanel Orientation="Horizontal">
                    <TextBlock VerticalAlignment="Center" ToolTip="Book information" Margin="5,0,0,0"
                             Text="{Binding ElementName=ExplorerView, Path=DataContext.Books.Count}" />
                    <TextBlock VerticalAlignment="Center" ToolTip="Book information" Margin="5,0,0,0"
                             Text="{LocalizationExtension ResModul=CBR, Key=StatusBar.Counter, DefaultValue=Book(s)}" />
                </StackPanel>
            </Fluent:StatusBarItem>
            <Separator Grid.Column="0" HorizontalAlignment="Right"/>

            <!-- page info -->
            <Fluent:StatusBarItem Grid.Column="1">
                <TextBlock VerticalAlignment="Center" Name="PageInfo" ToolTip="Get information about the image cache"
                           DataContext="{Binding BookViewModel}" Text="{Binding PageInfo}" Margin="5,0,0,0" />
            </Fluent:StatusBarItem>
            <Separator HorizontalAlignment="Right" Grid.Column="1"/>

            <!-- cache info -->
            <Fluent:StatusBarItem Grid.Column="2">
                <TextBlock VerticalAlignment="Center" ToolTip="Get information about the image cache"
                           DataContext="{Binding BookViewModel}" Text="{Binding CacheInfo}" Margin="5,0,0,0"/>
            </Fluent:StatusBarItem>
            <Separator HorizontalAlignment="Right" Grid.Column="2"/>

            <!-- pourcent and slider -->
            <Fluent:StatusBarItem Grid.Column="3" VerticalAlignment="Center"
                Value="{Binding Path=Value, ElementName=zoomSlider, StringFormat={}{0:0}\%, Converter={x:Static Converters:ScaleToPercentConverter.Instance}}"/>
            <Separator HorizontalAlignment="Right" Grid.Column="3"/>

            <Fluent:StatusBarItem HorizontalAlignment="Right" Grid.Column="4" Margin="0,0,8,0">
                <Slider Name="zoomSlider" Minimum="0.2" Maximum="10" 
                        LargeChange="0.1" SmallChange="0.01" TickFrequency="0.01"
                        VerticalAlignment="Center" HorizontalAlignment="Stretch"
                        DataContext="{Binding BookViewModel}"
                        Value="{Binding Scale, Mode=TwoWay}"
                        IsDirectionReversed="False" IsTabStop="False"
                        Style="{DynamicResource ZoomSliderStyle}" />
            </Fluent:StatusBarItem>
        </StatusBar>
    </Grid>
</Fluent:RibbonWindow>

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