Просмотр исходного кода

Add folder picker event, update UI #37

Ruben 4 лет назад
Родитель
Сommit
6280ff041b

+ 27 - 5
PicView/Views/UserControls/Misc/ThumbnailOutputUC.xaml

@@ -17,11 +17,12 @@
 
     <StackPanel>
         <StackPanel Margin="15,3,0,5" Orientation="Horizontal">
-            <TextBlock x:Name="OutPutString" Width="170" />
+            <TextBlock x:Name="OutPutString" TextWrapping="Wrap" />
 
             <TextBox
                 x:Name="OutPutStringBox"
-                Width="260"
+                Width="300"
+                AllowDrop="True"
                 FontSize="11"
                 IsReadOnly="False" />
             <uc:FolderButton x:Name="OutputFolderButton" />
@@ -29,21 +30,42 @@
 
         <StackPanel Margin="15,3,0,6" Orientation="Horizontal">
 
-            <TextBlock Width="170" Text="{StaticResource Resize}" />
+            <TextBlock Text="{StaticResource Resize}" />
 
             <StackPanel Orientation="Horizontal">
 
                 <ComboBox Width="130">
                     <ComboBoxItem Content="{StaticResource Width}" />
                     <ComboBoxItem Content="{StaticResource Height}" />
-                    <ComboBoxItem Content="Percentage" IsSelected="True" />
+                    <ComboBoxItem
+                        Name="Percentage"
+                        Content="Percentage"
+                        IsSelected="True" />
                 </ComboBox>
                 <TextBox
                     x:Name="ValueBox"
-                    Width="115"
+                    Width="155"
                     Margin="15,0,0,0"
                     IsReadOnly="False"
                     Text="80" />
+                <Label
+                    Margin="16,0,0,0"
+                    VerticalAlignment="Center"
+                    Content="%"
+                    FontFamily="/PicView;component/Themes/Resources/fonts/#Roboto Bold"
+                    FontSize="14"
+                    Foreground="{StaticResource IconColorBrush}">
+                    <Label.Style>
+                        <Style TargetType="Label">
+                            <Setter Property="Visibility" Value="Visible" />
+                            <Style.Triggers>
+                                <DataTrigger Binding="{Binding ElementName=Percentage, Path=IsSelected}" Value="false">
+                                    <Setter Property="Visibility" Value="Collapsed" />
+                                </DataTrigger>
+                            </Style.Triggers>
+                        </Style>
+                    </Label.Style>
+                </Label>
             </StackPanel>
         </StackPanel>
     </StackPanel>

+ 11 - 15
PicView/Views/UserControls/Misc/ThumbnailOutputUC.xaml.cs

@@ -1,17 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Navigation;
-using System.Windows.Shapes;
+using System.Windows.Controls;
 
 namespace PicView.Views.UserControls
 {
@@ -21,9 +8,18 @@ namespace PicView.Views.UserControls
         {
             InitializeComponent();
 
-            OutPutString.Text = $"Thumbnail {i} destination";
+            OutPutString.Text = $"Thumb {i}";
             OutPutStringBox.Text = folderPath + @"\" + filename;
             ValueBox.Text = value;
+
+            OutputFolderButton.FileMenuButton.Click += (_, _) => 
+            {
+                var newFolder = FileHandling.Open_Save.SelectAndReturnFolder();
+                if (string.IsNullOrWhiteSpace(newFolder) == false)
+                {
+                    OutPutStringBox.Text = newFolder;
+                }
+            };
          }
     }
 }

+ 12 - 7
PicView/Views/Windows/ResizeWindow.xaml

@@ -71,6 +71,7 @@
                     x:Name="SourceFolderInput"
                     Width="298"
                     d:Text="B:\Pictures\new folder"
+                    AllowDrop="True"
                     FontSize="11"
                     IsReadOnly="False" />
                 <uc:FolderButton x:Name="SourceFolderButton" />
@@ -82,6 +83,7 @@
                     x:Name="OutputFolderInput"
                     Width="298"
                     d:Text="B:\Pictures\another new folder"
