Browse Source

视图-补充打开全屏功能

ZhouJieSheng 2 years ago
parent
commit
2daf82118f

+ 35 - 0
PDF Office/Styles/RadioButtonStyle.xaml

@@ -541,4 +541,39 @@
             </Setter.Value>
         </Setter>
     </Style>
+
+    <!--  底部工具栏的RadionButton StateBar  Design Token  -->
+    <Style x:Key="StateBarRbt" TargetType="{x:Type RadioButton}">
+        <Setter Property="Foreground" Value="{StaticResource color.icon.base.neutral.norm.lv1}" />
+        <Setter Property="Background" Value="Transparent" />
+        <Setter Property="FontSize" Value="18" />
+        <Setter Property="Cursor" Value="Hand" />
+        <Setter Property="Margin" Value="0,0,10,10" />
+        <Setter Property="Height" Value="32" />
+        <Setter Property="Template">
+            <Setter.Value>
+                <ControlTemplate TargetType="{x:Type RadioButton}">
+                    <Border
+                        x:Name="fore"
+                        Background="{TemplateBinding Background}"
+                        BorderThickness="0"
+                        CornerRadius="{StaticResource border-radius.4}">
+                        <ContentPresenter
+                            x:Name="content"
+                            HorizontalAlignment="Center"
+                            VerticalAlignment="Center"
+                            Content="{TemplateBinding Content}" />
+                    </Border>
+                    <ControlTemplate.Triggers>
+                        <Trigger Property="IsChecked" Value="true">
+                            <Setter TargetName="fore" Property="Background" Value="{StaticResource color.item-state.sel.bg.lv2}" />
+                        </Trigger>
+                        <Trigger Property="IsMouseOver" Value="True">
+                            <Setter TargetName="fore" Property="Background" Value="{StaticResource color.item-state.hov.bg}" />
+                        </Trigger>
+                    </ControlTemplate.Triggers>
+                </ControlTemplate>
+            </Setter.Value>
+        </Setter>
+    </Style>
 </ResourceDictionary>

+ 1 - 1
PDF Office/Styles/ToggleButton.xaml

@@ -29,7 +29,7 @@
                     </Border>
                     <ControlTemplate.Triggers>
                         <Trigger Property="IsMouseOver" Value="True">
-                            <Setter TargetName="border" Property="Panel.Background" Value="{StaticResource color.item-state.sel.bg.lv2}" />
+                            <Setter TargetName="border" Property="Panel.Background" Value="{StaticResource color.item-state.hov.bg}" />
                         </Trigger>
                         <Trigger Property="IsPressed" Value="True">
                             <Setter TargetName="border" Property="Panel.Background" Value="{StaticResource color.item-state.sel.bg.lv2}" />

+ 1 - 21
PDF Office/ViewModels/BottomToolContentViewModel.cs

@@ -189,7 +189,6 @@ namespace PDF_Office.ViewModels
             PageTextKeyDownCommand = new DelegateCommand<object>(PageNumText_KeyDown);
             PageTextPreviewKeyDownCommand = new DelegateCommand<object>(PageNumText_PreviewKeyDown);
             SelectionChangedCommand = new DelegateCommand<object>(SelectionChangedEvent);
-            OpenFullCommand = new DelegateCommand(OpenFullWindow);
             ShowViewModularCommand = new DelegateCommand<object>(ShowViewModularEvent);
         }
 
@@ -211,26 +210,7 @@ namespace PDF_Office.ViewModels
             IsShowViewModular = ViewContentViewModel.IsPropertyOpen;
         }
 
