[Image Resizer] Add settings button (#13773)

* Add deeplink

* Update InputPage.xaml

Co-authored-by: Laute <Niels.Laute@philips.com>
This commit is contained in:
Niels Laute
2021-10-12 13:23:06 +02:00
committed by GitHub
parent 7e8e954de7
commit 4803180bcf
4 changed files with 44 additions and 10 deletions

View File

@@ -204,6 +204,15 @@ namespace ImageResizer.Properties {
} }
} }
/// <summary>
/// Looks up a localized string similar to Open settings.
/// </summary>
public static string Open_settings {
get {
return ResourceManager.GetString("Open_settings", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Phone. /// Looks up a localized string similar to Phone.
/// </summary> /// </summary>

View File

@@ -277,4 +277,7 @@
<data name="Width" xml:space="preserve"> <data name="Width" xml:space="preserve">
<value>Width</value> <value>Width</value>
</data> </data>
<data name="Open_settings" xml:space="preserve">
<value>Open settings</value>
</data>
</root> </root>

View File

@@ -8,6 +8,7 @@ using ImageResizer.Helpers;
using ImageResizer.Models; using ImageResizer.Models;
using ImageResizer.Properties; using ImageResizer.Properties;
using ImageResizer.Views; using ImageResizer.Views;
using Microsoft.PowerToys.Common.UI;
namespace ImageResizer.ViewModels namespace ImageResizer.ViewModels
{ {
@@ -35,6 +36,7 @@ namespace ImageResizer.ViewModels
ResizeCommand = new RelayCommand(Resize); ResizeCommand = new RelayCommand(Resize);
CancelCommand = new RelayCommand(Cancel); CancelCommand = new RelayCommand(Cancel);
OpenSettingsCommand = new RelayCommand(OpenSettings);
} }
public Settings Settings { get; } public Settings Settings { get; }
@@ -43,6 +45,8 @@ namespace ImageResizer.ViewModels
public ICommand CancelCommand { get; } public ICommand CancelCommand { get; }
public ICommand OpenSettingsCommand { get; }
public bool TryingToResizeGifFiles public bool TryingToResizeGifFiles
{ {
get get
@@ -58,6 +62,11 @@ namespace ImageResizer.ViewModels
_mainViewModel.CurrentPage = new ProgressViewModel(_batch, _mainViewModel, _mainView); _mainViewModel.CurrentPage = new ProgressViewModel(_batch, _mainViewModel, _mainView);
} }
public static void OpenSettings()
{
SettingsDeepLink.OpenSettings(SettingsDeepLink.SettingsWindow.ImageResizer);
}
public void Cancel() public void Cancel()
=> _mainView.Close(); => _mainView.Close();
} }

View File

@@ -131,6 +131,17 @@
<CheckBox Margin="12,4,12,0" <CheckBox Margin="12,4,12,0"
Content="{x:Static p:Resources.Input_IgnoreOrientation}" Content="{x:Static p:Resources.Input_IgnoreOrientation}"
IsChecked="{Binding Settings.IgnoreOrientation}"/> IsChecked="{Binding Settings.IgnoreOrientation}"/>
<TextBlock Grid.Column="0"
FontWeight="Bold"
Text="{x:Static p:Resources.Input_GifWarning}"
TextWrapping="Wrap"
Margin="12,12,12,0"
HorizontalAlignment="Right"
TextAlignment="Left"
Foreground="{ui:ThemeResource SystemControlErrorTextForegroundBrush}"
Visibility="{Binding TryingToResizeGifFiles, Converter={StaticResource BoolValueConverter}}"
/>
</StackPanel> </StackPanel>
<Border Margin="0,12,0,0" <Border Margin="0,12,0,0"
@@ -145,16 +156,18 @@
<ColumnDefinition Width="Auto"/> <ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/> <ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" <Button Width="36"
FontWeight="Bold" Command="{Binding OpenSettingsCommand}"
Text="{x:Static p:Resources.Input_GifWarning}" Height="36"
TextWrapping="Wrap" Margin="-8,0,0,0"
MaxWidth="250" Content="&#xE713;"
HorizontalAlignment="Left" Background="Transparent"
TextAlignment="Left" FontFamily="Segoe MDL2 Assets"
Foreground="{ui:ThemeResource SystemControlErrorTextForegroundBrush}" FontSize="16"
Visibility="{Binding TryingToResizeGifFiles, Converter={StaticResource BoolValueConverter}}" HorizontalAlignment="Left"
/> ToolTipService.ToolTip="{x:Static p:Resources.Open_settings}"
AutomationProperties.Name="{x:Static p:Resources.Open_settings}" />
<Button Grid.Column="1" <Button Grid.Column="1"
Style="{StaticResource AccentButtonStyle}" Style="{StaticResource AccentButtonStyle}"
MinWidth="76" MinWidth="76"