Quellcode durchsuchen

合并-添加已打开文件部分修复,轻会员-断网窗口调整,窗口激活bug修复

lvle vor 1 Jahr
Ursprung
Commit
aac2b24d99

+ 49 - 1
PDF Office/ViewModels/Dialog/ToolsDialogs/MergeDialogViewModel.cs

@@ -155,7 +155,18 @@ namespace PDF_Master.ViewModels.Dialog.ToolsDialogs
             }
         }
 
-
+        private bool _AddOpenFileIsEn = false;
+        /// <summary>
+        /// 添加已打开文件是否置灰
+        /// </summary>
+        public bool AddOpenFileIsEn
+        {
+            get { return _AddOpenFileIsEn; }
+            set
+            {
+                SetProperty(ref _AddOpenFileIsEn, value);
+            }
+        }
         private string inputHeight;
 
         public string InputHeight
@@ -265,6 +276,7 @@ namespace PDF_Master.ViewModels.Dialog.ToolsDialogs
             {
                 MergeObjectlist[i].ItemIndex = i + 1;
             }
+            AddOpenFileIsEnChange();
         }
 
         private void Cancel()
@@ -324,6 +336,41 @@ namespace PDF_Master.ViewModels.Dialog.ToolsDialogs
             }
         }
 
+        /// <summary>
+        /// 改变添加已打开文件按钮置灰状态
+        /// </summary>
+        private void AddOpenFileIsEnChange()
+        {
+            if(MergeObjectlist.Count> App.OpenedFileList.Count)
+            {
+                AddOpenFileIsEn = true;
+                return;
+            }
+
+            for(int i=0;i<App.OpenedFileList.Count; i++)
+            {
+                for(int j=0;j<MergeObjectlist.Count; j++)
+                {
+                    if(App.OpenedFileList[i]==MergeObjectlist[j].FilePath)
+                    {
+                        break;
+                    }
+                    if(j==MergeObjectlist.Count)
+                    {
+                        AddOpenFileIsEn = false;
+                        return;
+                    }
+                    
+                }
+                if(i==App.OpenedFileList.Count)
+                {
+                    AddOpenFileIsEn = true;
+                    return;
+                }
+            }
+        }
+
+
         private string[] OpenFileFolder()
         {
             System.Windows.Forms.FolderBrowserDialog openFile = new System.Windows.Forms.FolderBrowserDialog();
@@ -564,6 +611,7 @@ namespace PDF_Master.ViewModels.Dialog.ToolsDialogs
         private void Clear()
         {
             MergeObjectlist.Clear();
+            AddOpenFileIsEn = false;
         }
 
         private void SetPageSizeType(object button)

+ 8 - 8
PDF Office/Views/Dialog/ServiceDialog/NOInternetRegion.xaml

@@ -7,8 +7,8 @@
     xmlns:local="clr-namespace:PDF_Master.Views.Dialog.ServiceDialog"
     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
     xmlns:prism="http://prismlibrary.com/"
-    Width="404"
-    Height="420"
+    Width="440"
+    Height="486"
     prism:ViewModelLocator.AutoWireViewModel="True"
     mc:Ignorable="d">
     <Grid Background="White">
@@ -43,10 +43,9 @@
                     StrokeThickness="3" />
             </Border>
         </Grid>
-        <Grid
+        <StackPanel Orientation="Vertical"
             Width="262"
-            Height="112"
-            Margin="0,226,0,0"
+            Margin="0,246,0,0"
             HorizontalAlignment="Center"
             VerticalAlignment="Top">
             <TextBlock
@@ -60,7 +59,7 @@
             <TextBlock
                 Width="262"
                 Height="40"
-                Margin="0,22,0,0"
+                Margin="0,32,0,0"
                 HorizontalAlignment="Left"
                 VerticalAlignment="Top"
                 FontFamily="Segoe UI"
@@ -70,7 +69,8 @@
                 Text="{Binding Text_toconnect}"
                 TextAlignment="Center"
                 TextWrapping="Wrap" />
-            <Button             
+            <Button           
+                Margin="0,40,0,0"
                 Content="{Binding Text_retry}"
                 Command="{Binding RetryCommand}"
                 Foreground="White"
@@ -78,7 +78,7 @@
                 Height="32"
                  Style="{StaticResource Btn.cta}"
                 VerticalAlignment="Bottom" IsDefault="True" />
-        </Grid>
+        </StackPanel>
 
     </Grid>
 </UserControl>

+ 1 - 0
PDF Office/Views/Dialog/ToolsDialogs/MergeDialog.xaml

@@ -563,6 +563,7 @@
                             Command="{Binding AddFilesCommand}"
                             CommandParameter="1" />
                         <MenuItem
+                            IsEnabled="{Binding AddOpenFileIsEn}"
                             Name="MenuAddOpenFileComboBoxItem"
                             Command="{Binding AddFilesCommand}"
                             CommandParameter="2" />

+ 4 - 4
PDF Office/Views/MainWindow.xaml.cs

@@ -116,16 +116,16 @@ namespace PDF_Master.Views
                 //将现有窗口激活 并前置
                 try
                 {
-                    if (WindowState == WindowState.Minimized)
-                    {
-                        WindowState = WindowState.Normal;
-                    }
+                   
                     Activate();
                     //最小化后激活
                     if (this.WindowState == WindowState.Minimized)
                     {
                         System.Windows.SystemCommands.RestoreWindow(this);
                     }
+                    //窗体前置
+                    Topmost = true;
+                    Topmost = false;
                     ServiceHelper.GetUser();
                     if(msg==App.WebopenexpiredId)
                     {