-        /// <summary>
-        /// 进入全屏模式
-        /// </summary>
-        private void OpenFullWindow()
-        {
-            DialogParameters parameters = new DialogParameters();
-            //因为全屏模式可能需要设置特定的页面模式,所以只传文件路径,新建一个PDFview对象
-            parameters.Add(ParameterNames.FilePath, PDFViewer.Document.FilePath);
-            parameters.Add(ParameterNames.PassWord, PDFViewer.Tag == null ? "" : PDFViewer.Tag.ToString());
-            dialogs.ShowDialog(DialogNames.FullScreenDialog, parameters, e =>
-            {
-                if (e.Result == ButtonResult.Cancel)
-                {
-                    //TODO:弹窗提示打开全屏模式失败
-                    AlertsMessage alertsMessage = new AlertsMessage();
-                    alertsMessage.ShowDialog("", "Error", "OK");
-                    return;
-                }
-            });
-        }
+
 
         private void SelectionChangedEvent(object e)
         {

+ 25 - 0
PDF Office/ViewModels/PropertyPanel/ViewModular/ViewModularContentViewModel.cs

@@ -1,6 +1,7 @@
 using ComPDFKitViewer;
 using ComPDFKitViewer.PdfViewer;
 using Microsoft.Office.Interop.Word;
+using PDF_Office.CustomControl;
 using PDF_Office.Helper;
 using PDF_Office.Model;
 using PDF_Office.ViewModels.BOTA;
@@ -129,6 +130,8 @@ namespace PDF_Office.ViewModels.PropertyPanel.ViewModular
 
         public DelegateCommand<object> RotateCommand { get; set; }
 
+        public DelegateCommand OpenFullCommand { get; set; }
+
         public ViewModularContentViewModel(IRegionManager regionManager, IDialogService dialogService)
         {
             region = regionManager;
@@ -145,6 +148,7 @@ namespace PDF_Office.ViewModels.PropertyPanel.ViewModular
             ContinueCommand = new DelegateCommand<object>(ContinueEvent);
             PagesBreakCommand = new DelegateCommand<object>(PagesBreakEvent);
             RotateCommand = new DelegateCommand<object>(RotateEvent);
+            OpenFullCommand = new DelegateCommand(OpenFullWindow);
 
             //在构造函数中使用Region需要借助Dispatcher 确保UI已经加载完成,加载BOTA区域
             System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
@@ -157,6 +161,27 @@ namespace PDF_Office.ViewModels.PropertyPanel.ViewModular
             ));
         }
 
+        /// <summary>
+        /// 进入全屏模式
+        /// </summary>
+        private void OpenFullWindow()
+        {
+            DialogParameters parameters = new DialogParameters();
+            //因为全屏模式可能需要设置特定的页面模式,所以只传文件路径,新建一个PDFview对象
+            parameters.Add(ParameterNames.FilePath, PDFViewer.Document.FilePath);
+            parameters.Add(ParameterNames.PassWord, PDFViewer.Tag == null ? "" : PDFViewer.Tag.ToString());
+            dialogs.ShowDialog(DialogNames.FullScreenDialog, parameters, e =>
+            {
+                if (e.Result == ButtonResult.Cancel)
+                {
+                    //TODO:弹窗提示打开全屏模式失败
+                    AlertsMessage alertsMessage = new AlertsMessage();
+                    alertsMessage.ShowDialog("", "Error", "OK");
+                    return;
+                }
+            });
+        }
+
         /// <summary>
         /// 旋转
         /// </summary>

+ 17 - 60
PDF Office/Views/BottomToolContent.xaml

@@ -16,43 +16,7 @@
     BorderBrush="{StaticResource color.sys.layout.divider}"
     BorderThickness="0,1,0,0"
     mc:Ignorable="d">
-    <UserControl.Resources>
-        <Style x:Key="Radion_ButtonStyle" TargetType="{x:Type RadioButton}">
-            <Setter Property="Foreground" Value="Black" />
-            <Setter Property="Background" Value="White" />
-            <Setter Property="FontSize" Value="18" />
-            <Setter Property="Cursor" Value="Hand" />
-            <Setter Property="Margin" Value="0,0,10,10" />
-            <Setter Property="Height" Value="32" />
-            <Setter Property="Template">
-                <Setter.Value>
-                    <ControlTemplate TargetType="{x:Type RadioButton}">
-                        <Border
-                            x:Name="fore"
-                            Background="White"
-                            BorderThickness="0"
-                            CornerRadius="0">
-                            <ContentPresenter
-                                x:Name="content"
-                                HorizontalAlignment="Center"
-                                VerticalAlignment="Center"
-                                Content="{TemplateBinding Content}" />
-                        </Border>
-                        <ControlTemplate.Triggers>
-                            <Trigger Property="IsChecked" Value="true">
-                                <Setter TargetName="fore" Property="Background" Value="#575757" />
-                                <Setter Property="Foreground" Value="White" />
-                            </Trigger>
-                            <Trigger Property="IsMouseOver" Value="True">
-                                <Setter TargetName="fore" Property="Background" Value="#575757" />
-                                <Setter Property="Foreground" Value="White" />
-                            </Trigger>
-                        </ControlTemplate.Triggers>
-                    </ControlTemplate>
-                </Setter.Value>
-            </Setter>
-        </Style>
-    </UserControl.Resources>
+    <UserControl.Resources />
     <Grid Height="32" Background="{StaticResource color.sys.layout.mg}">
         <Grid.ColumnDefinitions>
             <ColumnDefinition Width="*" />
