Browse Source

主页-UI优化,极限宽度为540->640,文件预览进度条->总体进度条

liyijie 1 year ago
parent
commit
71c0d938d1

+ 24 - 1
PDF Office/ViewModels/HomePanel/PDFTools/HomeFilesContentViewModel.cs

@@ -1,4 +1,5 @@
-using Microsoft.Win32;
+using Microsoft.Office.Interop.Word;
+using Microsoft.Win32;
 using PDF_Master.Helper;
 using PDF_Master.Model;
 using Prism.Commands;
@@ -13,6 +14,28 @@ namespace PDF_Master.ViewModels.HomePanel.PDFTools
     public class HomeFilesContentViewModel : BindableBase, INavigationAware
     {
         HomeContentViewModel homeContentViewModel = null;
+
+        private int creatGridRowIndex = 0;
+        public int CreatGridRowIndex
+        {
+            get { return creatGridRowIndex; }
+            set
+            {
+                SetProperty(ref creatGridRowIndex, value);
+            }
+        }
+
+
+        private int creatGridColumnIndex = 1;
+        public int CreatGridColumnIndex
+        {
+            get { return creatGridColumnIndex; }
+            set
+            {
+                SetProperty(ref creatGridColumnIndex, value);
+            }
+        }
+
         public DelegateCommand OpenFileCommand { get; set; }
 
         public DelegateCommand CreateBlackPDFCommand { get; set; }

+ 5 - 5
PDF Office/Views/HomeContent.xaml

@@ -53,7 +53,7 @@
             <RowDefinition />
         </Grid.RowDefinitions>
         <Grid.ColumnDefinitions>
-            <ColumnDefinition Width="270" />
+            <ColumnDefinition Width="248" />
             <ColumnDefinition Width="*" />
         </Grid.ColumnDefinitions>
         <!--  左侧菜单栏  -->
@@ -62,7 +62,7 @@
                 IsChecked="True"
                 x:Name="Home"
                 Height="64"
-                Margin="32,32,32,0"
+                Margin="16,24,16,0"
                 Command="{Binding ShowToolCommand}"
                 CommandParameter="Guid"
                 Foreground="#FFFFFF"
@@ -86,7 +86,7 @@
             </RadioButton>
             <RadioButton
                 Height="64"
-                Margin="32,8,32,0"
+                Margin="16,8,16,0"
                 Command="{Binding ShowToolCommand}"
                 CommandParameter="ChatGPTAITranslationContent"
                 Foreground="#FFFFFF"
@@ -109,7 +109,7 @@
             </RadioButton>
             <RadioButton
                 Height="64"
-                Margin="32,8,32,0"
+                Margin="16,8,16,0"
                 Command="{Binding ShowToolCommand}"
                 CommandParameter="ChatGPTAIRewritingContent"
                 Foreground="#FFFFFF"
@@ -132,7 +132,7 @@
             </RadioButton>
             <RadioButton
                 Height="64"
-                Margin="32,8,32,0"
+                Margin="16,8,16,0"
                 Command="{Binding ShowToolCommand}"
                 CommandParameter="ChatGPTAIErrorCorrectionContent"
                 Foreground="#FFFFFF"

+ 1 - 1
PDF Office/Views/HomePanel/ChatGPTAI/ChatGPTAIErrorCorrectionContent.xaml

@@ -19,7 +19,7 @@
             <convert:SizeToBoolConvert x:Key="SizeToBoolConvert"/>
         </ResourceDictionary>
     </UserControl.Resources>
-    <Grid Margin="32,0,32,0">
+    <Grid Margin="0,0,0,0">
         <Grid.RowDefinitions>
             <RowDefinition Height="*" />
             <RowDefinition Height="1.06*" />

+ 1 - 1
PDF Office/Views/HomePanel/ChatGPTAI/ChatGPTAIRewritingContent.xaml

@@ -19,7 +19,7 @@
             <convert:SizeToBoolConvert x:Key="SizeToBoolConvert"/>
         </ResourceDictionary>
     </UserControl.Resources>
-    <Grid Margin="32,0,32,0">
+    <Grid Margin="0,0,0,0">
         <Grid.RowDefinitions>
             <RowDefinition Height="1*" />
             <RowDefinition Height="1.06*" />

+ 1 - 1
PDF Office/Views/HomePanel/ChatGPTAI/ChatGPTAITranslationContent.xaml

@@ -11,7 +11,7 @@
       mc:Ignorable="d"  
       d:DesignHeight="760" d:DesignWidth="968"
      >
-    <Grid Margin="32,0,32,0" x:Name="TranslationGrid">
+    <Grid Margin="0,0,0,0" x:Name="TranslationGrid">
         <StackPanel>
             <Grid >
                 <TextBlock Text="AI Translation" FontFamily="Segoe UI" Margin="0,16,0,0"

+ 5 - 3
PDF Office/Views/HomePanel/HomeGuidContent.xaml

@@ -15,9 +15,11 @@
     mc:Ignorable="d">
     <Grid>
         <ScrollViewer
+            PreviewMouseWheel="ScrollViewer_PreviewMouseWheel"
+            PanningMode="VerticalFirst"
             x:Name="scrollView"
             VerticalAlignment="Stretch"
-            VerticalScrollBarVisibility="Disabled">
+            VerticalScrollBarVisibility="Visible">
             <Grid>
                 <Grid.RowDefinitions>
                     <RowDefinition Height="Auto" />
@@ -26,11 +28,11 @@
                 <!--快捷工具
                 <pDFTools:QuickToolsContent x:Name="hometool" Margin="32" />-->
                 <ContentControl
-            prism:RegionManager.RegionName="{Binding HomeToolRegionName}" Margin="32"/>
+            prism:RegionManager.RegionName="{Binding HomeToolRegionName}" Margin="24"/>
                 <recentFiles:RecentFilesContent
                     x:Name="Recentlist"
                     Grid.Row="1"
-                    Margin="32,0" />
+                    Margin="24,0" />
             </Grid>
         </ScrollViewer>
     </Grid>

+ 37 - 3
PDF Office/Views/HomePanel/HomeGuidContent.xaml.cs

@@ -1,5 +1,8 @@
-using System.Windows.Controls;
-
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Input;
+using System.Windows.Media;
+
 namespace PDF_Master.Views.HomePanel
 {
     /// <summary>
@@ -11,6 +14,37 @@ namespace PDF_Master.Views.HomePanel
         {
             InitializeComponent();
         }
-
+
+        private void ScrollViewer_PreviewMouseWheel(object sender, MouseWheelEventArgs e)
+        {
+            e.Handled = true;
+            var eventArg = new MouseWheelEventArgs(e.MouseDevice, e.Timestamp, e.Delta)
+            {
+                RoutedEvent = UIElement.MouseWheelEvent,
+                Source = sender
+            };
+            var listView = FindChild<ListView>(sender as DependencyObject);
+            listView.RaiseEvent(eventArg);
+        }
+
+        private static T FindChild<T>(DependencyObject parent) where T : DependencyObject
+        {
+            if (parent == null) return null;
+
+            var foundChild = default(T);
+            var childCount = VisualTreeHelper.GetChildrenCount(parent);
+            for (var i = 0; i < childCount; i++)
+            {
+                var child = VisualTreeHelper.GetChild(parent, i);
+                if (child is T t)
+                {
+                    foundChild = t;
+                    break;
+                }
+                foundChild = FindChild<T>(child);
+                if (foundChild != null) break;
+            }
+            return foundChild;
+        }
     }
 }

