Browse Source

视图-分屏视图初版

OYXH\oyxh 2 years ago
parent
commit
51b8d21341

+ 126 - 48
PDF Office/CustomControl/ColorDropBoxPop.xaml

@@ -1,88 +1,146 @@
-<UserControl x:Class="PDF_Office.CustomControl.ColorDropBoxPop"
-             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" 
-             xmlns:local="clr-namespace:PDF_Office.CustomControl"
-             mc:Ignorable="d" 
-             d:DesignHeight="450" d:DesignWidth="800" Width="194" Height="auto">
+<UserControl
+    x:Class="PDF_Office.CustomControl.ColorDropBoxPop"
+    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:local="clr-namespace:PDF_Office.CustomControl"
+    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+    Width="194"
+    Height="auto"
+    d:DesignHeight="450"
+    d:DesignWidth="800"
+    mc:Ignorable="d">
     <UserControl.Resources>
-        <local:ColorToBrushConverter x:Key="ColorToBrushConverter"></local:ColorToBrushConverter>
+        <local:ColorToBrushConverter x:Key="ColorToBrushConverter" />
         <Style TargetType="ListViewItem">
-            <Setter Property="Width" Value="15" ></Setter>
-            <Setter Property="Height" Value="15" ></Setter>
-            <Setter Property="Padding" Value="0"></Setter>
-            <Setter Property="BorderThickness" Value="1"></Setter>
-            <Setter Property="BorderBrush" Value="#33000000"></Setter>
-            <Setter Property="Margin" Value="1"></Setter>
+            <Setter Property="Width" Value="15" />
+            <Setter Property="Height" Value="15" />
+            <Setter Property="Padding" Value="0" />
+            <Setter Property="BorderThickness" Value="1" />
+            <Setter Property="BorderBrush" Value="#33000000" />
+            <Setter Property="Margin" Value="1" />
         </Style>
     </UserControl.Resources>
     <Grid>
-        <Border Background="White" Name="ContainerBorder" BorderThickness="1">
+        <Border
+            Name="ContainerBorder"
+            Background="White"
+            BorderThickness="1">
             <Border.Effect>
-                <DropShadowEffect Color="#000000" ShadowDepth="0" BlurRadius="24" Opacity="0.22">
-                </DropShadowEffect>
+                <DropShadowEffect
+                    BlurRadius="24"
+                    Opacity="0.22"
+                    ShadowDepth="0"
+                    Color="#000000" />
             </Border.Effect>
             <Grid>
                 <Grid.RowDefinitions>
-                    <RowDefinition Height="auto"></RowDefinition>
-                    <RowDefinition Height="auto"></RowDefinition>
-                    <RowDefinition Height="auto"></RowDefinition>
-                    <RowDefinition Height="auto"></RowDefinition>
-                    <RowDefinition Height="auto"></RowDefinition>
-                    <RowDefinition Height="auto"></RowDefinition>
-                    <RowDefinition Height="auto"></RowDefinition>
-                    <RowDefinition Height="auto"></RowDefinition>
+                    <RowDefinition Height="auto" />
+                    <RowDefinition Height="auto" />
+                    <RowDefinition Height="auto" />
+                    <RowDefinition Height="auto" />
+                    <RowDefinition Height="auto" />
+                    <RowDefinition Height="auto" />
+                    <RowDefinition Height="auto" />
+                    <RowDefinition Height="auto" />
                 </Grid.RowDefinitions>
-                <TextBlock x:Name="RecentlyColorText" VerticalAlignment="Bottom" LineHeight="20" FontFamily="Segoe UI" FontSize="14" Margin="8,8,0,3">Recently used color</TextBlock>
-                <ListView Grid.Row="1" BorderThickness="0" Name="RecentlyColorList" Margin="9,0,9,0" ScrollViewer.HorizontalScrollBarVisibility="Hidden">
+                <TextBlock
+                    x:Name="RecentlyColorText"
+                    Margin="8,8,0,3"
+                    VerticalAlignment="Bottom"
+                    FontFamily="Segoe UI"
+                    FontSize="14"
+                    LineHeight="20">
+                    Recently used color
+                </TextBlock>
+                <ListView
+                    Name="RecentlyColorList"
+                    Grid.Row="1"
+                    Margin="9,0,9,0"
+                    BorderThickness="0"
+                    ScrollViewer.HorizontalScrollBarVisibility="Hidden">
                     <ListView.ItemsPanel>
                         <ItemsPanelTemplate>
-                            <WrapPanel Width="{Binding ElementName=ThemeColorList,Path=ActualWidth}">
-                            </WrapPanel>
+                            <WrapPanel Width="{Binding ElementName=ThemeColorList, Path=ActualWidth}" />
                         </ItemsPanelTemplate>
                     </ListView.ItemsPanel>
                     <ListView.ItemTemplate>
                         <DataTemplate>
-                            <Rectangle Width="14" Height="14" Fill="{Binding Converter={StaticResource ColorToBrushConverter}}" MouseLeftButtonDown="Rectangle_MouseLeftButtonDown"></Rectangle>
+                            <Rectangle
+                                Width="14"
+                                Height="14"
+                                Fill="{Binding Converter={StaticResource ColorToBrushConverter}}"
+                                MouseLeftButtonDown="Rectangle_MouseLeftButtonDown" />
                         </DataTemplate>
                     </ListView.ItemTemplate>
                 </ListView>
-                <TextBlock x:Name="ThemeColorsText" Grid.Row="2" FontFamily="SegoeUI" FontSize="14" LineHeight="20" Margin="8,5,0,1">Theme colors</TextBlock>
-                <ListView Grid.Row="3" BorderThickness="0" Name="ThemeColorList"  Margin="9,0,9,0" ScrollViewer.HorizontalScrollBarVisibility="Hidden" SelectionMode="Single">
+                <TextBlock
+                    x:Name="ThemeColorsText"
+                    Grid.Row="2"
+                    Margin="8,5,0,1"
+                    FontFamily="SegoeUI"
+                    FontSize="14"
+                    LineHeight="20">
+                    Theme colors
+                </TextBlock>
+                <ListView
+                    Name="ThemeColorList"
+                    Grid.Row="3"
+                    Margin="9,0,9,0"
+                    BorderThickness="0"
+                    ScrollViewer.HorizontalScrollBarVisibility="Hidden"
+                    SelectionMode="Single">
                     <ListView.ItemsPanel>
                         <ItemsPanelTemplate>