@@ -158,10 +122,11 @@
                 Height="24"
                 Margin="4"
                 Command="{Binding SetViewModeCommand}"
-                IsChecked="{Binding IsContinue}">
+                IsChecked="{Binding IsContinue}"
+                Style="{StaticResource SubToolbarTgb}">
                 <Grid>
-                    <Polygon Fill="Black" Points="2 0 2 6 14 6 14 0 15 0 15 7 1 7 1 0" />
-                    <Path Data="M10.807106,9 L15,13.3928931 L15,16 L14,16 L14,14 L9.999999,14 L9.999,10 L2,10 L2,16 L1,16 L1,9 L10.807106,9 Z M13.237,13 L10.999,10.64 L10.999,13 L13.237,13 Z" Fill="Black" />
+                    <Polygon Fill="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ToggleButton}, Path=Foreground}" Points="2 0 2 6 14 6 14 0 15 0 15 7 1 7 1 0" />
+                    <Path Data="M10.807106,9 L15,13.3928931 L15,16 L14,16 L14,14 L9.999999,14 L9.999,10 L2,10 L2,16 L1,16 L1,9 L10.807106,9 Z M13.237,13 L10.999,10.64 L10.999,13 L13.237,13 Z" Fill="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ToggleButton}, Path=Foreground}" />
                 </Grid>
             </ToggleButton>
             <Separator
@@ -174,8 +139,8 @@
                 Margin="4"
                 Command="{Binding SetViewModeCommand}"
                 IsChecked="{Binding IsSingleView}"
-                Style="{StaticResource Radion_ButtonStyle}">
-                <Path Data="M9.80710597,0 L14,4.39289312 L14,16 L2,16 L2,0 L9.80710597,0 Z M8.999,1 L3,1 L3,15 L13,15 L13,4.999 L8.999999,5 L8.999,1 Z M12.236,3.999 L9.999,1.64 L9.999,4 L12.236,3.999 Z" Fill="Black" />
+                Style="{StaticResource StateBarRbt}">
+                <Path Data="M9.80710597,0 L14,4.39289312 L14,16 L2,16 L2,0 L9.80710597,0 Z M8.999,1 L3,1 L3,15 L13,15 L13,4.999 L8.999999,5 L8.999,1 Z M12.236,3.999 L9.999,1.64 L9.999,4 L12.236,3.999 Z" Fill="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=RadioButton}, Path=Foreground}" />
             </RadioButton>
 
             <RadioButton
@@ -185,8 +150,8 @@
                 Command="{Binding SetViewModeCommand}"
                 Cursor="Hand"
                 IsChecked="{Binding IsDoubleView}"
-                Style="{StaticResource Radion_ButtonStyle}">
-                <Path Data="M0,15 L0,1 L11.807106,1 L16,5.39289312 L16,15 L0,15 Z M7.5,2 L1,2 L1,14 L7.5,14 L7.5,2 Z M10.999,2 L8.5,2 L8.5,14 L15,14 L15,5.999 L10.999999,6 L10.999,2 Z M11.999,2.64 L11.999,5 L14.236,4.999 L11.999,2.64 Z" Fill="Black" />
+                Style="{StaticResource StateBarRbt}">
+                <Path Data="M0,15 L0,1 L11.807106,1 L16,5.39289312 L16,15 L0,15 Z M7.5,2 L1,2 L1,14 L7.5,14 L7.5,2 Z M10.999,2 L8.5,2 L8.5,14 L15,14 L15,5.999 L10.999999,6 L10.999,2 Z M11.999,2.64 L11.999,5 L14.236,4.999 L11.999,2.64 Z" Fill="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=RadioButton}, Path=Foreground}" />
             </RadioButton>
             <RadioButton
                 Width="24"
