Files
PowerToys/src/settings-ui/Settings.UI/SettingsXAML/OOBE/Views/OobeCropAndLock.xaml.cs

48 lines
1.8 KiB
C#
Raw Normal View History

[New Utility]Crop And Lock (#27832) * [CropAndLock]Original POC code dump * Project rename and delete solution * Remove unused architectures * Update cppwinrt to be in line with the solution * Add to PowerToys solution and fix build errors * Initial module interface empty project * Module skeleton based on AlwaysOnTop * Add loggers to module interface * Add crop and lock to the runner * Enable starts and disable kills the process * Events reacting to hotkeys * Main application reacting to events * Initialize unhandled exception handling * Singleton in line with other projects * Also exit when PowerToys exit is detected * Create Settings page * React to shortcut changes in Settings * Disable Crop and Lock through an Event * Disable running Crop and Lock standalone * Remove Crop and Lock tray icon * Module Interface dll version * Fix main app resource file to include version * Make pch conditional on CI build * Add to signing * Remove settings screen opened by removed tray icon * Fix spellcheck * Yet another fix for spellcheck * Fix disabling utility * Fix solution build configurations * Fix C++ analyzer errors * Try to fix pre-compiled header CI errors * Fix crash while exiting with an active reparent window * Fix missing reference when building in release CI * Add OOBE page * GPO: Add admx and adml file changes * GPO: react to changes in GPO * Add quick access flyout menu entry * Use Crop And Lock icon * Use actual images for Settings and OOBE * Module and app telemetry * Add entry to README.md * Add to process lists * Additional logging * Attribution in Settings page * Add attribution to Community.md * Fix spellcheck * Fix typo in strings * Fix crash when window handle is no longer valid * Update COMMUNITY.md * Fix supportedOS in manifest * Don't show msgbox if detecting second instance * Remove unused hotkey * Tweak attribution * Fix attribution spellcheck
2023-08-10 10:46:33 +01:00
// 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 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;
namespace Microsoft.PowerToys.Settings.UI.OOBE.Views
{
public sealed partial class OobeCropAndLock : Page
{
public OobePowerToysModule ViewModel { get; set; }
public OobeCropAndLock()
{
InitializeComponent();
ViewModel = new OobePowerToysModule(OobeShellPage.OobeShellHandler.Modules[(int)PowerToysModules.CropAndLock]);
DataContext = ViewModel;
}
private void SettingsLaunchButton_Click(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
{
if (OobeShellPage.OpenMainWindowCallback != null)
{
OobeShellPage.OpenMainWindowCallback(typeof(CropAndLockPage));
}
ViewModel.LogOpeningSettingsEvent();
}
protected override void OnNavigatedTo(NavigationEventArgs e)
{
ViewModel.LogOpeningModuleEvent();
ReparentHotkeyControl.Keys = SettingsRepository<CropAndLockSettings>.GetInstance(new SettingsUtils()).SettingsConfig.Properties.ReparentHotkey.Value.GetKeysList();
ThumbnailHotkeyControl.Keys = SettingsRepository<CropAndLockSettings>.GetInstance(new SettingsUtils()).SettingsConfig.Properties.ThumbnailHotkey.Value.GetKeysList();
}
protected override void OnNavigatedFrom(NavigationEventArgs e)
{
ViewModel.LogClosingModuleEvent();
}
}
}