mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 11:48:06 +01:00
[Refactor]Port C++/CX to C++/WinRT (#34198)
## Summary of the Pull Request Removes all C++/CX code, replacing it with C++/WinRT. ## Detailed Description of the Pull Request / Additional comments Removes all C++/CX code. Renames interop namespaces to be better consumed by CsWinRT. Standardizes all projects on net8.0-windows10.0.20348.0, which is a requirement for C++/WinRT usage. FileLocksmithLibInterop brought to stdcpplatest and static analysis errors were corrected. Removed now unneeded string conversion code from FileLocksmithLibInterop. Changed interop KeyboardHook to use a single hook across all instances. Required because on C++/WinRT we don't have the .NET runtime to bind a object instance to a delegate and be able to pass it to a C function pointer argument (still no idea why this worked correctly on C++/CX to be honest). This change actually makes us create less low level keyboard hooks. Changed some code that depended on arrays since WinRT/C++ returns null instead of an empty array through the interface. ## Validation Steps Performed Built and tested runtime.
This commit is contained in:
@@ -9,7 +9,6 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.Json;
|
||||
using System.Threading.Tasks;
|
||||
using interop;
|
||||
using ManagedCommon;
|
||||
using Microsoft.PowerToys.Settings.UI.Helpers;
|
||||
using Microsoft.PowerToys.Settings.UI.Library;
|
||||
@@ -18,6 +17,7 @@ using Microsoft.PowerToys.Settings.UI.Services;
|
||||
using Microsoft.PowerToys.Settings.UI.Views;
|
||||
using Microsoft.PowerToys.Telemetry;
|
||||
using Microsoft.UI.Xaml;
|
||||
using PowerToys.Interop;
|
||||
using Windows.UI.Popups;
|
||||
using WinRT.Interop;
|
||||
using WinUIEx;
|
||||
|
||||
@@ -5,13 +5,13 @@ using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Threading;
|
||||
using global::Windows.System;
|
||||
using interop;
|
||||
using Microsoft.PowerToys.Settings.UI.Library;
|
||||
using Microsoft.PowerToys.Settings.UI.ViewModels;
|
||||
using Microsoft.PowerToys.Settings.UI.Views;
|
||||
using Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Microsoft.UI.Xaml.Media.Animation;
|
||||
using PowerToys.Interop;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Flyout
|
||||
{
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
using global::Windows.System;
|
||||
using interop;
|
||||
using ManagedCommon;
|
||||
using Microsoft.PowerToys.Settings.UI.Controls;
|
||||
using Microsoft.PowerToys.Settings.UI.Library;
|
||||
@@ -14,6 +13,7 @@ using Microsoft.PowerToys.Telemetry;
|
||||
using Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Microsoft.UI.Xaml.Media.Animation;
|
||||
using PowerToys.Interop;
|
||||
using WinUIEx;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Flyout
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Threading;
|
||||
using interop;
|
||||
using Microsoft.PowerToys.Settings.UI.Library;
|
||||
using Microsoft.PowerToys.Settings.UI.OOBE.Enums;
|
||||
using Microsoft.PowerToys.Settings.UI.OOBE.ViewModel;
|
||||
using Microsoft.PowerToys.Settings.UI.Views;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Microsoft.UI.Xaml.Navigation;
|
||||
using PowerToys.Interop;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.OOBE.Views
|
||||
{
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Threading;
|
||||
using interop;
|
||||
using Microsoft.PowerToys.Settings.UI.Library;
|
||||
using Microsoft.PowerToys.Settings.UI.OOBE.Enums;
|
||||
using Microsoft.PowerToys.Settings.UI.OOBE.ViewModel;
|
||||
using Microsoft.PowerToys.Settings.UI.Views;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Microsoft.UI.Xaml.Navigation;
|
||||
using PowerToys.Interop;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.OOBE.Views
|
||||
{
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using interop;
|
||||
using Microsoft.PowerToys.Settings.UI.Helpers;
|
||||
using Microsoft.PowerToys.Settings.UI.OOBE.Enums;
|
||||
using Microsoft.PowerToys.Settings.UI.OOBE.Views;
|
||||
using Microsoft.UI;
|
||||
using Microsoft.UI.Windowing;
|
||||
using Microsoft.UI.Xaml;
|
||||
using PowerToys.Interop;
|
||||
using Windows.Graphics;
|
||||
using WinUIEx;
|
||||
using WinUIEx.Messaging;
|
||||
|
||||
@@ -6,11 +6,11 @@ using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Threading;
|
||||
using global::PowerToys.GPOWrapper;
|
||||
using interop;
|
||||
using Microsoft.PowerToys.Settings.UI.Library;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Helpers;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Interfaces;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.ViewModels.Commands;
|
||||
using PowerToys.Interop;
|
||||
using Settings.UI.Library.Enumerations;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
|
||||
@@ -6,11 +6,11 @@ using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Threading;
|
||||
using global::PowerToys.GPOWrapper;
|
||||
using interop;
|
||||
using Microsoft.PowerToys.Settings.UI.Library;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Helpers;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Interfaces;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.ViewModels.Commands;
|
||||
using PowerToys.Interop;
|
||||
using Settings.UI.Library.Enumerations;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text.Json;
|
||||
@@ -58,8 +59,8 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
|
||||
Settings = videoConferenceSettingsRepository.SettingsConfig;
|
||||
|
||||
CameraNames = interop.CommonManaged.GetAllVideoCaptureDeviceNames();
|
||||
MicrophoneNames = interop.CommonManaged.GetAllActiveMicrophoneDeviceNames();
|
||||
CameraNames = global::PowerToys.Interop.CommonManaged.GetAllVideoCaptureDeviceNames().ToList();
|
||||
MicrophoneNames = global::PowerToys.Interop.CommonManaged.GetAllActiveMicrophoneDeviceNames().ToList();
|
||||
MicrophoneNames.Insert(0, "[All]");
|
||||
|
||||
var shouldSaveSettings = false;
|
||||
|
||||
Reference in New Issue
Block a user