-                            <WrapPanel Width="{Binding ElementName=ThemeColorList,Path=ActualWidth}">
-                            </WrapPanel>
+                            <WrapPanel Width="{Binding ElementName=ThemeColorList, Path=ActualWidth}" />
                         </ItemsPanelTemplate>
                     </ListView.ItemsPanel>
                     <ListView.ItemTemplate>
                         <DataTemplate>
-                            <Rectangle Width="14" Height="14" Fill="{Binding Converter={StaticResource ColorToBrushConverter}}" MouseLeftButtonDown="Rectangle_MouseLeftButtonDown"></Rectangle>
+                            <Rectangle
+                                Width="14"
+                                Height="14"
+                                Fill="{Binding Converter={StaticResource ColorToBrushConverter}}"
+                                MouseLeftButtonDown="Rectangle_MouseLeftButtonDown" />
                         </DataTemplate>
                     </ListView.ItemTemplate>
                 </ListView>
-                <Separator Grid.Row="4" Width="190" Height="1"  Background="#26000000" HorizontalAlignment="Center" Margin="2,9,2,8"></Separator>
-                <StackPanel Orientation="Horizontal" Grid.Row="5" Name="TransparentPanel" Margin="0 0 0 8" Visibility="Collapsed">
-                    <Rectangle Width="16" Height="16" Margin="8,0,2,0" MouseLeftButtonDown="TransparentColor_MouseLeftButtonDown">
+                <Separator
+                    Grid.Row="4"
+                    Width="190"
+                    Height="1"
+                    Margin="2,9,2,8"
+                    HorizontalAlignment="Center"
+                    Background="#26000000" />
+                <StackPanel
+                    Name="TransparentPanel"
+                    Grid.Row="5"
+                    Margin="0,0,0,8"
+                    Orientation="Horizontal"
+                    Visibility="Collapsed">
+                    <Rectangle
+                        Width="16"
+                        Height="16"
+                        Margin="8,0,2,0"
+                        MouseLeftButtonDown="TransparentColor_MouseLeftButtonDown">
                         <Rectangle.Fill>
                             <DrawingBrush>
                                 <DrawingBrush.Drawing>
                                     <DrawingGroup>
                                         <GeometryDrawing Brush="White">
                                             <GeometryDrawing.Pen>
-                                                <Pen Thickness="1" Brush="#E2E3E6"></Pen>
+                                                <Pen Brush="#E2E3E6" Thickness="1" />
                                             </GeometryDrawing.Pen>
                                             <GeometryDrawing.Geometry>
-                                                <RectangleGeometry Rect="0,0,16,16"></RectangleGeometry>
+                                                <RectangleGeometry Rect="0,0,16,16" />
                                             </GeometryDrawing.Geometry>
                                         </GeometryDrawing>
                                         <GeometryDrawing>
                                             <GeometryDrawing.Pen>
-                                                <Pen Thickness="2" Brush="#FF3B30"></Pen>
+                                                <Pen Brush="#FF3B30" Thickness="2" />
                                             </GeometryDrawing.Pen>
                                             <GeometryDrawing.Geometry>
-                                                <LineGeometry StartPoint="16,0" EndPoint="0,16"></LineGeometry>
+                                                <LineGeometry StartPoint="16,0" EndPoint="0,16" />
                                             </GeometryDrawing.Geometry>
                                         </GeometryDrawing>
                                     </DrawingGroup>
@@ -90,23 +148,43 @@
                             </DrawingBrush>
                         </Rectangle.Fill>
                     </Rectangle>
-                    <TextBlock x:Name="TransparentText" FontFamily="Segoe UI" FontSize="14" VerticalAlignment="Center">Transparent</TextBlock>
+                    <TextBlock
+                        x:Name="TransparentText"
+                        VerticalAlignment="Center"
+                        FontFamily="Segoe UI"
+                        FontSize="14">
+                        Transparent
+                    </TextBlock>
                 </StackPanel>
-                <StackPanel Orientation="Horizontal" Grid.Row="6" MouseDown="SystemColorPicker_ClickPop">
-                    <Ellipse Width="16" Height="16" Margin="8,0,2,10"  VerticalAlignment="Center">
+                <StackPanel
+                    Grid.Row="6"
+                    MouseDown="SystemColorPicker_ClickPop"
+                    Orientation="Horizontal">
+                    <Ellipse
+                        Width="16"
+                        Height="16"
+                        Margin="8,0,2,10"
+                        VerticalAlignment="Center">
                         <Ellipse.Fill>
                             <DrawingBrush>
                                 <DrawingBrush.Drawing>
                                     <ImageDrawing ImageSource="../Resources/PropertyPanel/colorIcon.png">
                                         <ImageDrawing.Rect>
-                                            <Rect Width="16" Height="16"></Rect>
+                                            <Rect Width="16" Height="16" />
                                         </ImageDrawing.Rect>
                                     </ImageDrawing>
                                 </DrawingBrush.Drawing>
                             </DrawingBrush>
                         </Ellipse.Fill>
                     </Ellipse>
-                    <TextBlock x:Name="OtherColorsText" VerticalAlignment="Center" FontFamily="Segoe UI" FontSize="14" Margin="0 0 0 8">Other Colors</TextBlock>
+                    <TextBlock
+                        x:Name="OtherColorsText"
+                        Margin="0,0,0,8"
+                        VerticalAlignment="Center"
+                        FontFamily="Segoe UI"
+                        FontSize="14">
+                        Other Colors
+                    </TextBlock>
                 </StackPanel>
             </Grid>
         </Border>

