mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-08 12:18:50 +02:00
[Settings]Refactor module data for Dashboard and Flyout (#29555)
* Intoducing ModuleType enum, restructuring Dashboard AllApps page * Restructuring LauncherViewModel + fix spell checker * Restructuring Dashboard page * Fixing MousePointerCrossHair icon path, refactoring UpdatingGeneralSettingsCallback method * Updating Flyout Launch page. * Fix logging
This commit is contained in:
@@ -5,6 +5,7 @@ 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;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Telemetry.Events;
|
||||
@@ -37,16 +38,16 @@ namespace Microsoft.PowerToys.Settings.UI.Flyout
|
||||
// Closing manually the flyout to workaround focus gain problems
|
||||
App.GetFlyoutWindow()?.Hide();
|
||||
|
||||
switch ((string)selectedModuleBtn.Tag)
|
||||
switch ((ModuleType)selectedModuleBtn.Tag)
|
||||
{
|
||||
case "ColorPicker": // Launch ColorPicker
|
||||
case ModuleType.ColorPicker: // Launch ColorPicker
|
||||
using (var eventHandle = new EventWaitHandle(false, EventResetMode.AutoReset, Constants.ShowColorPickerSharedEvent()))
|
||||
{
|
||||
eventHandle.Set();
|
||||
}
|
||||
|
||||
break;
|
||||
case "EnvironmentVariables": // Launch Environment Variables
|
||||
case ModuleType.EnvironmentVariables: // Launch Environment Variables
|
||||
{
|
||||
bool launchAdmin = SettingsRepository<EnvironmentVariablesSettings>.GetInstance(new SettingsUtils()).SettingsConfig.Properties.LaunchAdministrator;
|
||||
string eventName = !App.IsElevated && launchAdmin
|
||||
@@ -61,7 +62,7 @@ namespace Microsoft.PowerToys.Settings.UI.Flyout
|
||||
|
||||
break;
|
||||
|
||||
case "FancyZones": // Launch FancyZones Editor
|
||||
case ModuleType.FancyZones: // Launch FancyZones Editor
|
||||
using (var eventHandle = new EventWaitHandle(false, EventResetMode.AutoReset, Constants.FZEToggleEvent()))
|
||||
{
|
||||
eventHandle.Set();
|
||||
@@ -69,7 +70,7 @@ namespace Microsoft.PowerToys.Settings.UI.Flyout
|
||||
|
||||
break;
|
||||
|
||||
case "Hosts": // Launch Hosts
|
||||
case ModuleType.Hosts: // Launch Hosts
|
||||
{
|
||||
bool launchAdmin = SettingsRepository<HostsSettings>.GetInstance(new SettingsUtils()).SettingsConfig.Properties.LaunchAdministrator;
|
||||
string eventName = !App.IsElevated && launchAdmin
|
||||
@@ -84,14 +85,14 @@ namespace Microsoft.PowerToys.Settings.UI.Flyout
|
||||
|
||||
break;
|
||||
|
||||
case "RegistryPreview": // Launch Registry Preview
|
||||
case ModuleType.RegistryPreview: // Launch Registry Preview
|
||||
using (var eventHandle = new EventWaitHandle(false, EventResetMode.AutoReset, Constants.RegistryPreviewTriggerEvent()))
|
||||
{
|
||||
eventHandle.Set();
|
||||
}
|
||||
|
||||
break;
|
||||
case "MeasureTool": // Launch Screen Ruler
|
||||
case ModuleType.MeasureTool: // Launch Screen Ruler
|
||||
using (var eventHandle = new EventWaitHandle(false, EventResetMode.AutoReset, Constants.MeasureToolTriggerEvent()))
|
||||
{
|
||||
eventHandle.Set();
|
||||
@@ -99,7 +100,7 @@ namespace Microsoft.PowerToys.Settings.UI.Flyout
|
||||
|
||||
break;
|
||||
|
||||
case "PowerLauncher": // Launch Run
|
||||
case ModuleType.PowerLauncher: // Launch Run
|
||||
using (var eventHandle = new EventWaitHandle(false, EventResetMode.AutoReset, Constants.PowerLauncherSharedEvent()))
|
||||
{
|
||||
eventHandle.Set();
|
||||
@@ -107,7 +108,7 @@ namespace Microsoft.PowerToys.Settings.UI.Flyout
|
||||
|
||||
break;
|
||||
|
||||
case "PowerOCR": // Launch Text Extractor
|
||||
case ModuleType.PowerOCR: // Launch Text Extractor
|
||||
using (var eventHandle = new EventWaitHandle(false, EventResetMode.AutoReset, Constants.ShowPowerOCRSharedEvent()))
|
||||
{
|
||||
eventHandle.Set();
|
||||
@@ -115,7 +116,7 @@ namespace Microsoft.PowerToys.Settings.UI.Flyout
|
||||
|
||||
break;
|
||||
|
||||
case "ShortcutGuide": // Launch Shortcut Guide
|
||||
case ModuleType.ShortcutGuide: // Launch Shortcut Guide
|
||||
using (var eventHandle = new EventWaitHandle(false, EventResetMode.AutoReset, Constants.ShortcutGuideTriggerEvent()))
|
||||
{
|
||||
eventHandle.Set();
|
||||
@@ -130,7 +131,7 @@ namespace Microsoft.PowerToys.Settings.UI.Flyout
|
||||
|
||||
if (moduleRun)
|
||||
{
|
||||
PowerToysTelemetry.Log.WriteEvent(new TrayFlyoutModuleRunEvent() { ModuleName = (string)selectedModuleBtn.Tag });
|
||||
PowerToysTelemetry.Log.WriteEvent(new TrayFlyoutModuleRunEvent() { ModuleName = ((ModuleType)selectedModuleBtn.Tag).ToString() });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user