ACAT.Lib.Extension.AppAgents.TalkWindow.TalkWindowAgentBase.OnFocusChanged C# (CSharp) Method

OnFocusChanged() public method

Invoked when the foreground window focus changes. If the foreground window is the talk window, create the Text control agent for it and display the Alphabet scanner
public OnFocusChanged ( ACAT.Lib.Core.Utility.WindowActivityMonitorInfo monitorInfo, bool &handled ) : void
monitorInfo ACAT.Lib.Core.Utility.WindowActivityMonitorInfo Foreground window info
handled bool set to true if handled
return void
        public override void OnFocusChanged(WindowActivityMonitorInfo monitorInfo, ref bool handled)
        {
            Log.Debug();

            _ttsEngineSupportsSpeechControl = false;

            if (Context.AppTalkWindowManager.IsTalkWindowVisible &&
                    (monitorInfo.IsNewFocusedElement || monitorInfo.IsNewWindow))
            {
                var invoker = Context.AppTTSManager.ActiveEngine.GetInvoker();
                _ttsEngineSupportsSpeechControl = invoker.SupportsMethod("SpeechControl") &&
                                                    invoker.SupportsMethod("IsValidSpeechControlSequence");

                var automationElement = getTalkTextWinAutomationElement();
                if (automationElement != null)
                {
                    disposeTextInterface();
                    createTalkWindowTextInterface(monitorInfo.FgHwnd, automationElement);
                    if (!_talkWindowScannerShown)
                    {
                        _talkWindowScannerShown = true;
                        showPanel(this, new PanelRequestEventArgs(PanelClasses.Alphabet, monitorInfo));
                    }
                }
            }

            handled = true;
        }