+ 73 - 2
PDF Office/Styles/RadioButtonStyle.xaml

@@ -50,7 +50,7 @@
         <Setter Property="BorderBrush" Value="{StaticResource RadioButton.Static.Border}" />
         <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
         <Setter Property="BorderThickness" Value="0" />
-        <Setter Property="Width" Value="60" />
+        <Setter Property="Width" Value="68" />
         <Setter Property="Height" Value="80" />
         <Setter Property="HorizontalContentAlignment" Value="Center" />
         <Setter Property="VerticalContentAlignment" Value="Center" />
@@ -120,7 +120,78 @@
         <Setter Property="BorderBrush" Value="{StaticResource RadioButton.Static.Border}" />
         <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
         <Setter Property="BorderThickness" Value="0" />
-        <Setter Property="Width" Value="78" />
+        <Setter Property="Width" Value="76" />
+        <Setter Property="Height" Value="80" />
+        <Setter Property="HorizontalContentAlignment" Value="Center" />
+        <Setter Property="VerticalContentAlignment" Value="Center" />
+        <Setter Property="Template">
+            <Setter.Value>
+                <ControlTemplate TargetType="{x:Type RadioButton}">
+                    <Grid
+                        x:Name="templateRoot"
+                        Background="Transparent"
+                        SnapsToDevicePixels="True">
+                        <Border
+                            x:Name="radioButtonBorder"
+                            HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
+                            VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
+                            Background="{TemplateBinding Background}"
+                            BorderBrush="{TemplateBinding BorderBrush}"
+                            BorderThickness="{TemplateBinding BorderThickness}">
+                            <Rectangle
+                                x:Name="optionMark"
+                                Width="{TemplateBinding Width}"
+                                Height="{TemplateBinding Height}"
+                                Opacity="0" />
+                        </Border>
+                        <ContentPresenter
+                            x:Name="contentPresenter"
+                            Margin="{TemplateBinding Padding}"
+                            HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
+                            VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
+                            Focusable="False"
+                            RecognizesAccessKey="True"
+                            SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
+                    </Grid>
+                    <ControlTemplate.Triggers>
+                        <Trigger Property="HasContent" Value="true">
+                            <Setter Property="FocusVisualStyle" Value="{StaticResource OptionMarkFocusVisual}" />
+                            <Setter Property="Padding" Value="4,-1,0,0" />
+                        </Trigger>
+                        <Trigger Property="IsMouseOver" Value="true">
+                            <Setter TargetName="radioButtonBorder" Property="Background" Value="{StaticResource RadioButton.MouseOver.Background}" />
+                            <Setter TargetName="radioButtonBorder" Property="BorderBrush" Value="{StaticResource RadioButton.MouseOver.Border}" />
+                            <Setter TargetName="optionMark" Property="Fill" Value="{StaticResource RadioButton.MouseOver.Glyph}" />
+                        </Trigger>
+                        <Trigger Property="IsEnabled" Value="false">
+                            <Setter TargetName="radioButtonBorder" Property="Background" Value="{StaticResource RadioButton.Disabled.Background}" />
+                            <Setter TargetName="radioButtonBorder" Property="BorderBrush" Value="{StaticResource RadioButton.Disabled.Border}" />
+                            <Setter TargetName="optionMark" Property="Fill" Value="{StaticResource RadioButton.Disabled.Glyph}" />
+                        </Trigger>
+                        <Trigger Property="IsPressed" Value="true">
+                            <Setter TargetName="radioButtonBorder" Property="Background" Value="{StaticResource RadioButton.Pressed.Background}" />
+                            <Setter TargetName="radioButtonBorder" Property="BorderBrush" Value="{StaticResource RadioButton.Pressed.Border}" />
+                            <Setter TargetName="optionMark" Property="Fill" Value="{StaticResource RadioButton.Pressed.Glyph}" />
+                        </Trigger>
+                        <Trigger Property="IsChecked" Value="true">
+                            <Setter TargetName="optionMark" Property="Opacity" Value="1" />
+                            <Setter TargetName="optionMark" Property="Fill" Value="{StaticResource RadioButton.Pressed.Glyph}" />
+                        </Trigger>
+                        <Trigger Property="IsChecked" Value="{x:Null}">
+                            <Setter TargetName="optionMark" Property="Opacity" Value="0.56" />
+                        </Trigger>
+                    </ControlTemplate.Triggers>
+                </ControlTemplate>
+            </Setter.Value>
+        </Setter>
+    </Style>
+    <Style x:Key="ViewModeViewRadioBtn" TargetType="{x:Type RadioButton}">
+        <Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}" />
+        <Setter Property="Background" Value="{StaticResource RadioButton.Static.Background}" />
+        <Setter Property="BorderBrush" Value="{StaticResource RadioButton.Static.Border}" />
+        <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
+        <Setter Property="BorderThickness" Value="0" />
+        <Setter Property="Width" Value="72" />
         <Setter Property="Height" Value="80" />
         <Setter Property="HorizontalContentAlignment" Value="Center" />
         <Setter Property="VerticalContentAlignment" Value="Center" />

+ 358 - 345
PDF Office/ViewModels/PropertyPanel/ViewModular/ViewModularContentViewModel.cs

