Repository: microsoft/PowerToys
File: src/settings-ui/Settings.UI/Flyout/LaunchPage.xaml.cs (C#)

Code before:

        private void ModuleButton_Click(object sender, RoutedEventArgs e)
        {
            FlyoutMenuButton selectedModuleBtn = sender as FlyoutMenuButton;
            bool moduleRun = true;
            switch ((string)selectedModuleBtn.Tag)
            {
                case "ColorPicker": // Launch ColorPicker
                    using (var eventHandle = new EventWaitHandle(false, EventResetMode.AutoReset, Constants.ShowColorPickerSharedEvent()))
                    {
                        eventHandle.Set();
                    }

                    break;
                case "FancyZones": // Launch FancyZones Editor
                    using (var eventHandle = new EventWaitHandle(false, EventResetMode.AutoReset, Constants.FZEToggleEvent()))
                    {
                        eventHandle.Set();
                    }

                    break;

                case "Hosts": // Launch Hosts
                    {
                        bool launchAdmin = SettingsRepository<HostsSettings>.GetInstance(new SettingsUtils()).SettingsConfig.Properties.LaunchAdministrator;
                        string eventName = App.IsElevated || !launchAdmin ? Constants.ShowHostsSharedEvent() : Constants.ShowHostsAdminSharedEvent();
                        using (var eventHandle = new EventWaitHandle(false, EventResetMode.AutoReset, eventName))
                        {
                            eventHandle.Set();
                        }
                    }

                    break;

                case "RegistryPreview": // Launch Registry Preview
                    using (var eventHandle = new EventWaitHandle(false, EventResetMode.AutoReset, Constants.RegistryPreviewTriggerEvent()))
                    {
                        eventHandle.Set();
                    }

                    break;
                case "MeasureTool": // Launch Screen Ruler
                    using (var eventHandle = new EventWaitHandle(false, EventResetMode.AutoReset, Constants.MeasureToolTriggerEvent()))
                    {
                        eventHandle.Set();
                    }

                    break;

                case "PowerLauncher": // Launch Run
                    using (var eventHandle = new EventWaitHandle(false, EventResetMode.AutoReset, Constants.PowerLauncherSharedEvent()))

Review comment (suggestion):
I'm puzzled by this condition `App.IsElevated || !launchAdmin`. Should it be launchAdmin (without !)?

Edit: And swap the constants 

Code after:

        private void ModuleButton_Click(object sender, RoutedEventArgs e)
        {
            FlyoutMenuButton selectedModuleBtn = sender as FlyoutMenuButton;
            bool moduleRun = true;
            switch ((string)selectedModuleBtn.Tag)
            {
                case "ColorPicker": // Launch ColorPicker
                    using (var eventHandle = new EventWaitHandle(false, EventResetMode.AutoReset, Constants.ShowColorPickerSharedEvent()))
                    {
                        eventHandle.Set();
                    }

                    break;
                case "FancyZones": // Launch FancyZones Editor
                    using (var eventHandle = new EventWaitHandle(false, EventResetMode.AutoReset, Constants.FZEToggleEvent()))
                    {
                        eventHandle.Set();
                    }

                    break;

                case "Hosts": // Launch Hosts
                    {
                        bool launchAdmin = SettingsRepository<HostsSettings>.GetInstance(new SettingsUtils()).SettingsConfig.Properties.LaunchAdministrator;
                        string eventName = !App.IsElevated && launchAdmin
                            ? Constants.ShowHostsAdminSharedEvent()
                            : Constants.ShowHostsSharedEvent();

                        using (var eventHandle = new EventWaitHandle(false, EventResetMode.AutoReset, eventName))
                        {
                            eventHandle.Set();
                        }
                    }

                    break;

                case "RegistryPreview": // Launch Registry Preview
                    using (var eventHandle = new EventWaitHandle(false, EventResetMode.AutoReset, Constants.RegistryPreviewTriggerEvent()))
                    {
                        eventHandle.Set();
                    }

                    break;
                case "MeasureTool": // Launch Screen Ruler
                    using (var eventHandle = new EventWaitHandle(false, EventResetMode.AutoReset, Constants.MeasureToolTriggerEvent()))
                    {
                        eventHandle.Set();
                    }

                    break;