diff --git a/PowerToys.sln b/PowerToys.sln
index d3665c4e27..cdf59c15df 100644
--- a/PowerToys.sln
+++ b/PowerToys.sln
@@ -29,6 +29,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "runner", "src\runner\runner
{F9C68EDF-AC74-4B77-9AF1-005D9C9F6A99} = {F9C68EDF-AC74-4B77-9AF1-005D9C9F6A99}
{07C389E3-6BC8-41CF-923E-307B1265FA2D} = {07C389E3-6BC8-41CF-923E-307B1265FA2D}
{89F34AF7-1C34-4A72-AA6E-534BCF972BD9} = {89F34AF7-1C34-4A72-AA6E-534BCF972BD9}
+ {E6410BFC-B341-498C-8C67-312C20CDD8D5} = {E6410BFC-B341-498C-8C67-312C20CDD8D5}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "common", "src\common\common.vcxproj", "{74485049-C722-400F-ABE5-86AC52D929B3}"
@@ -255,6 +256,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PowerLauncher.Telemetry", "
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Telemetry", "src\common\ManagedTelemetry\Telemetry\Telemetry.csproj", "{5D00D290-4016-4CFE-9E41-1E7C724509BA}"
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "os-detection", "src\common\os-detection\os-detection.vcxproj", "{E6410BFC-B341-498C-8C67-312C20CDD8D5}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
@@ -497,6 +500,10 @@ Global
{5D00D290-4016-4CFE-9E41-1E7C724509BA}.Debug|x64.Build.0 = Debug|x64
{5D00D290-4016-4CFE-9E41-1E7C724509BA}.Release|x64.ActiveCfg = Release|x64
{5D00D290-4016-4CFE-9E41-1E7C724509BA}.Release|x64.Build.0 = Release|x64
+ {E6410BFC-B341-498C-8C67-312C20CDD8D5}.Debug|x64.ActiveCfg = Debug|x64
+ {E6410BFC-B341-498C-8C67-312C20CDD8D5}.Debug|x64.Build.0 = Debug|x64
+ {E6410BFC-B341-498C-8C67-312C20CDD8D5}.Release|x64.ActiveCfg = Release|x64
+ {E6410BFC-B341-498C-8C67-312C20CDD8D5}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -566,6 +573,7 @@ Global
{787B8AA6-CA93-4C84-96FE-DF31110AD1C4} = {4AFC9975-2456-4C70-94A4-84073C1CED93}
{08C8C05F-0362-41BC-818C-724572DF8B06} = {C140A3EF-6DBF-4084-9D4C-4EB5A99FEE68}
{5D00D290-4016-4CFE-9E41-1E7C724509BA} = {1AFB6476-670D-4E80-A464-657E01DFF482}
+ {E6410BFC-B341-498C-8C67-312C20CDD8D5} = {1AFB6476-670D-4E80-A464-657E01DFF482}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {C3A2F9D1-7930-4EF4-A6FC-7EE0A99821D0}
diff --git a/installer/PowerToysSetup/Product.wxs b/installer/PowerToysSetup/Product.wxs
index cc0f156f20..a8bea2d5b6 100644
--- a/installer/PowerToysSetup/Product.wxs
+++ b/installer/PowerToysSetup/Product.wxs
@@ -347,6 +347,9 @@
+
+
+
@@ -693,6 +696,7 @@
+
diff --git a/src/common/os-detection/dllmain.cpp b/src/common/os-detection/dllmain.cpp
new file mode 100644
index 0000000000..f2665971ac
--- /dev/null
+++ b/src/common/os-detection/dllmain.cpp
@@ -0,0 +1,19 @@
+// dllmain.cpp : Defines the entry point for the DLL application.
+#include "pch.h"
+
+BOOL APIENTRY DllMain( HMODULE hModule,
+ DWORD ul_reason_for_call,
+ LPVOID lpReserved
+ )
+{
+ switch (ul_reason_for_call)
+ {
+ case DLL_PROCESS_ATTACH:
+ case DLL_THREAD_ATTACH:
+ case DLL_THREAD_DETACH:
+ case DLL_PROCESS_DETACH:
+ break;
+ }
+ return TRUE;
+}
+
diff --git a/src/common/os-detection/framework.h b/src/common/os-detection/framework.h
new file mode 100644
index 0000000000..54b83e94fd
--- /dev/null
+++ b/src/common/os-detection/framework.h
@@ -0,0 +1,5 @@
+#pragma once
+
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+// Windows Header Files
+#include
diff --git a/src/common/os-detection/os-detect.cpp b/src/common/os-detection/os-detect.cpp
new file mode 100644
index 0000000000..b32fbb1151
--- /dev/null
+++ b/src/common/os-detection/os-detect.cpp
@@ -0,0 +1,38 @@
+#include "pch.h"
+#include "os-detect.h"
+
+#include
+
+// The following three helper functions determine if the user has a build version higher than or equal to 19h1, as that is a requirement for xaml islands
+// Source : Microsoft-ui-xaml github
+// Link: https://github.com/microsoft/microsoft-ui-xaml/blob/c045cde57c5c754683d674634a0baccda34d58c4/dev/dll/SharedHelpers.cpp
+template
+bool IsAPIContractVxAvailable()
+{
+ static bool isAPIContractVxAvailableInitialized = false;
+ static bool isAPIContractVxAvailable = false;
+ if (!isAPIContractVxAvailableInitialized)
+ {
+ isAPIContractVxAvailableInitialized = true;
+ isAPIContractVxAvailable = winrt::Windows::Foundation::Metadata::ApiInformation::IsApiContractPresent(L"Windows.Foundation.UniversalApiContract", APIVersion);
+ }
+
+ return isAPIContractVxAvailable;
+}
+
+bool IsAPIContractV8Available()
+{
+ return IsAPIContractVxAvailable<8>();
+}
+
+bool Is19H1OrHigher()
+{
+ return IsAPIContractV8Available();
+}
+
+// This function returns true if the build is 19h1 or higher, so that we deploy the new settings.
+// It returns false otherwise.
+bool UseNewSettings()
+{
+ return Is19H1OrHigher();
+}
\ No newline at end of file
diff --git a/src/common/os-detection/os-detect.h b/src/common/os-detection/os-detect.h
new file mode 100644
index 0000000000..e16e0daf2a
--- /dev/null
+++ b/src/common/os-detection/os-detect.h
@@ -0,0 +1,3 @@
+#pragma once
+
+extern "C" __declspec(dllexport) bool UseNewSettings();
\ No newline at end of file
diff --git a/src/common/os-detection/os-detection.vcxproj b/src/common/os-detection/os-detection.vcxproj
new file mode 100644
index 0000000000..5f33d9b653
--- /dev/null
+++ b/src/common/os-detection/os-detection.vcxproj
@@ -0,0 +1,100 @@
+
+
+
+
+ Debug
+ x64
+
+
+ Release
+ x64
+
+
+
+ 16.0
+ {E6410BFC-B341-498C-8C67-312C20CDD8D5}
+ Win32Proj
+ osdetection
+ 10.0
+
+
+
+ DynamicLibrary
+ true
+ v142
+ Unicode
+
+
+ DynamicLibrary
+ false
+ v142
+ true
+ Unicode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+ false
+
+
+
+ Use
+ Level3
+ true
+ _DEBUG;OSDETECTION_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
+ true
+
+
+ Windows
+ true
+ false
+
+
+
+
+ Use
+ Level3
+ true
+ true
+ true
+ NDEBUG;OSDETECTION_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
+ true
+
+
+ Windows
+ true
+ true
+ true
+ false
+
+
+
+
+
+
+
+
+
+
+
+ Create
+ Create
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/common/os-detection/os-detection.vcxproj.filters b/src/common/os-detection/os-detection.vcxproj.filters
new file mode 100644
index 0000000000..49a7e32acc
--- /dev/null
+++ b/src/common/os-detection/os-detection.vcxproj.filters
@@ -0,0 +1,39 @@
+
+
+
+
+ {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
+ cpp;c;cc;cxx;c++;def;odl;idl;hpj;bat;asm;asmx
+
+
+ {93995380-89BD-4b04-88EB-625FBE52EBFB}
+ h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd
+
+
+ {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
+ rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
+
+
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+
\ No newline at end of file
diff --git a/src/common/os-detection/pch.cpp b/src/common/os-detection/pch.cpp
new file mode 100644
index 0000000000..57e872b4d2
--- /dev/null
+++ b/src/common/os-detection/pch.cpp
@@ -0,0 +1,6 @@
+// pch.cpp: source file corresponding to the pre-compiled header
+
+#include "pch.h"
+#pragma comment(lib, "windowsapp")
+
+// When you are using pre-compiled headers, this source file is necessary for compilation to succeed.
diff --git a/src/common/os-detection/pch.h b/src/common/os-detection/pch.h
new file mode 100644
index 0000000000..885d5d62e4
--- /dev/null
+++ b/src/common/os-detection/pch.h
@@ -0,0 +1,13 @@
+// pch.h: This is a precompiled header file.
+// Files listed below are compiled only once, improving build performance for future builds.
+// This also affects IntelliSense performance, including code completion and many code browsing features.
+// However, files listed here are ALL re-compiled if any one of them is updated between builds.
+// Do not add files here that you will be updating frequently as this negates the performance advantage.
+
+#ifndef PCH_H
+#define PCH_H
+
+// add headers that you want to pre-compile here
+#include "framework.h"
+
+#endif //PCH_H
diff --git a/src/modules/imageresizer/ui/ImageResizerUI.csproj b/src/modules/imageresizer/ui/ImageResizerUI.csproj
index ac3f0d3b48..da3ee43655 100644
--- a/src/modules/imageresizer/ui/ImageResizerUI.csproj
+++ b/src/modules/imageresizer/ui/ImageResizerUI.csproj
@@ -98,6 +98,7 @@
+
diff --git a/src/modules/imageresizer/ui/Models/AdvancedSettings.cs b/src/modules/imageresizer/ui/Models/AdvancedSettings.cs
new file mode 100644
index 0000000000..87192a90c9
--- /dev/null
+++ b/src/modules/imageresizer/ui/Models/AdvancedSettings.cs
@@ -0,0 +1,13 @@
+// This class sets the visibility property of Advanced settings based on the OS Version
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace ImageResizer.Models
+{
+ public class AdvancedSettings
+ {
+ [DllImport("../os-detection.dll", EntryPoint = "UseNewSettings", ExactSpelling = false)]
+ public static extern bool UseNewSettings();
+ }
+}
diff --git a/src/modules/imageresizer/ui/ViewModels/InputViewModel.cs b/src/modules/imageresizer/ui/ViewModels/InputViewModel.cs
index 8468979c82..88ac0b66bf 100644
--- a/src/modules/imageresizer/ui/ViewModels/InputViewModel.cs
+++ b/src/modules/imageresizer/ui/ViewModels/InputViewModel.cs
@@ -33,8 +33,13 @@ 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; }
@@ -51,5 +56,8 @@ namespace ImageResizer.ViewModels
public void Cancel()
=> _mainView.Close();
+
+ public void ShowAdvanced()
+ => _mainView.ShowAdvanced(new AdvancedViewModel(Settings));
}
}
diff --git a/src/modules/imageresizer/ui/Views/IMainView.cs b/src/modules/imageresizer/ui/Views/IMainView.cs
index b04a0626c8..c4055d7e46 100644
--- a/src/modules/imageresizer/ui/Views/IMainView.cs
+++ b/src/modules/imageresizer/ui/Views/IMainView.cs
@@ -12,6 +12,8 @@ namespace ImageResizer.Views
{
void Close();
+ void ShowAdvanced(AdvancedViewModel viewModel);
+
IEnumerable OpenPictureFiles();
}
}
diff --git a/src/modules/imageresizer/ui/Views/InputPage.xaml b/src/modules/imageresizer/ui/Views/InputPage.xaml
index 6130c91719..da76d69512 100644
--- a/src/modules/imageresizer/ui/Views/InputPage.xaml
+++ b/src/modules/imageresizer/ui/Views/InputPage.xaml
@@ -130,13 +130,14 @@
-
+