@@ -19,352 +19,365 @@ using System.Windows.Forms;
 
 namespace PDF_Office.ViewModels.PropertyPanel.ViewModular
 {
-    public class ViewModularContentViewModel : BindableBase, INavigationAware
-    {
-        private IRegionManager region;
-
-        private IDialogService dialogs;
-
-        //记录 单页 双页  书本模式
-        private ViewMode viewmode = ViewMode.Single;
-
-        public CPDFViewer PDFViewer { get; set; }
-        public BottomToolContentViewModel BottomToolContentViewModel { get; set; }
-        public ViewContentViewModel ViewContentViewModel { get; set; }
-        public string SplitScreenViewRegionName { get; set; }
-        public string ThemesContentName { get; set; }
-        private Visibility splitScreenViewVisible = Visibility.Collapsed;
-
-        /// <summary>
-        /// 控制Content的显示 用于显示分屏的模块
-        /// </summary>
-        public Visibility SplitScreenViewVisible
-        {
-            get { return splitScreenViewVisible; }
-            set
-            {
-                SetProperty(ref splitScreenViewVisible, value);
-            }
-        }
-
-        private bool isContinue;
-
-        public bool IsContinue
-        {
-            get { return isContinue; }
-            set
-            {
-                SetProperty(ref isContinue, value);
-                if (value)
-                {
-                    SetModeView();
-                }
-            }
-        }
-
-        private bool isPagesBreak = true;
-
-        public bool IsPagesBreak
-        {
-            get { return isPagesBreak; }
-            set
-            {
-                SetProperty(ref isPagesBreak, value);
-            }
-        }
-
-        private bool isSingleView;
-
-        public bool IsSingleView
-        {
-            get { return isSingleView; }
-            set
-            {
-                SetProperty(ref isSingleView, value);
-                if (value)
-                {
-                    SetModeView();
-                }
-            }
-        }
-
-        private bool isTwoPageView;
-
-        public bool IsTwoPageView
-        {
-            get { return isTwoPageView; }
-            set
-            {
-                SetProperty(ref isTwoPageView, value);
-                if (value)
-                {
-                    SetModeView();
-                }
-            }
-        }
-
-        private bool isBookModeView;
-
-        public bool IsBookModeView
-        {
-            get { return isBookModeView; }
-            set
-            {
-                SetProperty(ref isBookModeView, value);
-                if (value)
-                {
-                    SetModeView();
-                }
-            }
-        }
-
-        public DelegateCommand<object> VerticalSplitScreenCommand { get; set; }
-        public DelegateCommand<object> DisableCommand { get; set; }
+public class ViewModularContentViewModel : BindableBase, INavigationAware
+{
+private IRegionManager region;
+
+private IDialogService dialogs;
+
+//记录 单页 双页  书本模式
+private ViewMode viewmode = ViewMode.Single;
+
+public CPDFViewer PDFViewer { get; set; }
+public BottomToolContentViewModel BottomToolContentViewModel { get; set; }
+public ViewContentViewModel ViewContentViewModel { get; set; }
+public string SplitScreenViewRegionName { get; set; }
+public string ThemesContentName { get; set; }
+private Visibility splitScreenViewVisible = Visibility.Collapsed;
+
+/// <summary>
+    /// 控制Content的显示 用于显示分屏的模块
+/// </summary>
+public Visibility SplitScreenViewVisible
+{
+get { return splitScreenViewVisible; }
+set
+{
+SetProperty(ref splitScreenViewVisible, value);
+}
+}
+
+private bool isContinue;
+
+public bool IsContinue
+{
+get { return isContinue; }
+set
+{
+SetProperty(ref isContinue, value);
+if (value)
+{
+SetModeView();
+}
+}
+}
+
+private bool isPagesBreak = true;
+
+public bool IsPagesBreak
+{
+get { return isPagesBreak; }
+set
+{
+SetProperty(ref isPagesBreak, value);
+}
+}
+
+private bool isSingleView;
+
+public bool IsSingleView
+{
+get { return isSingleView; }
+set
+{
+SetProperty(ref isSingleView, value);
+if (value)
+{
+SetModeView();
+}
+}
+}
+
+private bool isTwoPageView;
+
+public bool IsTwoPageView
+{
+get { return isTwoPageView; }
+set
+{
+SetProperty(ref isTwoPageView, value);
+if (value)
+{
+SetModeView();
+}
+}
+}
+
+private bool isBookModeView;
+
+public bool IsBookModeView
+{
+get { return isBookModeView; }
+set
+{
+SetProperty(ref isBookModeView, value);
+if (value)
+{
+SetModeView();
+}
+}
+}
+
+public DelegateCommand<object> SplitScreenCommand { get; set; }
+    public DelegateCommand<object> DisableCommand { get; set; }
 
         public DelegateCommand SetViewModeCommand { get; set; }
         public DelegateCommand<object> ContinueCommand { get; set; }
-        public DelegateCommand<object> PagesBreakCommand { get; set; }
-
-        public DelegateCommand<object> RotateCommand { get; set; }
-
-        public ViewModularContentViewModel(IRegionManager regionManager, IDialogService dialogService)
-        {
-            region = regionManager;
-            dialogs = dialogService;
-            //未显示时无法注册上Region名称,所以需要短暂显示
-            SplitScreenViewVisible = Visibility.Visible;
-            SplitScreenViewRegionName = RegionNames.SplitScreenViewRegionName;
-            ThemesContentName = RegionNames.ThemesContentName;
-            SplitScreenViewVisible = Visibility.Collapsed;
-
-            VerticalSplitScreenCommand = new DelegateCommand<object>(VerticalSplitScreenEvent);
-            DisableCommand = new DelegateCommand<object>(DisableEvent);
-            SetViewModeCommand = new DelegateCommand(SetModeView);
-            ContinueCommand = new DelegateCommand<object>(ContinueEvent);
-            PagesBreakCommand = new DelegateCommand<object>(PagesBreakEvent);
-            RotateCommand = new DelegateCommand<object>(RotateEvent);
-
-            //在构造函数中使用Region需要借助Dispatcher 确保UI已经加载完成,加载BOTA区域
-            System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
-            {
-                NavigationParameters parameters = new NavigationParameters();
-                parameters.Add(ParameterNames.PDFViewer, PDFViewer);
-                region.RequestNavigate(RegionNames.ThemesContentName, "ThemesContent", parameters);
-            }
-            ));
-        }
-
-        /// <summary>
-        /// 旋转
-        /// </summary>
-        /// <param name="obj"></param>
-        private void RotateEvent(object obj)
-        {
-            bool right = Convert.ToBoolean(obj);
-
-            PDFViewer.RotatePage(PageRotate.Rotate90, right, PDFViewer.CurrentIndex);
-
-            //后续需要添加,缩略图旋转改变
-
-            PDFViewer.UndoManager.CanSave = true;
-        }
-
-        /// <summary>
-        /// 分页符
-        /// </summary>
-        /// <param name="obj"></param>
-        private void PagesBreakEvent(object obj)
-        {
-            if (IsPagesBreak)
-            {
-                PDFViewer.SetPageSpacing(8);
-                IsPagesBreak = true;
-            }
-            else
-            {
-                PDFViewer.SetPageSpacing(0);
-                IsPagesBreak = false;
-            }
-            SaveMode(IsPagesBreak);
-        }
-
-        /// <summary>
-        /// 设置显示模式
-        /// </summary>
-        private void SetModeView()
-        {
-            if (PDFViewer != null)
-            {
-                if (IsContinue)
-                {
-                    if (IsSingleView)
-                    {
-                        PDFViewer.ChangeViewMode(ViewMode.SingleContinuous);
-                    }
-                    else if (IsTwoPageView)
-                    {
-                        PDFViewer.ChangeViewMode(ViewMode.DoubleContinuous);
-                    }
-                    else
-                    {
-                        PDFViewer.ChangeViewMode(ViewMode.BookContinuous);
-                    }
-                }
-                else
-                {
-                    if (IsSingleView)
-                    {
-                        PDFViewer.ChangeViewMode(ViewMode.Single);
-                    }
-                    else if (IsTwoPageView)
-                    {
-                        PDFViewer.ChangeViewMode(ViewMode.Double);
-                    }
-                    else
+            public DelegateCommand<object> PagesBreakCommand { get; set; }
+
+                public DelegateCommand<object> RotateCommand { get; set; }
+
+                    public ViewModularContentViewModel(IRegionManager regionManager, IDialogService dialogService)
                     {
-                        PDFViewer.ChangeViewMode(ViewMode.Book);
-                    }
-                }
-            }
-            SaveMode(PDFViewer.ModeView);
-        }
-
-        /// <summary>
-        /// 连续滚动
-        /// </summary>
-        /// <param name="obj"></param>
-        private void ContinueEvent(object obj)
-        {
-            SetModeView();
-        }
-
-        /// <summary>
-        /// 保存模式到本地
-        /// </summary>
-        /// <param name="modeView"></param>
-        private void SaveMode(object modeView)
-        {
-            OpenFileInfo fileInfo = SettingHelper.GetFileInfo(PDFViewer.Document.FilePath);
-            if (fileInfo != null)
-            {
-                if (modeView is SplitMode)
-                {
-                    fileInfo.LastSplitMode = PDFViewer.Mode;
-                }
-                else if (modeView is ViewMode)
-                {
-                    fileInfo.LastViewMode = PDFViewer.ModeView;
-                }
-                else if (modeView is bool)
-                {
-                    fileInfo.LastPageSpace = (bool)modeView;
-                }
-                SettingHelper.SetFileInfo(fileInfo);
-            }
-        }
-
-        /// <summary>
-        /// 分屏视图-单屏
-        /// </summary>
-        /// <param name="obj"></param>
-        private void DisableEvent(object obj)
-        {
-            SplitScreenViewVisible = Visibility.Collapsed;
-        }
-
-        /// <summary>
-        /// 分屏视图-垂直
-        /// </summary>
-        /// <param name="obj"></param>
-        private void VerticalSplitScreenEvent(object obj)
-        {
-            SplitScreenViewVisible = Visibility.Visible;
-            NavigationParameters param = new NavigationParameters();
-            param.Add(ParameterNames.PDFViewer, PDFViewer);
-            region.RequestNavigate(RegionNames.SplitScreenViewRegionName, "SplitScreenContent", param);
-        }
-
-        public bool IsNavigationTarget(NavigationContext navigationContext)
-        {
-            return true;
-        }
-
-        public void OnNavigatedFrom(NavigationContext navigationContext)
-        {
-        }
-
-        public void OnNavigatedTo(NavigationContext navigationContext)
-        {
-            CPDFViewer pdfview = navigationContext.Parameters[ParameterNames.PDFViewer] as CPDFViewer;
-            BottomToolContentViewModel btnTool = navigationContext.Parameters["BottomToolContentViewModel"] as BottomToolContentViewModel;
-            if (pdfview != null && btnTool != null)
-            {
-                BottomToolContentViewModel = btnTool;
-                PDFViewer = pdfview;
-            }
-            else
-            {
-                return;
-            }
-            
-            IsSingleView = BottomToolContentViewModel.IsSingleView;
-            IsTwoPageView = BottomToolContentViewModel.IsDoubleView;
-            IsBookModeView = BottomToolContentViewModel.IsBookMode;
-            IsContinue = BottomToolContentViewModel.IsContinue;
-            PDFViewer.InfoChanged += PDFViewer_InfoChanged;
-        }
-
-        /// <summary>
-        /// 和底部工具栏联动
-        /// </summary>
-        /// <param name="sender"></param>
-        /// <param name="e"></param>
-        private void PDFViewer_InfoChanged(object sender, KeyValuePair<string, object> e)
-        {
-            if (e.Key == "ViewMode")
-            {
-                GetModeView((ViewMode)e.Value);
-            }
-        }
-
-        private void GetModeView(ViewMode mode)
-        {
-            if ((int)mode % 2 == 0)
-            {
-                if (!IsContinue)
-                {
-                    IsContinue = true;
-                }
-            }
-            else
-            {
-                if (IsContinue)
-                {
-                    IsContinue = false;
-                }
-            }
-
-            if ((int)mode <= 2)
-            {
-                if (!isSingleView)
-                {
-                    IsSingleView = true;
-                }
-            }
-            else if ((int)mode <= 4)
-            {
-                if (!isTwoPageView)
-                {
-                    IsTwoPageView = true;
-                }
-            }
-            else
-            {
-                if (!isBookModeView)
-                {
-                    IsBookModeView = true;
-                }
-            }
-        }
-    }
-}
+                    region = regionManager;
+                    dialogs = dialogService;
+                    //未显示时无法注册上Region名称,所以需要短暂显示
+                    SplitScreenViewVisible = Visibility.Visible;
+                    SplitScreenViewRegionName = RegionNames.SplitScreenViewRegionName;
+                    ThemesContentName = RegionNames.ThemesContentName;
+                    SplitScreenViewVisible = Visibility.Collapsed;
+
+                    SplitScreenCommand = new DelegateCommand<object>(SplitScreenEvent);
+                        DisableCommand = new DelegateCommand<object>(DisableEvent);
+                            SetViewModeCommand = new DelegateCommand(SetModeView);
+                            ContinueCommand = new DelegateCommand<object>(ContinueEvent);
+                                PagesBreakCommand = new DelegateCommand<object>(PagesBreakEvent);
+                                    RotateCommand = new DelegateCommand<object>(RotateEvent);
+
+                                        //在构造函数中使用Region需要借助Dispatcher 确保UI已经加载完成,加载BOTA区域
+System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
+                                            {
+                                            NavigationParameters parameters = new NavigationParameters();
+                                            parameters.Add(ParameterNames.PDFViewer, PDFViewer);
+                                            region.RequestNavigate(RegionNames.ThemesContentName, "ThemesContent", parameters);
+                                            }
+                                            ));
+                                            }
+
+                                            /// <summary>
+                                                /// 旋转
+                                            /// </summary>
+                                            /// <param name="obj"></param>
+                                            private void RotateEvent(object obj)
+                                            {
+                                            bool right = Convert.ToBoolean(obj);
+
+                                            PDFViewer.RotatePage(PageRotate.Rotate90, right, PDFViewer.CurrentIndex);
+
+                                            //后续需要添加,缩略图旋转改变
+
+                                            PDFViewer.UndoManager.CanSave = true;
+                                            }
+
+                                            /// <summary>
+                                                /// 分页符
+                                            /// </summary>
+                                            /// <param name="obj"></param>
+                                            private void PagesBreakEvent(object obj)
+                                            {
+                                            if (IsPagesBreak)
+                                            {
+                                            PDFViewer.SetPageSpacing(8);
+                                            IsPagesBreak = true;
+                                            }
+                                            else
+                                            {
+                                            PDFViewer.SetPageSpacing(0);
+                                            IsPagesBreak = false;
+                                            }
+                                            SaveMode(IsPagesBreak);
+                                            }
+
+                                            /// <summary>
+                                                /// 设置显示模式
+                                            /// </summary>
+                                            private void SetModeView()
+                                            {
+                                            if (PDFViewer != null)
+                                            {
+                                            if (IsContinue)
+                                            {
+                                            if (IsSingleView)
+                                            {
+                                            PDFViewer.ChangeViewMode(ViewMode.SingleContinuous);
+                                            }
+                                            else if (IsTwoPageView)
+                                            {
+                                            PDFViewer.ChangeViewMode(ViewMode.DoubleContinuous);
+                                            }
+                                            else
+                                            {
+                                            PDFViewer.ChangeViewMode(ViewMode.BookContinuous);
+                                            }
+                                            }
+                                            else
+                                            {
+                                            if (IsSingleView)
+                                            {
+                                            PDFViewer.ChangeViewMode(ViewMode.Single);
+                                            }
+                                            else if (IsTwoPageView)
+                                            {
+                                            PDFViewer.ChangeViewMode(ViewMode.Double);
+                                            }
+                                            else
+                                            {
+                                            PDFViewer.ChangeViewMode(ViewMode.Book);
+                                            }
+                                            }
+                                            }
+                                            SaveMode(PDFViewer.ModeView);
+                                            }
+
+                                            /// <summary>
+                                                /// 连续滚动
+                                            /// </summary>
+                                            /// <param name="obj"></param>
+                                            private void ContinueEvent(object obj)
+                                            {
+                                            SetModeView();
+                                            }
+
+                                            /// <summary>
+                                                /// 保存模式到本地
+                                            /// </summary>
+                                            /// <param name="modeView"></param>
+                                            private void SaveMode(object modeView)
+                                            {
+                                            OpenFileInfo fileInfo = SettingHelper.GetFileInfo(PDFViewer.Document.FilePath);
+                                            if (fileInfo != null)
+                                            {
+                                            if (modeView is SplitMode)
+                                            {
+                                            fileInfo.LastSplitMode = PDFViewer.Mode;
+                                            }
+                                            else if (modeView is ViewMode)
+                                            {
+                                            fileInfo.LastViewMode = PDFViewer.ModeView;
+                                            }
+                                            else if (modeView is bool)
+                                            {
+                                            fileInfo.LastPageSpace = (bool)modeView;
+                                            }
+                                            SettingHelper.SetFileInfo(fileInfo);
+                                            }
+                                            }
+
+                                            /// <summary>
+                                                /// 分屏视图-单屏
+                                            /// </summary>
+                                            /// <param name="obj"></param>
+                                            private void DisableEvent(object obj)
+                                            {
+                                            SplitScreenViewVisible = Visibility.Collapsed;
+                                            }
+
+                                            /// <summary>
+                                                /// 分屏视图-垂直
+                                            /// </summary>
+                                            /// <param name="obj"></param>
+                                            private void SplitScreenEvent(object obj)
+                                            {
+                                            //SplitScreenViewVisible = Visibility.Visible;
+                                            //NavigationParameters param = new NavigationParameters();
+                                            //param.Add(ParameterNames.PDFViewer, PDFViewer);
+                                            //region.RequestNavigate(RegionNames.SplitScreenViewRegionName, "SplitScreenContent", param);
+                                            PDFViewer.SetSplitMode(SplitMode.Horizontal);
+
+                                            OpenFileInfo fileInfo = SettingHelper.GetFileInfo(PDFViewer.Document.FilePath);
+                                            if (fileInfo != null)
+                                            {
+                                            //if (Mode is SplitMode)
+                                            fileInfo.LastSplitMode = PDFViewer.Mode;
+                                            //else if (Mode is ViewMode)
+                                            //    fileInfo.LastViewMode = PDFViewer.ModeView;
+                                            //else if (Mode is bool)
+                                            //    fileInfo.LastPageSpace = (bool)Mode;
+                                            SettingHelper.SetFileInfo(fileInfo);
+                                            }
+                                            }
+
+                                            public bool IsNavigationTarget(NavigationContext navigationContext)
+                                            {
+                                            return true;
+                                            }
+
+                                            public void OnNavigatedFrom(NavigationContext navigationContext)
+                                            {
+                                            }
+
+                                            public void OnNavigatedTo(NavigationContext navigationContext)
+                                            {
+                                            CPDFViewer pdfview = navigationContext.Parameters[ParameterNames.PDFViewer] as CPDFViewer;
+                                            BottomToolContentViewModel btnTool = navigationContext.Parameters["BottomToolContentViewModel"] as BottomToolContentViewModel;
+                                            if (pdfview != null && btnTool != null)
+                                            {
+                                            BottomToolContentViewModel = btnTool;
+                                            PDFViewer = pdfview;
+                                            }
+                                            else
+                                            {
+                                            return;
+                                            }
+
+                                            IsSingleView = BottomToolContentViewModel.IsSingleView;
+                                            IsTwoPageView = BottomToolContentViewModel.IsDoubleView;
+                                            IsBookModeView = BottomToolContentViewModel.IsBookMode;
+                                            IsContinue = BottomToolContentViewModel.IsContinue;
+                                            PDFViewer.InfoChanged += PDFViewer_InfoChanged;
+                                            }
+
+                                            /// <summary>
+                                                /// 和底部工具栏联动
+                                            /// </summary>
+                                            /// <param name="sender"></param>
+                                            /// <param name="e"></param>
+                                            private void PDFViewer_InfoChanged(object sender, KeyValuePair<string, object> e)
+                                                {
+                                                if (e.Key == "ViewMode")
+                                                {
+                                                GetModeView((ViewMode)e.Value);
+                                                }
+                                                }
+
+                                                private void GetModeView(ViewMode mode)
+                                                {
+                                                if ((int)mode % 2 == 0)
+                                                {
+                                                if (!IsContinue)
+                                                {
+                                                IsContinue = true;
+                                                }
+                                                }
+                                                else
+                                                {
+                                                if (IsContinue)
+                                                {
+                                                IsContinue = false;
+                                                }
+                                                }
+
+                                                if ((int)mode <= 2)
+                                                   {
+                                                   if (!isSingleView)
+                                                   {
+                                                   IsSingleView = true;
+                                                   }
+                                                   }
+                                                else if ((int)mode <= 4)
+                                                   {
+                                                   if (!isTwoPageView)
+                                                   {
+                                                   IsTwoPageView = true;
+                                                   }
+                                                   }
+                                                   else
+                                                   {
+                                                   if (!isBookModeView)
+                                                   {
+                                                   IsBookModeView = true;
+                                                   }
+                                                   }
+                                                   }
+                                                   }
+                                                   }

