ACAT.Lib.Extension.AppAgents.TalkWindow.TalkWindowAgentBase.CheckWidgetEnabled C# (CSharp) Méthode

CheckWidgetEnabled() public méthode

Invoked to set the 'enabled' state of a widget. This will depend on the current context.
public CheckWidgetEnabled ( ACAT.Lib.Core.AgentManagement.CheckEnabledArgs arg ) : void
arg ACAT.Lib.Core.AgentManagement.CheckEnabledArgs contains info about the widget
Résultat void
        public override void CheckWidgetEnabled(CheckEnabledArgs arg)
        {
            arg.Handled = true;
            switch (arg.Widget.SubClass)
            {
                case "ShowWindowPosSizeMenu":
                    arg.Enabled = !Context.AppTalkWindowManager.IsTalkWindowVisible;
                    arg.Handled = true;
                    break;

                case "ClearTalkWindowText":
                    arg.Enabled = !Context.AppTalkWindowManager.IsTalkWindowEmpty();
                    break;

                case "ContextualMenu":
                    arg.Enabled = true;
                    break;

                case "SpeechControl":
                    if (_ttsEngineSupportsSpeechControl)
                    {
                        String word;
                        TextControlAgent.GetWordAtCaret(out word);
                        object ret = Context.AppTTSManager.ActiveEngine.GetInvoker().InvokeExtensionMethod("IsValidSpeechControlSequence", word);
                        if (ret is bool)
                        {
                            arg.Enabled = (bool)ret;
                        }
                    }

                    break;

                case "QuickSearch":
                case "GoogleSearch":
                case "WikiSearch":
                    arg.Enabled = !String.IsNullOrEmpty(getTalkWindowSelectedTextOrPara().Trim());
                    break;

                default:
                    arg.Handled = false;
                    break;
            }
        }