microsoft/TypeAgent
Publicmirrored fromhttps://github.com/microsoft/TypeAgentAvailable
dotnet/autoShell/Services/IRegistryService.cs
54lines · modecode
| 1 | // Copyright (c) Microsoft Corporation. |
| 2 | // Licensed under the MIT License. |
| 3 | |
| 4 | namespace autoShell.Services; |
| 5 | |
| 6 | /// <summary> |
| 7 | /// Abstracts Windows Registry operations for testability. |
| 8 | /// </summary> |
| 9 | internal interface IRegistryService |
| 10 | { |
| 11 | /// <summary> |
| 12 | /// Gets a value from the registry under HKEY_CURRENT_USER. |
| 13 | /// </summary> |
| 14 | /// <param name="keyPath">The registry subkey path.</param> |
| 15 | /// <param name="valueName">The name of the value to retrieve.</param> |
| 16 | /// <param name="defaultValue">The value to return if the key or value does not exist.</param> |
| 17 | object GetValue(string keyPath, string valueName, object defaultValue = null); |
| 18 | |
| 19 | /// <summary> |
| 20 | /// Sets a value in the registry under HKEY_CURRENT_USER. |
| 21 | /// </summary> |
| 22 | /// <param name="keyPath">The registry subkey path (created if it does not exist).</param> |
| 23 | /// <param name="valueName">The name of the value to set.</param> |
| 24 | /// <param name="value">The data to store.</param> |
| 25 | /// <param name="valueKind">The registry data type.</param> |
| 26 | void SetValue(string keyPath, string valueName, object value, Microsoft.Win32.RegistryValueKind valueKind); |
| 27 | |
| 28 | /// <summary> |
| 29 | /// Sets a value in the registry under HKEY_LOCAL_MACHINE. |
| 30 | /// </summary> |
| 31 | /// <param name="keyPath">The registry subkey path (created if it does not exist).</param> |
| 32 | /// <param name="valueName">The name of the value to set.</param> |
| 33 | /// <param name="value">The data to store.</param> |
| 34 | /// <param name="valueKind">The registry data type.</param> |
| 35 | void SetValueLocalMachine(string keyPath, string valueName, object value, Microsoft.Win32.RegistryValueKind valueKind); |
| 36 | |
| 37 | /// <summary> |
| 38 | /// Broadcasts a WM_SETTINGCHANGE message to notify the system of a setting change. |
| 39 | /// </summary> |
| 40 | /// <param name="setting">The setting name to broadcast (e.g., "ImmersiveColorSet"), or null for a generic notification.</param> |
| 41 | void BroadcastSettingChange(string setting = null); |
| 42 | |
| 43 | /// <summary> |
| 44 | /// Notifies the shell that file associations or Explorer settings have changed, |
| 45 | /// causing open Explorer windows to refresh immediately. |
| 46 | /// </summary> |
| 47 | void NotifyShellChange(); |
| 48 | |
| 49 | /// <summary> |
| 50 | /// Notifies the taskbar to update its auto-hide state immediately. |
| 51 | /// </summary> |
| 52 | /// <param name="autoHide">True to enable auto-hide, false to disable.</param> |
| 53 | void SetTaskbarAutoHideState(bool autoHide); |
| 54 | } |
| 55 | |