+ 61 - 4
PDF Office/Views/PropertyPanel/ViewModular/SplitScreenContent.xaml

@@ -9,13 +9,70 @@
     xmlns:local="clr-namespace:PDF_Office.Views.PropertyPanel.ViewModular"
     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
     xmlns:prism="http://prismlibrary.com/"
-    Width="256"
+    Width="500"
     d:DataContext="{d:DesignInstance Type=ViewModular:SplitScreenContentViewModel}"
-    d:DesignHeight="200"
-    d:DesignWidth="256"
+    d:DesignHeight="700"
+    d:DesignWidth="500"
     prism:ViewModelLocator.AutoWireViewModel="True"
     mc:Ignorable="d">
     <Grid>
-        <TextBlock FontSize="20" Text="分屏显示" />
+        <StackPanel
+            HorizontalAlignment="Center"
+            VerticalAlignment="Center"
+            Orientation="Vertical">
+            <Border BorderThickness="2" CornerRadius="4">
+                <Border.BorderBrush>
+                    <VisualBrush>
+                        <VisualBrush.Visual>
+                            <Rectangle
+                                Width="{Binding RelativeSource={RelativeSource AncestorType={x:Type Border}}, Path=ActualWidth}"
+                                Height="{Binding RelativeSource={RelativeSource AncestorType={x:Type Border}}, Path=ActualHeight}"
+                                Stroke="Black"
+                                StrokeDashArray="4 3" />
+                        </VisualBrush.Visual>
+                    </VisualBrush>
+                </Border.BorderBrush>
+                <Button
+                    x:Name="BtnAddFiles"
+                    Width="124"
+                    Height="164"
+                    Background="Transparent"
+                    Style="{StaticResource btn.icon-fill}">
+                    <Button.Content>
+                        <Path Data="M13.3333 16.6667V30H16.6667V16.6667H30V13.3333H16.6667V0H13.3333V13.3333H0V16.6667H13.3333Z" Fill="#94989C" />
+                    </Button.Content>
+                </Button>
+            </Border>
+            <Grid Margin="0,50,0,0">
+                <Grid.ColumnDefinitions>
+                    <ColumnDefinition />
+                    <ColumnDefinition />
+                </Grid.ColumnDefinitions>
+
+                <Button
+                    Grid.Column="0"
+                    Margin="20,5"
+                    Background="White"
+                    Content="Select PDF"
+                    Foreground="#252629"
+                    Style="{StaticResource btn.link}" />
+                <StackPanel
+                    Grid.Column="1"
+                    Background="Transparent"
+                    Orientation="Vertical">
+                    <Button
+                        x:Name="BtnSelectedFiles"
+                        Width="25"
+                        Height="25"
+                        Background="#EDEEF0"
+                        Style="{StaticResource btn.icon-fill}">
+                        <Button.Content>
+                            <Path Data="M6 7.56427L2.03039 3.59467L0.969727 4.65533L5.46967 9.15526C5.76256 9.44816 6.23743 9.44816 6.53033 9.15526L11.0303 4.65533L9.9696 3.59467L6 7.56427Z" Fill="#94989C" />
+                        </Button.Content>
+                    </Button>
+                    <ListBox x:Name="ListSelectedFiles" />
+                </StackPanel>
+            </Grid>
+        </StackPanel>
     </Grid>
 </UserControl>

