[Image Resizer] remove old in app settings (#10837)
* [Image Resizer] Remove old settings * [Image Resizer] Removed unused code * [common interop] remove "ShouldNewSettingsBeUsed()"
This commit is contained in:
parent
0e64071051
commit
6ec30e2186
|
@ -22,9 +22,6 @@ namespace Microsoft.Interop.Tests
|
|||
[TestInitialize]
|
||||
public void Initialize()
|
||||
{
|
||||
// Make sure we don't crash
|
||||
Assert.IsTrue(CommonManaged.ShouldNewSettingsBeUsed() == CommonManaged.ShouldNewSettingsBeUsed());
|
||||
|
||||
ClientPipe = new TwoWayPipeMessageIPCManaged(ClientSidePipe, ServerSidePipe, null);
|
||||
}
|
||||
|
||||
|
|
|
@ -122,11 +122,6 @@ public
|
|||
static String ^ GetProductVersion() {
|
||||
return gcnew String(get_product_version().c_str());
|
||||
}
|
||||
|
||||
static bool ShouldNewSettingsBeUsed()
|
||||
{
|
||||
return UseNewSettings();
|
||||
}
|
||||
};
|
||||
|
||||
public
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
// This class sets the visibility property of Advanced settings based on the OS Version
|
||||
|
||||
namespace ImageResizer.Models
|
||||
{
|
||||
public static class AdvancedSettings
|
||||
{
|
||||
public static bool UseNewSettings()
|
||||
{
|
||||
return interop.CommonManaged.ShouldNewSettingsBeUsed();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -59,232 +59,7 @@ namespace ImageResizer.Properties {
|
|||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to About.
|
||||
/// </summary>
|
||||
public static string Advanced_About {
|
||||
get {
|
||||
return ResourceManager.GetString("Advanced_About", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Create a new size.
|
||||
/// </summary>
|
||||
public static string Advanced_CreateSize {
|
||||
get {
|
||||
return ResourceManager.GetString("Advanced_CreateSize", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Delete.
|
||||
/// </summary>
|
||||
public static string Advanced_DeleteSize {
|
||||
get {
|
||||
return ResourceManager.GetString("Advanced_DeleteSize", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Encoding.
|
||||
/// </summary>
|
||||
public static string Advanced_Encoding {
|
||||
get {
|
||||
return ResourceManager.GetString("Advanced_Encoding", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to _Fallback encoder:.
|
||||
/// </summary>
|
||||
public static string Advanced_FallbackEncoder {
|
||||
get {
|
||||
return ResourceManager.GetString("Advanced_FallbackEncoder", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Fallback encoder.
|
||||
/// </summary>
|
||||
public static string Advanced_FallbackEncoder_Name {
|
||||
get {
|
||||
return ResourceManager.GetString("Advanced_FallbackEncoder_Name", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to File.
|
||||
/// </summary>
|
||||
public static string Advanced_File {
|
||||
get {
|
||||
return ResourceManager.GetString("Advanced_File", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to _Filename:.
|
||||
/// </summary>
|
||||
public static string Advanced_FileName {
|
||||
get {
|
||||
return ResourceManager.GetString("Advanced_FileName", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Filename.
|
||||
/// </summary>
|
||||
public static string Advanced_FileName_Name {
|
||||
get {
|
||||
return ResourceManager.GetString("Advanced_FileName_Name", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Original filename.
|
||||
/// </summary>
|
||||
public static string Advanced_FileNameToken1 {
|
||||
get {
|
||||
return ResourceManager.GetString("Advanced_FileNameToken1", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Size name.
|
||||
/// </summary>
|
||||
public static string Advanced_FileNameToken2 {
|
||||
get {
|
||||
return ResourceManager.GetString("Advanced_FileNameToken2", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Selected width.
|
||||
/// </summary>
|
||||
public static string Advanced_FileNameToken3 {
|
||||
get {
|
||||
return ResourceManager.GetString("Advanced_FileNameToken3", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Selected height.
|
||||
/// </summary>
|
||||
public static string Advanced_FileNameToken4 {
|
||||
get {
|
||||
return ResourceManager.GetString("Advanced_FileNameToken4", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Actual width (pixels).
|
||||
/// </summary>
|
||||
public static string Advanced_FileNameToken5 {
|
||||
get {
|
||||
return ResourceManager.GetString("Advanced_FileNameToken5", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Actual height (pixels).
|
||||
/// </summary>
|
||||
public static string Advanced_FileNameToken6 {
|
||||
get {
|
||||
return ResourceManager.GetString("Advanced_FileNameToken6", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to The following parameters can be used..
|
||||
/// </summary>
|
||||
public static string Advanced_FileNameTokens {
|
||||
get {
|
||||
return ResourceManager.GetString("Advanced_FileNameTokens", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to _JPEG quality level:.
|
||||
/// </summary>
|
||||
public static string Advanced_JpegQualityLevel {
|
||||
get {
|
||||
return ResourceManager.GetString("Advanced_JpegQualityLevel", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to JPEG quality level.
|
||||
/// </summary>
|
||||
public static string Advanced_JpegQualityLevel_Name {
|
||||
get {
|
||||
return ResourceManager.GetString("Advanced_JpegQualityLevel_Name", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to _Use original date modified.
|
||||
/// </summary>
|
||||
public static string Advanced_KeepDateModified {
|
||||
get {
|
||||
return ResourceManager.GetString("Advanced_KeepDateModified", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to _PNG interlacing:.
|
||||
/// </summary>
|
||||
public static string Advanced_PngInterlaceOption {
|
||||
get {
|
||||
return ResourceManager.GetString("Advanced_PngInterlaceOption", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to PNG interlacing.
|
||||
/// </summary>
|
||||
public static string Advanced_PngInterlaceOption_Name {
|
||||
get {
|
||||
return ResourceManager.GetString("Advanced_PngInterlaceOption_Name", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Sizes.
|
||||
/// </summary>
|
||||
public static string Advanced_Sizes {
|
||||
get {
|
||||
return ResourceManager.GetString("Advanced_Sizes", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to _TIFF compression:.
|
||||
/// </summary>
|
||||
public static string Advanced_TiffCompressOption {
|
||||
get {
|
||||
return ResourceManager.GetString("Advanced_TiffCompressOption", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to TIFF compression.
|
||||
/// </summary>
|
||||
public static string Advanced_TiffCompressOption_Name {
|
||||
get {
|
||||
return ResourceManager.GetString("Advanced_TiffCompressOption_Name", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Settings.
|
||||
/// </summary>
|
||||
public static string Advanced_Title {
|
||||
get {
|
||||
return ResourceManager.GetString("Advanced_Title", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to All Files.
|
||||
/// </summary>
|
||||
|
@ -302,16 +77,7 @@ namespace ImageResizer.Properties {
|
|||
return ResourceManager.GetString("Cancel", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to © 2020 Brice Lambson. All rights reserved..
|
||||
/// </summary>
|
||||
public static string Copyright {
|
||||
get {
|
||||
return ResourceManager.GetString("Copyright", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Height.
|
||||
/// </summary>
|
||||
|
@ -384,15 +150,6 @@ namespace ImageResizer.Properties {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Settings.
|
||||
/// </summary>
|
||||
public static string Input_ShowAdvanced {
|
||||
get {
|
||||
return ResourceManager.GetString("Input_ShowAdvanced", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to _Make pictures smaller but not larger.
|
||||
/// </summary>
|
||||
|
@ -726,69 +483,6 @@ namespace ImageResizer.Properties {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to CCITT3.
|
||||
/// </summary>
|
||||
public static string TiffCompressOption_Ccitt3 {
|
||||
get {
|
||||
return ResourceManager.GetString("TiffCompressOption_Ccitt3", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to CCITT4.
|
||||
/// </summary>
|
||||
public static string TiffCompressOption_Ccitt4 {
|
||||
get {
|
||||
return ResourceManager.GetString("TiffCompressOption_Ccitt4", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to (Default).
|
||||
/// </summary>
|
||||
public static string TiffCompressOption_Default {
|
||||
get {
|
||||
return ResourceManager.GetString("TiffCompressOption_Default", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to LZW.
|
||||
/// </summary>
|
||||
public static string TiffCompressOption_Lzw {
|
||||
get {
|
||||
return ResourceManager.GetString("TiffCompressOption_Lzw", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to None.
|
||||
/// </summary>
|
||||
public static string TiffCompressOption_None {
|
||||
get {
|
||||
return ResourceManager.GetString("TiffCompressOption_None", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to RLE.
|
||||
/// </summary>
|
||||
public static string TiffCompressOption_Rle {
|
||||
get {
|
||||
return ResourceManager.GetString("TiffCompressOption_Rle", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to ZIP.
|
||||
/// </summary>
|
||||
public static string TiffCompressOption_Zip {
|
||||
get {
|
||||
return ResourceManager.GetString("TiffCompressOption_Zip", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Times Symbol.
|
||||
/// </summary>
|
||||
|
|
|
@ -117,93 +117,12 @@
|
|||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="Advanced_About" xml:space="preserve">
|
||||
<value>About</value>
|
||||
</data>
|
||||
<data name="Advanced_CreateSize" xml:space="preserve">
|
||||
<value>Create a new size</value>
|
||||
</data>
|
||||
<data name="Advanced_DeleteSize" xml:space="preserve">
|
||||
<value>Delete</value>
|
||||
<comment>remove a file</comment>
|
||||
</data>
|
||||
<data name="Advanced_Encoding" xml:space="preserve">
|
||||
<value>Encoding</value>
|
||||
<comment>encoding a file to a different format</comment>
|
||||
</data>
|
||||
<data name="Advanced_FallbackEncoder" xml:space="preserve">
|
||||
<value>_Fallback encoder:</value>
|
||||
</data>
|
||||
<data name="Advanced_FallbackEncoder_Name" xml:space="preserve">
|
||||
<value>Fallback encoder</value>
|
||||
</data>
|
||||
<data name="Advanced_File" xml:space="preserve">
|
||||
<value>File</value>
|
||||
<comment>as in file name</comment>
|
||||
</data>
|
||||
<data name="Advanced_FileName" xml:space="preserve">
|
||||
<value>_Filename:</value>
|
||||
</data>
|
||||
<data name="Advanced_FileNameToken1" xml:space="preserve">
|
||||
<value>Original filename</value>
|
||||
</data>
|
||||
<data name="Advanced_FileNameToken2" xml:space="preserve">
|
||||
<value>Size name</value>
|
||||
</data>
|
||||
<data name="Advanced_FileNameToken3" xml:space="preserve">
|
||||
<value>Selected width</value>
|
||||
</data>
|
||||
<data name="Advanced_FileNameToken4" xml:space="preserve">
|
||||
<value>Selected height</value>
|
||||
</data>
|
||||
<data name="Advanced_FileNameToken5" xml:space="preserve">
|
||||
<value>Actual width (pixels)</value>
|
||||
</data>
|
||||
<data name="Advanced_FileNameToken6" xml:space="preserve">
|
||||
<value>Actual height (pixels)</value>
|
||||
</data>
|
||||
<data name="Advanced_FileNameTokens" xml:space="preserve">
|
||||
<value>The following parameters can be used.</value>
|
||||
</data>
|
||||
<data name="Advanced_FileName_Name" xml:space="preserve">
|
||||
<value>Filename</value>
|
||||
</data>
|
||||
<data name="Advanced_JpegQualityLevel" xml:space="preserve">
|
||||
<value>_JPEG quality level:</value>
|
||||
</data>
|
||||
<data name="Advanced_JpegQualityLevel_Name" xml:space="preserve">
|
||||
<value>JPEG quality level</value>
|
||||
</data>
|
||||
<data name="Advanced_KeepDateModified" xml:space="preserve">
|
||||
<value>_Use original date modified</value>
|
||||
</data>
|
||||
<data name="Advanced_PngInterlaceOption" xml:space="preserve">
|
||||
<value>_PNG interlacing:</value>
|
||||
</data>
|
||||
<data name="Advanced_PngInterlaceOption_Name" xml:space="preserve">
|
||||
<value>PNG interlacing</value>
|
||||
</data>
|
||||
<data name="Advanced_Sizes" xml:space="preserve">
|
||||
<value>Sizes</value>
|
||||
</data>
|
||||
<data name="Advanced_TiffCompressOption" xml:space="preserve">
|
||||
<value>_TIFF compression:</value>
|
||||
</data>
|
||||
<data name="Advanced_TiffCompressOption_Name" xml:space="preserve">
|
||||
<value>TIFF compression</value>
|
||||
</data>
|
||||
<data name="Advanced_Title" xml:space="preserve">
|
||||
<value>Settings</value>
|
||||
</data>
|
||||
<data name="AllFilesFilter" xml:space="preserve">
|
||||
<value>All Files</value>
|
||||
</data>
|
||||
<data name="Cancel" xml:space="preserve">
|
||||
<value>Cancel</value>
|
||||
</data>
|
||||
<data name="Copyright" xml:space="preserve">
|
||||
<value>© 2020 Brice Lambson. All rights reserved.</value>
|
||||
</data>
|
||||
<data name="Height" xml:space="preserve">
|
||||
<value>Height</value>
|
||||
</data>
|
||||
|
@ -229,9 +148,6 @@
|
|||
<data name="Input_Resize" xml:space="preserve">
|
||||
<value>Resize</value>
|
||||
</data>
|
||||
<data name="Input_ShowAdvanced" xml:space="preserve">
|
||||
<value>Settings</value>
|
||||
</data>
|
||||
<data name="Input_ShrinkOnly" xml:space="preserve">
|
||||
<value>_Make pictures smaller but not larger</value>
|
||||
</data>
|
||||
|
@ -343,32 +259,6 @@
|
|||
<data name="Small" xml:space="preserve">
|
||||
<value>Small</value>
|
||||
</data>
|
||||
<data name="TiffCompressOption_Ccitt3" xml:space="preserve">
|
||||
<value>CCITT3</value>
|
||||
<comment>Do not loc</comment>
|
||||
</data>
|
||||
<data name="TiffCompressOption_Ccitt4" xml:space="preserve">
|
||||
<value>CCITT4</value>
|
||||
<comment>Do not loc</comment>
|
||||
</data>
|
||||
<data name="TiffCompressOption_Default" xml:space="preserve">
|
||||
<value>(Default)</value>
|
||||
</data>
|
||||
<data name="TiffCompressOption_Lzw" xml:space="preserve">
|
||||
<value>LZW</value>
|
||||
<comment>Do not loc</comment>
|
||||
</data>
|
||||
<data name="TiffCompressOption_None" xml:space="preserve">
|
||||
<value>None</value>
|
||||
</data>
|
||||
<data name="TiffCompressOption_Rle" xml:space="preserve">
|
||||
<value>RLE</value>
|
||||
<comment>Do not loc</comment>
|
||||
</data>
|
||||
<data name="TiffCompressOption_Zip" xml:space="preserve">
|
||||
<value>ZIP</value>
|
||||
<comment>Do not loc</comment>
|
||||
</data>
|
||||
<data name="Times_Symbol" xml:space="preserve">
|
||||
<value>Times Symbol</value>
|
||||
</data>
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
// Copyright (c) Brice Lambson
|
||||
// The Brice Lambson licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information. Code forked from Brice Lambson's https://github.com/bricelam/ImageResizer/
|
||||
// ShowAdvancedCommand = new RelayCommand(ShowAdvanced);
|
||||
|
||||
using System.Windows.Input;
|
||||
using ImageResizer.Helpers;
|
||||
|
@ -35,21 +34,14 @@ namespace ImageResizer.ViewModels
|
|||
|
||||
ResizeCommand = new RelayCommand(Resize);
|
||||
CancelCommand = new RelayCommand(Cancel);
|
||||
ShowAdvancedCommand = new RelayCommand(ShowAdvanced);
|
||||
|
||||
ShowAdvancedSettings = !AdvancedSettings.UseNewSettings();
|
||||
}
|
||||
|
||||
public bool ShowAdvancedSettings { get; }
|
||||
|
||||
public Settings Settings { get; }
|
||||
|
||||
public ICommand ResizeCommand { get; }
|
||||
|
||||
public ICommand CancelCommand { get; }
|
||||
|
||||
public ICommand ShowAdvancedCommand { get; }
|
||||
|
||||
public void Resize()
|
||||
{
|
||||
Settings.Save();
|
||||
|
@ -58,8 +50,5 @@ namespace ImageResizer.ViewModels
|
|||
|
||||
public void Cancel()
|
||||
=> _mainView.Close();
|
||||
|
||||
public void ShowAdvanced()
|
||||
=> _mainView.ShowAdvanced(new AdvancedViewModel(Settings));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Windows;
|
||||
using System.Windows.Automation.Peers;
|
||||
using System.Windows.Documents;
|
||||
|
||||
namespace ImageResizer.Views
|
||||
{
|
||||
public class AccessibleHyperlink : Hyperlink
|
||||
{
|
||||
public AutomationControlType ControlType { get; set; }
|
||||
|
||||
protected override AutomationPeer OnCreateAutomationPeer()
|
||||
{
|
||||
var peer = new CustomizableHyperlinkAutomationPeer(this);
|
||||
|
||||
peer.ControlType = ControlType;
|
||||
return peer;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,312 +0,0 @@
|
|||
<Window x:Class="ImageResizer.Views.AdvancedWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:ImageResizer.Views"
|
||||
xmlns:m="clr-namespace:ImageResizer.Models"
|
||||
xmlns:p="clr-namespace:ImageResizer.Properties"
|
||||
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
||||
xmlns:ui="http://schemas.modernwpf.com/2019"
|
||||
ContentRendered="WindowContentRendered"
|
||||
MinWidth="560"
|
||||
MinHeight="340"
|
||||
ui:WindowHelper.UseModernWindowStyle="True"
|
||||
ui:TitleBar.IsIconVisible="True"
|
||||
Background="{DynamicResource PrimaryBackgroundBrush}"
|
||||
Name="_this"
|
||||
ResizeMode="NoResize"
|
||||
SizeToContent="WidthAndHeight"
|
||||
Title="{x:Static p:Resources.Advanced_Title}"
|
||||
WindowStyle="ToolWindow"
|
||||
WindowStartupLocation="CenterScreen">
|
||||
|
||||
<Window.Resources>
|
||||
<ObjectDataProvider x:Key="PngInterlaceOptionValues"
|
||||
MethodName="GetValues"
|
||||
ObjectType="{x:Type sys:Enum}">
|
||||
<ObjectDataProvider.MethodParameters>
|
||||
<x:Type TypeName="PngInterlaceOption"/>
|
||||
</ObjectDataProvider.MethodParameters>
|
||||
</ObjectDataProvider>
|
||||
<ObjectDataProvider x:Key="TiffCompressOptionValues"
|
||||
MethodName="GetValues"
|
||||
ObjectType="{x:Type sys:Enum}">
|
||||
<ObjectDataProvider.MethodParameters>
|
||||
<x:Type TypeName="TiffCompressOption"/>
|
||||
</ObjectDataProvider.MethodParameters>
|
||||
</ObjectDataProvider>
|
||||
<local:ContainerFormatConverter x:Key="ContainerFormatConverter"/>
|
||||
</Window.Resources>
|
||||
|
||||
<Grid Margin="0">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<TabControl Style="{StaticResource TabControlPivotStyle}">
|
||||
<TabItem Header="{x:Static p:Resources.Advanced_Sizes}">
|
||||
<StackPanel Margin="0,12,0,12">
|
||||
<!-- TODO: Allow these to be drag-and-drop reordered (issue #15) -->
|
||||
<ItemsControl Grid.IsSharedSizeScope="True" TabIndex="0" ItemsSource="{Binding Settings.Sizes}">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate DataType="m:ResizeSize">
|
||||
<Grid Margin="0,0,0,8">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition SharedSizeGroup="0"/>
|
||||
<ColumnDefinition SharedSizeGroup="1"/>
|
||||
<ColumnDefinition SharedSizeGroup="2"/>
|
||||
<ColumnDefinition SharedSizeGroup="3"/>
|
||||
<ColumnDefinition SharedSizeGroup="4"/>
|
||||
<ColumnDefinition SharedSizeGroup="5"/>
|
||||
<ColumnDefinition SharedSizeGroup="6"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBox Width="96"
|
||||
MaxWidth="96"
|
||||
TextWrapping="Wrap"
|
||||
AutomationProperties.Name="{Binding Name}"
|
||||
Text="{Binding Name}"/>
|
||||
<ComboBox Grid.Column="1"
|
||||
Margin="8,0,0,0"
|
||||
Width="90"
|
||||
ItemsSource="{Binding Source={StaticResource ResizeFitValues}}"
|
||||
AutomationProperties.Name="{x:Static p:Resources.Resize_Type}"
|
||||
SelectedItem="{Binding Fit}">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type m:ResizeFit}">
|
||||
<ContentPresenter Content="{Binding Converter={StaticResource EnumValueConverter}}"/>
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
<TextBox Grid.Column="2"
|
||||
Width="56"
|
||||
MaxWidth="56"
|
||||
TextWrapping="Wrap"
|
||||
AutomationProperties.Name="{x:Static p:Resources.Width}"
|
||||
Margin="8,0,0,0">
|
||||
<TextBox.Text>
|
||||
<Binding Converter="{StaticResource AutoDoubleConverter}"
|
||||
Path="Width"
|
||||
UpdateSourceTrigger="PropertyChanged">
|
||||
<Binding.ValidationRules>
|
||||
<local:AutoDoubleValidationRule/>
|
||||
</Binding.ValidationRules>
|
||||
</Binding>
|
||||
</TextBox.Text>
|
||||
</TextBox>
|
||||
<TextBlock Grid.Column="3"
|
||||
Foreground="{DynamicResource PrimaryForegroundBrush}"
|
||||
Name="Times_Symbol"
|
||||
AutomationProperties.Name="{x:Static p:Resources.Times_Symbol}"
|
||||
VerticalAlignment="Center"
|
||||
Text=""
|
||||
FontFamily="Segoe MDL2 Assets"
|
||||
Width="25"
|
||||
TextAlignment="Center"
|
||||
Visibility="{Binding ShowHeight,Converter={StaticResource BoolValueConverter}}"/>
|
||||
<TextBox Grid.Column="4"
|
||||
Width="56"
|
||||
MaxWidth="56"
|
||||
TextWrapping="Wrap"
|
||||
AutomationProperties.Name="{x:Static p:Resources.Height}"
|
||||
Visibility="{Binding ShowHeight,Converter={StaticResource BoolValueConverter}}">
|
||||
<TextBox.Text>
|
||||
<Binding Converter="{StaticResource AutoDoubleConverter}"
|
||||
Path="Height"
|
||||
UpdateSourceTrigger="PropertyChanged">
|
||||
<Binding.ValidationRules>
|
||||
<local:AutoDoubleValidationRule/>
|
||||
</Binding.ValidationRules>
|
||||
</Binding>
|
||||
</TextBox.Text>
|
||||
</TextBox>
|
||||
<ComboBox Grid.Column="5"
|
||||
Margin="8,0,0,0"
|
||||
MinWidth="120"
|
||||
ItemsSource="{Binding Source={StaticResource ResizeUnitValues}}"
|
||||
AutomationProperties.Name="{x:Static p:Resources.Unit}"
|
||||
SelectedItem="{Binding Unit}">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type m:ResizeUnit}">
|
||||
<ContentPresenter Content="{Binding Converter={StaticResource EnumValueConverter}}"/>
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
<Button Content=""
|
||||
FontFamily="Segoe MDL2 Assets"
|
||||
Background="Transparent"
|
||||
Grid.Column="6"
|
||||
Margin="8,0,0,0"
|
||||
VerticalAlignment="Center"
|
||||
AutomationProperties.Name="{x:Static p:Resources.Advanced_DeleteSize}"
|
||||
ToolTip="{x:Static p:Resources.Advanced_DeleteSize}"
|
||||
Command="{Binding DataContext.RemoveSizeCommand,ElementName=_this}"
|
||||
CommandParameter="{Binding}" />
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
<Button Margin="0,12,0,0"
|
||||
Command="{Binding AddSizeCommand}"
|
||||
Content="{x:Static p:Resources.Advanced_CreateSize}"/>
|
||||
</StackPanel>
|
||||
</TabItem>
|
||||
<TabItem Header="{x:Static p:Resources.Advanced_Encoding}">
|
||||
<Grid Margin="0,12,0,12" VerticalAlignment="Top">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<Label Content="{x:Static p:Resources.Advanced_FallbackEncoder}"
|
||||
Padding="0,8,8,0"
|
||||
Target="{Binding ElementName=_fallbackEncoderComboBox}"/>
|
||||
<ComboBox Grid.Column="1"
|
||||
HorizontalAlignment="Left"
|
||||
MinWidth="148"
|
||||
ItemsSource="{Binding Encoders}"
|
||||
AutomationProperties.Name="{x:Static p:Resources.Advanced_FallbackEncoder_Name}"
|
||||
Name="_fallbackEncoderComboBox"
|
||||
SelectedItem="{Binding Settings.FallbackEncoder}">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type sys:Guid}">
|
||||
<ContentPresenter Content="{Binding Converter={StaticResource ContainerFormatConverter}}"/>
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
<Label Grid.Row="1"
|
||||
Margin="0,8,0,0"
|
||||
Content="{x:Static p:Resources.Advanced_JpegQualityLevel}"
|
||||
Padding="0,8,8,0"
|
||||
Target="{Binding ElementName=_jpegQualityLevelTextBox}"/>
|
||||
<TextBox Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
Width="56"
|
||||
MinWidth="148"
|
||||
TextWrapping="Wrap"
|
||||
AutomationProperties.Name="{x:Static p:Resources.Advanced_JpegQualityLevel_Name}"
|
||||
Margin="0,8,0,0"
|
||||
HorizontalAlignment="Left"
|
||||
Name="_jpegQualityLevelTextBox"
|
||||
Text="{Binding Settings.JpegQualityLevel,ValidatesOnExceptions=True,ValidatesOnDataErrors=True}"/>
|
||||
<Label Grid.Row="2"
|
||||
Margin="0,8,0,0"
|
||||
Content="{x:Static p:Resources.Advanced_PngInterlaceOption}"
|
||||
Padding="0,8,8,0"
|
||||
Target="{Binding ElementName=_pngInterlaceComboBox}"/>
|
||||
<ComboBox Grid.Row="2"
|
||||
Grid.Column="1"
|
||||
Margin="0,8,0,0"
|
||||
MinWidth="148"
|
||||
HorizontalAlignment="Left"
|
||||
AutomationProperties.Name="{x:Static p:Resources.Advanced_PngInterlaceOption_Name}"
|
||||
ItemsSource="{Binding Source={StaticResource PngInterlaceOptionValues}}"
|
||||
Name="_pngInterlaceComboBox"
|
||||
SelectedItem="{Binding Settings.PngInterlaceOption}">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type PngInterlaceOption}">
|
||||
<ContentPresenter Content="{Binding Converter={StaticResource EnumValueConverter}}"/>
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
<Label Grid.Row="3"
|
||||
Margin="0,8,0,0"
|
||||
Content="{x:Static p:Resources.Advanced_TiffCompressOption}"
|
||||
Padding="0,8,8,0"
|
||||
Target="{Binding ElementName=_tiffCompressComboBox}"/>
|
||||
<ComboBox Grid.Row="3"
|
||||
Grid.Column="1"
|
||||
MinWidth="148"
|
||||
Margin="0,8,0,0"
|
||||
HorizontalAlignment="Left"
|
||||
AutomationProperties.Name="{x:Static p:Resources.Advanced_TiffCompressOption_Name}"
|
||||
ItemsSource="{Binding Source={StaticResource TiffCompressOptionValues}}"
|
||||
Name="_tiffCompressComboBox"
|
||||
SelectedItem="{Binding Settings.TiffCompressOption}">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type TiffCompressOption}">
|
||||
<ContentPresenter Content="{Binding Converter={StaticResource EnumValueConverter}}"/>
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
<TabItem Header="{x:Static p:Resources.Advanced_File}">
|
||||
<StackPanel Margin="0,12,0,12">
|
||||
<TextBlock Text="{x:Static p:Resources.Advanced_FileNameTokens}"/>
|
||||
<TextBlock Margin="0,8,0,0">
|
||||
<Run Text="%1 -"/>
|
||||
<Run Text="{x:Static p:Resources.Advanced_FileNameToken1}"/>
|
||||
<LineBreak/>
|
||||
<Run>%2 -</Run>
|
||||
<Run Text="{x:Static p:Resources.Advanced_FileNameToken2}"/>
|
||||
<LineBreak/>
|
||||
<Run>%3 -</Run>
|
||||
<Run Text="{x:Static p:Resources.Advanced_FileNameToken3}"/>
|
||||
<LineBreak/>
|
||||
<Run>%4 -</Run>
|
||||
<Run Text="{x:Static p:Resources.Advanced_FileNameToken4}"/>
|
||||
<LineBreak/>
|
||||
<Run>%5 -</Run>
|
||||
<Run Text="{x:Static p:Resources.Advanced_FileNameToken5}"/>
|
||||
<LineBreak/>
|
||||
<Run>%6 -</Run>
|
||||
<Run Text="{x:Static p:Resources.Advanced_FileNameToken6}"/>
|
||||
</TextBlock>
|
||||
<Grid Margin="0,8,0,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Label HorizontalAlignment="Left"
|
||||
x:Name="fileNameTextBoxLabel"
|
||||
Content="{x:Static p:Resources.Advanced_FileName}"
|
||||
Padding="0,4,4,0"
|
||||
Target="{Binding ElementName=fileNameTextBox}"/>
|
||||
<TextBox Grid.Column="1"
|
||||
Height="23"
|
||||
MinWidth="240"
|
||||
TabIndex="0"
|
||||
HorizontalAlignment="Left"
|
||||
TextWrapping="Wrap"
|
||||
Name="fileNameTextBox"
|
||||
AutomationProperties.Name="{x:Static p:Resources.Advanced_FileName_Name}"
|
||||
Text="{Binding Settings.FileName}"/>
|
||||
</Grid>
|
||||
<Separator Margin="0,12,0,0"/>
|
||||
<CheckBox Margin="0,12,0,0"
|
||||
Content="{x:Static p:Resources.Advanced_KeepDateModified}"
|
||||
IsChecked="{Binding Settings.KeepDateModified}"/>
|
||||
</StackPanel>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
<Border Grid.Row="1"
|
||||
Margin="0,24,0,0"
|
||||
BorderBrush="{DynamicResource PrimaryBorderBrush}"
|
||||
BorderThickness="0,1,0,0"
|
||||
Background="{DynamicResource SecondaryBackgroundBrush}"
|
||||
Padding="12">
|
||||
|
||||
<StackPanel
|
||||
HorizontalAlignment="Right"
|
||||
Orientation="Horizontal">
|
||||
<Button MinWidth="76"
|
||||
TabIndex="100"
|
||||
Click="HandleAcceptClick"
|
||||
Style="{StaticResource AccentButtonStyle}"
|
||||
Content="{x:Static p:Resources.OK}"
|
||||
AutomationProperties.Name="{x:Static p:Resources.OK_Tooltip}"
|
||||
IsDefault="True"/>
|
||||
|
||||
<Button MinWidth="76"
|
||||
Margin="8,0,0,0"
|
||||
TabIndex="101"
|
||||
Content="{x:Static p:Resources.Cancel}"
|
||||
IsCancel="True"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Window>
|
|
@ -1,35 +0,0 @@
|
|||
// Copyright (c) Brice Lambson
|
||||
// The Brice Lambson licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information. Code forked from Brice Lambson's https://github.com/bricelam/ImageResizer/
|
||||
|
||||
using System.Diagnostics;
|
||||
using System.Windows;
|
||||
using System.Windows.Navigation;
|
||||
using ImageResizer.ViewModels;
|
||||
|
||||
namespace ImageResizer.Views
|
||||
{
|
||||
public partial class AdvancedWindow : Window
|
||||
{
|
||||
public AdvancedWindow(AdvancedViewModel viewModel)
|
||||
{
|
||||
DataContext = viewModel;
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void HandleAcceptClick(object sender, RoutedEventArgs e)
|
||||
=> DialogResult = true;
|
||||
|
||||
private void HandleRequestNavigate(object sender, RequestNavigateEventArgs e)
|
||||
{
|
||||
Process.Start(e.Uri.ToString());
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
// Fix for black outline WPF bug when a window uses custom chrome. More info here https://stackoverflow.com/questions/29207331/wpf-window-with-custom-chrome-has-unwanted-outline-on-right-and-bottom
|
||||
private void WindowContentRendered(object sender, System.EventArgs e)
|
||||
{
|
||||
InvalidateVisual();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
// Copyright (c) Brice Lambson
|
||||
// The Brice Lambson licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information. Code forked from Brice Lambson's https://github.com/bricelam/ImageResizer/
|
||||
|
||||
using System.Globalization;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace ImageResizer.Views
|
||||
{
|
||||
internal class AutoDoubleValidationRule : ValidationRule
|
||||
{
|
||||
public override ValidationResult Validate(object value, CultureInfo cultureInfo)
|
||||
{
|
||||
var text = (string)value;
|
||||
|
||||
return new ValidationResult(
|
||||
string.IsNullOrEmpty(text)
|
||||
|| double.TryParse(text, NumberStyles.AllowThousands | NumberStyles.Float, cultureInfo, out var _),
|
||||
null);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
// Copyright (c) Brice Lambson
|
||||
// The Brice Lambson licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information. Code forked from Brice Lambson's https://github.com/bricelam/ImageResizer/
|
||||
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
using ImageResizer.ViewModels;
|
||||
|
||||
namespace ImageResizer.Views
|
||||
{
|
||||
[ValueConversion(typeof(Guid), typeof(string))]
|
||||
public class ContainerFormatConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
=> AdvancedViewModel.EncoderMap.TryGetValue((Guid)value, out var result)
|
||||
? result
|
||||
: value?.ToString();
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
=> throw new NotImplementedException();
|
||||
}
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Windows.Automation.Peers;
|
||||
using System.Windows.Documents;
|
||||
|
||||
namespace ImageResizer.Views
|
||||
{
|
||||
public class CustomizableHyperlinkAutomationPeer : HyperlinkAutomationPeer
|
||||
{
|
||||
public CustomizableHyperlinkAutomationPeer(Hyperlink owner)
|
||||
: base(owner)
|
||||
{
|
||||
}
|
||||
|
||||
public AutomationControlType ControlType { get; set; }
|
||||
|
||||
protected override AutomationControlType GetAutomationControlTypeCore()
|
||||
{
|
||||
return ControlType;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
// Copyright (c) Brice Lambson
|
||||
// The Brice Lambson licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information. Code forked from Brice Lambson's https://github.com/bricelam/ImageResizer/
|
||||
// void ShowAdvanced(AdvancedViewModel viewModel);
|
||||
|
||||
using System.Collections.Generic;
|
||||
using ImageResizer.ViewModels;
|
||||
|
@ -12,8 +11,6 @@ namespace ImageResizer.Views
|
|||
{
|
||||
void Close();
|
||||
|
||||
void ShowAdvanced(AdvancedViewModel viewModel);
|
||||
|
||||
IEnumerable<string> OpenPictureFiles();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -198,17 +198,6 @@
|
|||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Button Content=""
|
||||
FontFamily="Segoe MDL2 Assets"
|
||||
Style="{StaticResource DefaultButtonStyle}"
|
||||
FontSize="16"
|
||||
Margin="-6,0,0,0"
|
||||
AutomationProperties.Name="{x:Static p:Resources.Input_ShowAdvanced}"
|
||||
ToolTip="{x:Static p:Resources.Input_ShowAdvanced}"
|
||||
Background="Transparent"
|
||||
Command="{Binding ShowAdvancedCommand}"
|
||||
Visibility="{Binding ShowAdvancedSettings, Converter={StaticResource BoolValueConverter}}"/>
|
||||
|
||||
<Button Grid.Column="1"
|
||||
Style="{StaticResource AccentButtonStyle}"
|
||||
MinWidth="76"
|
||||
|
|
|
@ -39,8 +39,6 @@ namespace ImageResizer.Views
|
|||
return openFileDialog.FileNames;
|
||||
}
|
||||
|
||||
public void ShowAdvanced(AdvancedViewModel viewModel) => viewModel?.Close(new AdvancedWindow(viewModel).ShowDialog() == true);
|
||||
|
||||
void IMainView.Close()
|
||||
=> Dispatcher.Invoke((Action)Close);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue