コード例 #1
0
        private void AddTrayIconWpf()
        {
            ActionExtension.InvokeInMainThread(() => {
                var patchSettings = SettingsShadersPatch.IsCustomShadersPatchInstalled() ? new MenuItem {
                    Header  = "Custom Shaders Patch settings",
                    Command = SettingsShadersPatch.GetShowSettingsCommand()
                } : null;
                if (patchSettings != null)
                {
                    LimitedService.SetLimited(patchSettings, true);
                }

                var rhm = RhmService.Instance.Active
                        ? new MenuItem {
                    Header  = "RHM settings",
                    Command = RhmService.Instance.ShowSettingsCommand
                }
                        : null;

                var restore = new MenuItem {
                    Header = UiStrings.Restore
                };
                var close = new MenuItem {
                    Header = UiStrings.Close
                };

                restore.Click += OnRestoreMenuItemClick;
                close.Click   += OnCloseMenuItemClick;

                _icon = new TaskbarIcon {
                    Icon        = AppIconService.GetTrayIcon(),
                    ToolTipText = AppStrings.Hibernate_TrayText,
                    ContextMenu = new ContextMenu()
                                  .AddItem(patchSettings)
                                  .AddItem(rhm)
                                  .AddSeparator()
                                  .AddItem(restore)
                                  .AddItem(close),
                    DoubleClickCommand = new DelegateCommand(WakeUp)
                };
            });
        }
コード例 #2
0
ファイル: Search.xaml.cs プロジェクト: tankyx/actools
        private bool TestElement([CanBeNull] FrameworkElement element)
        {
            if (element == null)
            {
                return(false);
            }

            while (GetLinkedTo(element) is FrameworkElement refElement)
            {
                element = refElement;
            }

            if (LimitedService.GetLimited(element) && !InternalUtils.IsAllRight)
            {
                return(false);
            }

            return(element.FindLogicalChildren <TextBlock>().Any(z => _filter.Test(z.Text)) ||
                   element.FindLogicalChildren <Label>().Any(z => _filter.Test(z.Content?.ToString() ?? "")) ||
                   TestKeywords(GetKeywords(element)) ||
                   TestKeywords(GetKeywords(element.Parent)));
        }