Ver código fonte

保存-修复保存问题

ZhouJieSheng 2 anos atrás
pai
commit
730a2e0034

+ 7 - 2
PDF Office/CustomControl/AlertsMessage.xaml

@@ -58,7 +58,12 @@
                     <ColumnDefinition />
                     <ColumnDefinition />
                 </Grid.ColumnDefinitions>
-                <CheckBox x:Name="ChbDonotAskAgain" Content="Don't ask again" Visibility="Collapsed" Checked="ChbDonotAskAgain_Checked" Unchecked="ChbDonotAskAgain_Unchecked"/>
+                <CheckBox
+                    x:Name="ChbDonotAskAgain"
+                    Checked="ChbDonotAskAgain_Checked"
+                    Content="Don't ask again"
+                    Unchecked="ChbDonotAskAgain_Unchecked"
+                    Visibility="Collapsed" />
                 <Button
                     x:Name="CancelBtn"
                     Grid.Column="2"
@@ -73,7 +78,7 @@
                     x:Name="MiddleCancelBtn"
                     Grid.Column="1"
                     Height="28"
-                    Margin="8,0,0,0"
+                    Margin="8,0,8,0"
                     BorderThickness="0"
                     Click="MiddleCancelBtn_Click"
                     Content="Do not Save"

+ 0 - 4
PDF Office/CustomControl/SystemControl/TabablzRegionBehavior.cs

@@ -177,10 +177,6 @@ namespace PDF_Office.CustomControl.SystemControl
             var tabcontrol = GetTabcontrol(view);
             var proxy = GetView(view);
             tabcontrol.Items.Remove(proxy);
-            if(tabcontrol.Items.Count<=0)
-            {
-                (Window.GetWindow(tabcontrol) as MainWindow).Close();
-            }
         }
 
         private void AddView(object view)

+ 4 - 3
PDF Office/ViewModels/MainWindowViewModel.cs

@@ -206,14 +206,15 @@ namespace PDF_Office.ViewModels
         {
             while (region.Regions[RegionNames.MainRegion].Views.Count() > 0)
             {
-                if (CurrentPDFViewer.UndoManager.CanSave)
+                if (CurrentPDFViewer!=null&&CurrentPDFViewer.UndoManager.CanSave)
                 {
                     ContentResult result = ShowSaveDialog((SelectedItem.DataContext as MainContentViewModel).viewContentViewModel);
                     if (result == ContentResult.Cancel)
                         return false;
+                    App.OpenedFileList.Remove(CurrentPDFViewer.Document.FilePath);
+                    CurrentPDFViewer.CloseDocument();
                 }
-                App.OpenedFileList.Remove(CurrentPDFViewer.Document.FilePath);
-                CurrentPDFViewer.CloseDocument();
+              
                 region.Regions[RegionNames.MainRegion].Remove(selectedItem);
             }
             return true;