+                    AllowDrop="True"
                     FontSize="11"
                     IsReadOnly="False" />
                 <uc:FolderButton x:Name="OutputFolderButton" />
@@ -101,7 +103,7 @@
 
 
 
-            <StackPanel Orientation="Horizontal">
+            <StackPanel Margin="0,0,0,10" Orientation="Horizontal">
                 <StackPanel.Style>
                     <Style TargetType="StackPanel">
                         <Setter Property="Visibility" Value="Visible" />
@@ -120,7 +122,7 @@
                 </ComboBox>
             </StackPanel>
 
-            <StackPanel Margin="0,10,0,0" Orientation="Horizontal">
+            <StackPanel Orientation="Horizontal">
                 <TextBlock Text="Quality" />
                 <ComboBox
                     x:Name="QualityPercentage"
@@ -129,9 +131,9 @@
                     <ComboBoxItem Content="100%" />
                     <ComboBoxItem Content="95%" />
                     <ComboBoxItem Content="90%" />
-                    <ComboBoxItem Content="85%" />
+                    <ComboBoxItem Content="85%" IsSelected="True" />
                     <ComboBoxItem Content="80%" />
-                    <ComboBoxItem Content="75%" IsSelected="True" />
+                    <ComboBoxItem Content="75%" />
                     <ComboBoxItem Content="70%" />
                     <ComboBoxItem Content="65%" />
                     <ComboBoxItem Content="60%" />
@@ -221,7 +223,7 @@
                 <TextBlock Text="Percentage" />
 
                 <TextBox
-                    MinWidth="65"
+                    Width="65"
                     IsReadOnly="False"
                     Text="90" />
                 <Label
@@ -233,7 +235,10 @@
             <StackPanel Margin="0,10,0,5" Orientation="Horizontal">
 
                 <TextBlock Text="Generate Thumbnails" />
-                <ComboBox x:Name="ThumbnailsComboBox" MinWidth="65">
+                <ComboBox
+                    x:Name="ThumbnailsComboBox"
+                    Width="65"
+                    MinWidth="65">
                     <ComboBoxItem Content="0" IsSelected="True" />
                     <ComboBoxItem Content="1" />
                     <ComboBoxItem Content="2" />
@@ -245,7 +250,7 @@
                 </ComboBox>
             </StackPanel>
 
-            <ScrollViewer MaxHeight="420">
+            <ScrollViewer MaxHeight="350">
                 <ScrollViewer.Style>
                     <Style TargetType="{x:Type ScrollViewer}">
                         <Setter Property="OverridesDefaultStyle" Value="True" />

+ 18 - 2
PicView/Views/Windows/ResizeWindow.xaml.cs

@@ -1,5 +1,4 @@
 using PicView.ChangeImage;
-using PicView.UILogic;
 using PicView.UILogic.Sizing;
 using System.IO;
 using System.Windows;
@@ -33,6 +32,23 @@ namespace PicView.Views.Windows
                     OutputFolderInput.Text = SourceFolderInput.Text + @"\Processed Pictures";
                 }
 
+                SourceFolderButton.FileMenuButton.Click += (_, _) =>
+                {
+                    var newFolder = FileHandling.Open_Save.SelectAndReturnFolder();
+                    if (string.IsNullOrWhiteSpace(newFolder) == false)
+                    {
+                        SourceFolderInput.Text = newFolder;
+                    }
+                };
+                OutputFolderButton.FileMenuButton.Click += (_, _) =>
+                {
+                    var newFolder = FileHandling.Open_Save.SelectAndReturnFolder();
+                    if (string.IsNullOrWhiteSpace(newFolder) == false)
+                    {
+                        OutputFolderInput.Text = newFolder;
+                    }
+                };
+
                 ThumbnailsComboBox.SelectionChanged += delegate
                 {
                     var selected = (ComboBoxItem)ThumbnailsComboBox.SelectedItem;
@@ -76,7 +92,7 @@ namespace PicView.Views.Windows
                                 newSize[1] = "30"; newSize[2] = "50";
                                 break;
 
-                            case 1: default: 
+                            default: 
                                 size[1] = "small";
                                 newSize[1] = "30";
                                 break;