mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-03 09:46:54 +02:00
[Settings] Add Image Resizer Settings hyperlink on feature detection of older OS Versions (#2868)
* Added the settings hyperlink code back
* Moved the os detection code to a different file so that it can be imported by image resizer
* Added code to the Image resizer project to react to import the dll
* Added an empty dll project
* Added a dll which can be imported by image resizer
* ImageResizer binding works
* Added the setDllDirectory to load the os-detection dll
* Removed the OS detection files that has been added to the common project
* Added reference to os-detect and removed reference to common/OS-Detection.h
* Modified project files
* Revert "Modified project files"
This reverts commit 75f9d73f30.
* Removed unnecessary showAdvanced bool variables
* Removed OS Detection code from common project
* Cleaned configuration properties of soln and projects
* runner is dependent on os-detection
* Added the os-detection.dll to wxs file
* nit space formatting
* Added reference to os-detection
* Added os-detection header file
* Add os-detection reference
* Added os-detection.dll
* removed the set dll directory and using relative paths instead
* Add relative path
This commit is contained in:
@@ -98,6 +98,7 @@
|
||||
<Compile Include="Extensions\BitmapEncoderExtensions.cs" />
|
||||
<Compile Include="Extensions\ICollectionExtensions.cs" />
|
||||
<Compile Include="Extensions\TimeSpanExtensions.cs" />
|
||||
<Compile Include="Models\AdvancedSettings.cs" />
|
||||
<Compile Include="Models\ResizeError.cs" />
|
||||
<Compile Include="Properties\Settings.cs" />
|
||||
<Compile Include="Models\CustomSize.cs" />
|
||||
|
||||
13
src/modules/imageresizer/ui/Models/AdvancedSettings.cs
Normal file
13
src/modules/imageresizer/ui/Models/AdvancedSettings.cs
Normal file
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,8 @@ namespace ImageResizer.Views
|
||||
{
|
||||
void Close();
|
||||
|
||||
void ShowAdvanced(AdvancedViewModel viewModel);
|
||||
|
||||
IEnumerable<string> OpenPictureFiles();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,13 +130,14 @@
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<!--
|
||||
<TextBlock VerticalAlignment="Center">
|
||||
|
||||
<TextBlock VerticalAlignment="Center"
|
||||
Visibility="{Binding ShowAdvancedSettings, Converter={StaticResource BoolValueConverter}}">
|
||||
<Hyperlink Command="{Binding ShowAdvancedCommand}">
|
||||
<Run Text="{x:Static p:Resources.Input_ShowAdvanced}"/>
|
||||
</Hyperlink>
|
||||
</TextBlock>
|
||||
-->
|
||||
|
||||
<Button Grid.Column="1"
|
||||
Height="23"
|
||||
MinWidth="75"
|
||||
|
||||
@@ -39,10 +39,9 @@ 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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user