File diff suppressed because it is too large
+ 11 - 8
PDF Office/Views/HomePanel/PDFTools/HomeFilesContent.xaml


+ 23 - 1
PDF Office/Views/HomePanel/PDFTools/HomeFilesContent.xaml.cs

@@ -1,4 +1,6 @@
-using System.Windows.Controls;
+using PDF_Master.ViewModels.HomePanel.PDFTools;
+using System.Diagnostics;
+using System.Windows.Controls;
 
 namespace PDF_Master.Views.HomePanel.PDFTools
 {
@@ -7,9 +9,29 @@ namespace PDF_Master.Views.HomePanel.PDFTools
     /// </summary>
     public partial class HomeFilesContent : UserControl
     {
+
+        private HomeFilesContentViewModel viewModel;
+
         public HomeFilesContent()
         {
             InitializeComponent();
+            viewModel= DataContext as HomeFilesContentViewModel;
+        }
+
+        private void StackPanel_SizeChanged(object sender, System.Windows.SizeChangedEventArgs e)
+        {
+            if (Gridroot.ActualWidth<628)
+            {
+                OpenFileStackPanel.Margin=new System.Windows.Thickness(0,0,0,0);
+                viewModel.CreatGridRowIndex = 1;
+                viewModel.CreatGridColumnIndex = 0;
+            }
+            else
+            {
+                OpenFileStackPanel.Margin = new System.Windows.Thickness(0, 0, 20, 0);
+                viewModel.CreatGridRowIndex = 0;
+                viewModel.CreatGridColumnIndex = 1;
+            }
         }
     }
 }

+ 1 - 1
PDF Office/Views/MainWindow.xaml

@@ -14,7 +14,7 @@
     Title="PDF Master"
     Width="1280"
     Height="800"
-    MinWidth="540"
+    MinWidth="640"
     MinHeight="460"
     d:DataContext="{d:DesignInstance Type=viewmodels:MainWindowViewModel}"
     prism:ViewModelLocator.AutoWireViewModel="True"