@@ -194,17 +159,13 @@
                 Margin="4"
                 Command="{Binding SetViewModeCommand}"
                 IsChecked="{Binding IsBookMode}"
-                Style="{StaticResource Radion_ButtonStyle}">
-                <Path Data="M7,11 L7,16 L6,16 L6,12 L1,12 L1,16 L0,16 L0,11 L7,11 Z M16,11 L16,16 L15,16 L15,12 L10,12 L10,16 L9,16 L9,11 L16,11 Z M3.80710597,0 L7,3.39289312 L7,9 L0,9 L0,0 L3.80710597,0 Z M2.999,1 L1,1 L1,8 L6,8 L6,3.999 L2.999999,4 L2.999,1 Z M3.999,1.652 L3.999,3 L5.251,2.999 L3.999,1.652 Z" Fill="Black" />
+                Style="{StaticResource StateBarRbt}">
+                <Path Data="M7,11 L7,16 L6,16 L6,12 L1,12 L1,16 L0,16 L0,11 L7,11 Z M16,11 L16,16 L15,16 L15,12 L10,12 L10,16 L9,16 L9,11 L16,11 Z M3.80710597,0 L7,3.39289312 L7,9 L0,9 L0,0 L3.80710597,0 Z M2.999,1 L1,1 L1,8 L6,8 L6,3.999 L2.999999,4 L2.999,1 Z M3.999,1.652 L3.999,3 L5.251,2.999 L3.999,1.652 Z" Fill="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=RadioButton}, Path=Foreground}" />
             </RadioButton>
             <Separator
                 Width="1"
                 Height="10"
                 Style="{StaticResource {x:Static ToolBar.SeparatorStyleKey}}" />
-            <Button
-                Width="24"
-                Height="24"
-                Margin="4" />
 
             <ToggleButton
                 Name="TbtnIsViewPanelOpen"
@@ -212,14 +173,17 @@
                 Height="24"
                 Margin="4"
                 Command="{Binding ShowViewModularCommand}"
-                IsChecked="{Binding IsShowViewModular}" />
+                IsChecked="{Binding IsShowViewModular}"
+                Style="{StaticResource SubToolbarTgb}">
+                <Path Data="M1.5 13V3H7.25V13H1.5ZM8.75 13H14.5V3H8.75V13ZM0 2.5C0 1.94772 0.447715 1.5 1 1.5H15C15.5523 1.5 16 1.94772 16 2.5V13.5C16 14.0523 15.5523 14.5 15 14.5H1C0.447715 14.5 0 14.0523 0 13.5V2.5ZM3 6.25H6V7.75H3V6.25ZM6 9.25H3V10.75H6V9.25Z" Fill="{StaticResource color.icon.base.neutral.norm.lv1}" />
+            </ToggleButton>
             <StackPanel
                 Height="16"
                 FocusVisualStyle="{x:Null}"
                 Orientation="Horizontal">
                 <Grid>
                     <ComboBox
-                        Width="52"
+                        Width="72"
                         Background="White"
                         FocusVisualStyle="{x:Null}"
                         MaxDropDownHeight="510"
@@ -313,7 +277,7 @@
                             Tag="1000" />
                     </ComboBox>
                     <TextBlock
-                        Width="31"
+                        Width="45"
                         Height="14"
                         Margin="4,0,0,0"
                         HorizontalAlignment="Left"
@@ -335,13 +299,6 @@
                         Content="-" />
                 </StackPanel>
             </StackPanel>
-            <Button
-                Width="24"
-                Height="24"
-                Margin="4"
-                Command="{Binding OpenFullCommand}">
-                <Path Data="M15,1 L15,6 L14,6 L14,2.706 L2.706,14 L6,14 L6,15 L1,15 L1,10 L2,10 L2,13.292 L13.292,2 L10,2 L10,1 L15,1 Z" Fill="Black" />
-            </Button>
         </StackPanel>
     </Grid>
 </UserControl>

+ 1 - 0
PDF Office/Views/PropertyPanel/ViewModular/ViewModularContent.xaml

@@ -140,6 +140,7 @@
                 <RadioButton
                     Name="RBtnFullScreen"
                     Margin="4,0,4,0"
+                    Command="{Binding OpenFullCommand}"
                     GroupName="DisplayMode"
                     Style="{StaticResource ViewModeViewRadioBtn}">
                     <StackPanel Margin="0,0,3,0">