ACAT.Extensions.Default.FunctionalAgents.LectureManager.LectureManagerAgent.CheckWidgetEnabled C# (CSharp) Method

CheckWidgetEnabled() public method

Invoked to check if a scanner button should be enabled. Uses context to determine the 'enabled' state.
public CheckWidgetEnabled ( ACAT.Lib.Core.AgentManagement.CheckEnabledArgs arg ) : void
arg ACAT.Lib.Core.AgentManagement.CheckEnabledArgs info about the scanner button
return void
        public override void CheckWidgetEnabled(CheckEnabledArgs arg)
        {
            if (arg.Widget.SubClass.Equals("Speak", StringComparison.InvariantCultureIgnoreCase))
            {
                if (!isMainFormActive() || !_lectureMgrForm.FileLoaded)
                {
                    return;
                }

                if (_lectureMgrForm.Mode == LectureManagerMainForm.SpeechMode.All)
                {
                    if (_lectureMgrForm.Speaking)
                    {
                        if (isContextMenuText(arg.Widget))
                        {
                            if (arg.Widget.GetText() != "Pause")
                            {
                                arg.Widget.SetText("Pause");
                            }
                        }
                        else if (isContextMenuIcon(arg.Widget))
                        {
                            String text = arg.Widget.GetText();
                            if (text[0] != 0x127)
                            {
                                const string s = "\u0127";
                                arg.Widget.SetText(s);
                            }
                        }
                    }
                    else if (arg.Widget.GetText() != "Next")
                    {
                        if (isContextMenuText(arg.Widget))
                        {
                            arg.Widget.SetText("Next");
                        }
                        else if (isContextMenuIcon(arg.Widget))
                        {
                            arg.Widget.SetText("F");
                        }
                    }

                    arg.Enabled = true;
                    arg.Handled = true;
                }
                else
                {
                    arg.Handled = true;
                    arg.Enabled = !_lectureMgrForm.Speaking;
                }

                return;
            }

            if (arg.Widget.SubClass.Equals("SpeakMenu", StringComparison.InvariantCultureIgnoreCase))
            {
                if (isMainFormActive())
                {
                    arg.Enabled = _lectureMgrForm.FileLoaded;
                    arg.Handled = true;
                }
            }
            else
            {
                checkWidgetEnabled(_supportedFeatures, arg);
            }
        }