QuickAccessLauncher.cs
1 // Copyright (c) Microsoft Corporation 2 // The Microsoft Corporation licenses this file to you under the MIT license. 3 // See the LICENSE file in the project root for more information. 4 5 using System.Threading; 6 using ManagedCommon; 7 using Microsoft.PowerToys.Settings.UI.Controls; 8 using Microsoft.PowerToys.Settings.UI.Library; 9 using PowerToys.Interop; 10 11 namespace Microsoft.PowerToys.QuickAccess.Services 12 { 13 public class QuickAccessLauncher : Microsoft.PowerToys.Settings.UI.Controls.QuickAccessLauncher 14 { 15 private readonly IQuickAccessCoordinator? _coordinator; 16 17 public QuickAccessLauncher(IQuickAccessCoordinator? coordinator) 18 : base(coordinator?.IsRunnerElevated ?? false) 19 { 20 _coordinator = coordinator; 21 } 22 23 public override bool Launch(ModuleType moduleType) 24 { 25 bool moduleRun = base.Launch(moduleType); 26 27 if (moduleRun) 28 { 29 _coordinator?.OnModuleLaunched(moduleType); 30 } 31 32 _coordinator?.HideFlyout(); 33 34 return moduleRun; 35 } 36 } 37 }