+ 20 - 17
PDF Office/Views/PropertyPanel/ViewModular/ViewModularContent.xaml

@@ -46,7 +46,7 @@
                     Command="{Binding SetViewModeCommand}"
                     GroupName="DisplayMode"
                     IsChecked="{Binding IsSingleView}"
-                    Style="{StaticResource SplitModeViewRadioBtn}">
+                    Style="{StaticResource ViewModeViewRadioBtn}">
                     <StackPanel Margin="0,0,3,0">
                         <Path
                             Margin="0,0,0,8"
@@ -61,11 +61,11 @@
                 </RadioButton>
                 <RadioButton
                     Name="RBtnTwoPage"
-                    Margin="2,0,2,0"
+                    Margin="4,0,4,0"
                     Command="{Binding SetViewModeCommand}"
                     GroupName="DisplayMode"
                     IsChecked="{Binding IsTwoPageView}"
-                    Style="{StaticResource SplitModeViewRadioBtn}">
+                    Style="{StaticResource ViewModeViewRadioBtn}">
                     <StackPanel Margin="0,0,3,0">
                         <Path
                             Margin="0,0,0,8"
@@ -80,11 +80,11 @@
                 </RadioButton>
                 <RadioButton
                     Name="RBtnBookMode"
-                    Margin="0,0,2,0"
+                    Margin="0,0,4,0"
                     Command="{Binding SetViewModeCommand}"
                     GroupName="DisplayMode"
                     IsChecked="{Binding IsBookModeView}"
