瀏覽代碼

Add close gallery to contextmenu

Ruben 6 月之前
父節點
當前提交
6f51c7444b

+ 15 - 1
src/PicView.Avalonia/Views/GalleryView.axaml

@@ -95,7 +95,7 @@
                         </Flyout>
                         </Flyout>
                     </FlyoutBase.AttachedFlyout>
                     </FlyoutBase.AttachedFlyout>
                 </MenuItem>
                 </MenuItem>
-                <Separator IsVisible="{CompiledBinding !IsFullGalleryOpen}" />
+                <Separator />
                 <MenuItem
                 <MenuItem
                     Command="{CompiledBinding CloseGalleryCommand}"
                     Command="{CompiledBinding CloseGalleryCommand}"
                     Header="{CompiledBinding Translation.HideBottomGallery,
                     Header="{CompiledBinding Translation.HideBottomGallery,
@@ -110,6 +110,20 @@
                             Width="12" />
                             Width="12" />
                     </MenuItem.Icon>
                     </MenuItem.Icon>
                 </MenuItem>
                 </MenuItem>
+                <MenuItem
+                    Command="{CompiledBinding ToggleGalleryCommand}"
+                    Header="{CompiledBinding Translation.CloseGallery,
+                                             Mode=OneWay}"
+                    IsVisible="{CompiledBinding IsFullGalleryOpen}">
+                    <MenuItem.Icon>
+                        <Path
+                            Data="{StaticResource CloseGeometry}"
+                            Fill="{DynamicResource MainTextColor}"
+                            Height="12"
+                            Stretch="Fill"
+                            Width="12" />
+                    </MenuItem.Icon>
+                </MenuItem>
             </ContextMenu>
             </ContextMenu>
         </Panel.ContextMenu>
         </Panel.ContextMenu>
 
 

+ 19 - 17
src/PicView.Avalonia/Views/UC/GalleryItem.axaml

@@ -119,22 +119,6 @@
                             Width="12" />
                             Width="12" />
                     </MenuItem.Icon>
                     </MenuItem.Icon>
                 </MenuItem>
                 </MenuItem>
-                <!--  <MenuItem  -->
-                <!--  Command="{CompiledBinding SetAsLockScreenCommand}"  -->
-                <!--  CommandParameter="{CompiledBinding Path=Text,  -->
-                <!--  ElementName=FileLocation}"  -->
-                <!--  Header="{CompiledBinding SetAsLockScreenImage,  -->
-                <!--  Mode=OneWay}"  -->
-                <!--  IsEnabled="False">  -->
-                <!--     <MenuItem.Icon> -->
-                <!--  <Path  -->
-                <!--  Data="{StaticResource PanoramaGeometry}"  -->
-                <!--  Fill="{DynamicResource MainTextColor}"  -->
-                <!--  Height="12"  -->
-                <!--  Stretch="Fill"  -->
-                <!--  Width="12" />  -->
-                <!--     </MenuItem.Icon> -->
-                <!-- </MenuItem> -->
                 <Separator />
                 <Separator />
                 <MenuItem
                 <MenuItem
                     Command="{CompiledBinding CopyFileCommand}"
                     Command="{CompiledBinding CopyFileCommand}"
@@ -294,7 +278,25 @@
                     </FlyoutBase.AttachedFlyout>
                     </FlyoutBase.AttachedFlyout>
                 </MenuItem>
                 </MenuItem>
                 <Separator />
                 <Separator />
-                <MenuItem Command="{CompiledBinding CloseGalleryCommand}" Header="{CompiledBinding Translation.HideBottomGallery, Mode=OneWay}">
+                <MenuItem
+                    Command="{CompiledBinding CloseGalleryCommand}"
+                    Header="{CompiledBinding Translation.HideBottomGallery,
+                                             Mode=OneWay}"
+                    IsVisible="{CompiledBinding !IsFullGalleryOpen}">
+                    <MenuItem.Icon>
+                        <Path
+                            Data="{StaticResource CloseGeometry}"
+                            Fill="{DynamicResource MainTextColor}"
+                            Height="12"
+                            Stretch="Fill"
+                            Width="12" />
+                    </MenuItem.Icon>
+                </MenuItem>
+                <MenuItem
+                    Command="{CompiledBinding ToggleGalleryCommand}"
+                    Header="{CompiledBinding Translation.CloseGallery,
+                                             Mode=OneWay}"
+                    IsVisible="{CompiledBinding IsFullGalleryOpen}">
                     <MenuItem.Icon>
                     <MenuItem.Icon>
                         <Path
                         <Path
                             Data="{StaticResource CloseGeometry}"
                             Data="{StaticResource CloseGeometry}"

+ 7 - 0
src/PicView.Core/ViewModels/TranslationViewModel.cs

@@ -21,6 +21,7 @@ public class TranslationViewModel : ReactiveObject
         CopyFile = TranslationManager.Translation.CopyFile;
         CopyFile = TranslationManager.Translation.CopyFile;
         NewWindow = TranslationManager.Translation.NewWindow;
         NewWindow = TranslationManager.Translation.NewWindow;
         Close = TranslationManager.Translation.Close;
         Close = TranslationManager.Translation.Close;
+        CloseGallery = TranslationManager.Translation.CloseGallery;
         Open = TranslationManager.Translation.Open;
         Open = TranslationManager.Translation.Open;
         OpenFileDialog = TranslationManager.Translation.OpenFileDialog;
         OpenFileDialog = TranslationManager.Translation.OpenFileDialog;
         ShowInFolder = TranslationManager.Translation.ShowInFolder;
         ShowInFolder = TranslationManager.Translation.ShowInFolder;
@@ -531,6 +532,12 @@ public class TranslationViewModel : ReactiveObject
         get;
         get;
         set => this.RaiseAndSetIfChanged(ref field, value);
         set => this.RaiseAndSetIfChanged(ref field, value);
     }
     }
+    
+    public string? CloseGallery
+    {
+        get;
+        set => this.RaiseAndSetIfChanged(ref field, value);
+    }
 
 
     public string? CloseWindowPrompt
     public string? CloseWindowPrompt
     {
     {