-                    Style="{StaticResource SplitModeViewRadioBtn}">
+                    Style="{StaticResource ViewModeViewRadioBtn}">
                     <StackPanel Margin="0,0,3,0">
                         <Grid
                             Width="16"
@@ -114,13 +114,13 @@
                     </StackPanel>
                 </RadioButton>
             </StackPanel>
-            <StackPanel Orientation="Horizontal">
+            <StackPanel Orientation="Horizontal" Margin="0,5,0,0">
                 <RadioButton
                     Name="RbtnReadMode"
                     HorizontalAlignment="Left"
                     Click="RbtnReadMode_Click"
 
-                    Style="{StaticResource SplitModeViewRadioBtn}">
+                    Style="{StaticResource ViewModeViewRadioBtn}">
                     <StackPanel Margin="0,0,3,0">
                         <Grid
                             Margin="0,0,0,8"
@@ -140,10 +140,10 @@
                 </RadioButton>
                 <RadioButton
                     Name="RBtnFullScreen"
-                    Margin="2,0,2,0"
+                    Margin="4,0,4,0"
                     GroupName="DisplayMode"
                     IsChecked="{Binding IsTwoPageView}"
-                    Style="{StaticResource SplitModeViewRadioBtn}">
+                    Style="{StaticResource ViewModeViewRadioBtn}">
                     <StackPanel Margin="0,0,3,0">
                         <Path
                             Margin="0,0,0,8"
@@ -158,10 +158,10 @@
                 </RadioButton>
                 <RadioButton
                     Name="RBtnSlide"
-                    Margin="0,0,2,0"
+                    Margin="0,0,4,0"
                     GroupName="DisplayMode"
                     IsChecked="{Binding IsBookModeView}"
-                    Style="{StaticResource SplitModeViewRadioBtn}">
+                    Style="{StaticResource ViewModeViewRadioBtn}">
                     <StackPanel Margin="0,0,3,0">
                         <Grid
                             Width="16"
@@ -282,8 +282,9 @@
                         Name="RbtnDisable"
                         Command="{Binding DisableCommand}"
                         GroupName="SplitMode"
+                        Tag="Disable"
                         IsChecked="True"
-                        Style="{StaticResource SplitModeViewRadioBtn}">
+                        Style="{StaticResource ViewModeViewRadioBtn}">
                         <StackPanel Margin="0,0,3,0">
                             <Path
                                 Margin="0,0,0,8"
@@ -298,10 +299,11 @@
                     </RadioButton>
                     <RadioButton
                         Name="RbtnVerticalSplit"
-                        Margin="5,0,5,0"
-                        Command="{Binding VerticalSplitScreenCommand}"
+                        Margin="4,0,4,0"
+                        Tag="VerticalSplit"
+                        Command="{Binding SplitScreenCommand}"
                         GroupName="SplitMode"
-                        Style="{StaticResource SplitModeViewRadioBtn}">
+                        Style="{StaticResource ViewModeViewRadioBtn}">
                         <StackPanel Margin="0,0,3,0">
                             <Path
                                 Margin="0,0,0,8"
@@ -316,9 +318,10 @@
                     </RadioButton>
                     <RadioButton
                         Name="RbtnHorizontalSplit"
-                        Command="{Binding VerticalSplitScreenCommand}"
+                        Command="{Binding SplitScreenCommand}"
                         GroupName="SplitMode"
-                        Style="{StaticResource SplitModeViewRadioBtn}">
+                        Tag="HorizontalSplit"
+                        Style="{StaticResource ViewModeViewRadioBtn}">
                         <StackPanel Margin="0,0,3,0">
                             <Path
                                 Margin="0,0,0,8"