/// <summary>
        /// Invoked to check if a scanner button should be enabled.  Uses context
        /// to determine the 'enabled' state.
        /// </summary>
        /// <param name="arg">info about the scanner button</param>
        public override void CheckWidgetEnabled(CheckEnabledArgs arg)
        {
            arg.Handled = true;

            switch (arg.Widget.SubClass)
            {
            case "PunctuationScanner":
            case "NumberScanner":
                arg.Enabled = true;
                break;

            default:

                if (_phraseSpeakScanner != null && !Windows.GetVisible(_phraseSpeakScanner))
                {
                    arg.Handled = false;
                    return;
                }

                if (_phraseSpeakScanner != null && Windows.GetVisible(_phraseSpeakScanner))
                {
                    _phraseSpeakScanner.CheckWidgetEnabled(arg);
                }

                if (!arg.Handled)
                {
                    arg.Enabled = false;
                    arg.Handled = true;
                }
                break;
            }
        }
Example #2
0
 /// <summary>
 /// Checks if the widget (scanner button) should to be enabled or not. Check
 /// our supported features list.
 /// </summary>
 /// <param name="arg">widget info</param>
 public virtual void CheckWidgetEnabled(CheckEnabledArgs arg)
 {
     if (_supportedFeatures.Contains(arg.Widget.SubClass))
     {
         arg.Handled = true;
         arg.Enabled = true;
     }
 }
Example #3
0
 /// <summary>
 /// Check to see if the widget should be enabled or not based
 /// on contextual information
 /// </summary>
 /// <param name="supportedFeatures"></param>
 /// <param name="arg"></param>
 protected void checkWidgetEnabled(String[] supportedFeatures, CheckEnabledArgs arg)
 {
     if (supportedFeatures.Contains(arg.Widget.SubClass))
     {
         arg.Handled = true;
         arg.Enabled = true;
     }
 }
Example #4
0
 /// <summary>
 /// Returns whether the widget associated with a feature
 /// should be enabled or not.
 /// </summary>
 /// <param name="arg">widget info</param>
 public override void CheckWidgetEnabled(CheckEnabledArgs arg)
 {
     // support only if this is a navigation feature
     if (_supportedFeatures.Contains(arg.Widget.SubClass))
     {
         arg.Handled = true;
         arg.Enabled = true;
     }
 }
        /// <summary>
        /// Invoked to check if a scanner button should be enabled.  Uses context
        /// to determine the 'enabled' state.
        /// </summary>
        /// <param name="arg">info about the scanner button</param>
        public bool CheckWidgetEnabled(CheckEnabledArgs arg)
        {
            if (arg.Widget.SubClass == "GoBack")
            {
                arg.Handled = true;
                arg.Enabled = (Parent != null || Owner != null);
                return(true);
            }

            return(_alphabetScannerCommon.CheckWidgetEnabled(arg));
        }
Example #6
0
        /// <summary>
        /// Invoked to check if a scanner button should be enabled.  Uses context
        /// to determine the 'enabled' state.
        /// </summary>
        /// <param name="arg">info about the scanner button</param>
        /// <returns>true on success</returns>
        public bool CheckWidgetEnabled(CheckEnabledArgs arg)
        {
            switch (arg.Widget.SubClass)
            {
            default:
                arg.Enabled = true;
                arg.Handled = true;
                break;
            }

            return(true);
        }
 /// <summary>
 /// Invoked to set the 'enabled' state of a widget.  This
 /// will depend on the current context.
 /// </summary>
 /// <param name="arg">contains info about the widget</param>
 public override void CheckWidgetEnabled(CheckEnabledArgs arg)
 {
     if (arg.Widget.SubClass == "WindowsStartMenu" &&
         (_osVersion == Windows.WindowsVersion.Win8 || _osVersion == Windows.WindowsVersion.Win10))
     {
         arg.Enabled = false;
         arg.Handled = true;
     }
     else
     {
         checkWidgetEnabled(_supportedFeatures, arg);
     }
 }
Example #8
0
 /// <summary>
 /// Invoked to set the 'enabled' state of a widget.  This
 /// will depend on the current context.
 /// </summary>
 /// <param name="arg">contains info about the widget</param>
 public override void CheckWidgetEnabled(CheckEnabledArgs arg)
 {
     if (String.Compare(arg.Widget.SubClass, "EmailAttachFile", true) == 0)
     {
         WindowActivityMonitorInfo info = WindowActivityMonitor.GetForegroundWindowInfo();
         arg.Enabled = (isMailComposeMessageWindow(info.FocusedElement) ||
                        isMailComposeWindow(info.FocusedElement));
         arg.Handled = true;
     }
     else
     {
         checkWidgetEnabled(_supportedFeatures, arg);
     }
 }
Example #9
0
        /// <summary>
        /// Invoked to set the 'enabled' state of a widget.  This
        /// will depend on the current context.
        /// </summary>
        /// <param name="arg">contains info about the widget</param>
        public override void CheckWidgetEnabled(CheckEnabledArgs arg)
        {
            arg.Handled = true;
            switch (arg.Widget.SubClass)
            {
            case "ClearTalkWindowText":
                arg.Enabled = textBoxControl != null && (textBoxControl.Text.Length != 0);
                break;

            default:
                arg.Handled = false;
                break;
            }
        }
Example #10
0
        /// <summary>
        /// Invoked to check if a scanner button should be enabled.  Uses context
        /// to determine the 'enabled' state.
        /// </summary>
        /// <param name="arg">info about the scanner button</param>
        public bool CheckWidgetEnabled(CheckEnabledArgs arg)
        {
            switch (arg.Widget.SubClass)
            {
            case "ClearTalkWindowText":
                arg.Handled = true;
                arg.Enabled = TextBoxTalkWindow.Text.Length != 0;
                break;

            default:
                _alphabetScannerCommon.CheckWidgetEnabled(arg);
                break;
            }

            return(true);
        }
Example #11
0
        /// <summary>
        /// Invoked to check if a scanner button should be enabled.  Uses context
        /// to determine the 'enabled' state.
        /// </summary>
        /// <param name="arg">info about the scanner button</param>
        public override void CheckWidgetEnabled(CheckEnabledArgs arg)
        {
            switch (arg.Widget.SubClass)
            {
            case "ToolsMenu":
            case "ShowMainMenu":
            case "MouseScanner":
            case "CursorScanner":
            case "TabKey":
            case "AltKey":
            case "CtrlKey":
            case "ContextualMenu":
            case "FileBrowserToggle":
            case "PreviousPage":
            case "NextPage":
            case "FunctionKeyScanner":
            case "ShowWindowPosSizeMenu":
            case "ToggleTalkWindow":
                arg.Handled = true;
                arg.Enabled = false;
                break;

            case "Back":
            case "DeletePreviousWord":
            case "clearText":
                arg.Handled = true;
                arg.Enabled = _newFileNameForm != null && !String.IsNullOrEmpty(_newFileNameForm.FileNameEntered);
                return;

            case "EnterKey":
                arg.Handled = true;
                arg.Enabled = _newFileNameForm != null && _newFileNameForm.ValidNameSpecified();
                return;

            case "WordDoc":
                arg.Enabled = _isWordInstalled;
                arg.Handled = true;
                break;

            case "TextDoc":
                arg.Enabled = true;
                arg.Handled = true;
                break;
            }

            checkWidgetEnabled(_supportedFeatures, arg);
        }
Example #12
0
        /// <summary>
        /// Invoked to set the 'enabled' state of a widget.  This
        /// will depend on the current context.
        /// </summary>
        /// <param name="arg">contains info about the widget</param>
        public override void CheckWidgetEnabled(CheckEnabledArgs arg)
        {
            arg.Handled = true;
            switch (arg.Widget.SubClass)
            {
            case "FileBrowserToggle":
                arg.Enabled = true;
                return;

            case "ContextualMenu":
                arg.Enabled = false;
                return;

            default:
                arg.Handled = false;
                break;
            }
        }
        /// <summary>
        /// Invoked to set the 'enabled' state of a widget.  This
        /// will depend on the current context.
        /// </summary>
        /// <param name="arg">contains info about the widget</param>
        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;
            }
        }
        /// <summary>
        /// Invoked to set the 'enabled' state of a widget.  This
        /// will depend on the current context.
        /// </summary>
        /// <param name="arg">contains info about the widget</param>
        public override void CheckWidgetEnabled(CheckEnabledArgs arg)
        {
            switch (arg.Widget.SubClass)
            {
            case "SwitchTo":
                arg.Enabled = isTopLevelWindow(outlookWindowType);
                arg.Handled = true;
                break;

            case "ApptAppointment":
                arg.Enabled = (outlookWindowType != OutlookWindowTypes.OpenAppointment);
                arg.Handled = true;
                break;

            case "ApptScheduling":
                arg.Enabled = (outlookWindowType != OutlookWindowTypes.AppointmentScheduling);
                arg.Handled = true;
                break;
            }
        }
Example #15
0
        public bool CheckWidgetEnabled(CheckEnabledArgs arg)
        {
            arg.Handled = false;
            if (DialogMode)
            {
                switch (arg.Widget.SubClass)
                {
                case "ToggleTalkWindow":
                case "ShowMainMenu":
                case "MouseScanner":
                case "ContextualMenu":
                case "ToolsMenu":
                case "ShowWindowPosSizeMenu":
                    arg.Enabled = false;
                    arg.Handled = true;
                    break;
                }
            }

            return(true);
        }
Example #16
0
        /// <summary>
        /// Invoked to check if a scanner button should be enabled.  Uses context
        /// to determine the 'enabled' state.
        /// </summary>
        /// <param name="arg">info about the scanner button</param>
        public bool CheckWidgetEnabled(CheckEnabledArgs arg)
        {
            arg.Handled = true;

            switch (arg.Widget.SubClass)
            {
            case "PreviousPage":
                arg.Enabled = (_pageNumber != 0);
                break;

            case "NextPage":
                arg.Enabled = (_numPages != 0 && (_pageNumber + 1) != _numPages);
                break;

            case "Back":
            case "DeletePreviousWord":
            case "ClearFilter":
                arg.Handled = true;
                arg.Enabled = !IsFilterEmpty();
                break;

            case "Sort":
            case "Search":
                arg.Handled = true;
                arg.Enabled = (_fileList != null && _fileList.Any());
                break;

            case "PrevChar":
            case "NextChar":
                arg.Handled = true;
                arg.Enabled = true;
                break;

            default:
                arg.Handled = false;
                break;
            }

            return(false);
        }
Example #17
0
        /// <summary>
        /// Invoked to check if a scanner button should be enabled.  Uses context
        /// to determine the 'enabled' state.
        /// </summary>
        /// <param name="arg">info about the scanner button</param>
        public override void CheckWidgetEnabled(CheckEnabledArgs arg)
        {
            if (_fileBrowserScanner != null)
            {
                switch (arg.Widget.SubClass)
                {
                case "FileBrowserToggle":
                    arg.Enabled = true;
                    arg.Handled = true;
                    return;

                case "Back":
                case "DeletePreviousWord":
                case "clearText":
                    arg.Enabled = _fileBrowserScanner != null && !_fileBrowserScanner.IsFilterEmpty();
                    arg.Handled = true;
                    return;
                }

                checkWidgetEnabled(_supportedFeatures, arg);
            }
        }
Example #18
0
        /// <summary>
        /// Get all the widgets whose "enabled" property is set to
        /// contextual in the config file.  Decide the "enabled" state
        /// of these widgets depending on the context
        /// </summary>
        /// <param name="monitorInfo">Context info about active window</param>
        private void SetWidgetEnabledStates(WindowActivityMonitorInfo monitorInfo)
        {
            if (_syncLock.IsClosing())
            {
                Log.Debug("Form is closing " + ScannerForm.Name);
                WindowActivityMonitor.EvtWindowMonitorHeartbeat -= WindowActivityMonitor_EvtWindowMonitorHeartbeat;
                return;
            }

            if (_rootWidget != null && Context.AppAgentMgr != null && !_syncLock.IsClosing() && Windows.GetVisible(ScannerForm))
            {
                foreach (Widget widget in _rootWidget.WidgetLayout.ContextualWidgets)
                {
                    ////Log.Debug("Widget: " + widget.Name + ", subclass: " + widget.SubClass);

                    if (!String.IsNullOrEmpty(widget.SubClass))
                    {
                        var arg = new CheckEnabledArgs(monitorInfo, widget);
                        if (!_syncLock.IsClosing())
                        {
                            _scannerPanel.CheckWidgetEnabled(arg);

                            if (!arg.Handled)
                            {
                                Context.AppAgentMgr.CheckWidgetEnabled(arg);
                            }

                            widget.Enabled = arg.Handled ? arg.Enabled : widget.DefaultEnabled;
                        }
                        else
                        {
                            break;
                        }

                        ////Log.Debug("widget.Enabled set to : " + widget.Enabled + " for feature " + widget.SubClass);
                    }
                }
            }
        }
Example #19
0
        /// <summary>
        /// Invoked to check if a scanner button should be enabled.  Uses context
        /// to determine the 'enabled' state.
        /// </summary>
        /// <param name="arg">info about the scanner button</param>
        public override void CheckWidgetEnabled(CheckEnabledArgs arg)
        {
            switch (arg.Widget.SubClass)
            {
            case "Back":
            case "DeletePreviousWord":
                if (_form != null && Windows.GetVisible(_form))
                {
                    arg.Enabled = !_form.IsFilterEmpty();
                }
                else
                {
                    arg.Enabled = true;
                }

                arg.Handled = true;
                return;

            case "clearText":
                if (_form != null && Windows.GetVisible(_form))
                {
                    arg.Enabled = !_form.IsFilterEmpty();
                }
                else
                {
                    arg.Enabled = false;
                }

                arg.Handled = true;
                return;

            case "FileBrowserToggle":
                arg.Handled = true;
                arg.Enabled = false;
                return;
            }

            checkWidgetEnabled(_supportedFeatures, arg);
        }
Example #20
0
        /// <summary>
        /// Invoked to check if a scanner button should be enabled.  Uses context
        /// to determine the 'enabled' state.
        /// </summary>
        /// <param name="arg">info about the scanner button</param>
        public override void CheckWidgetEnabled(CheckEnabledArgs arg)
        {
            arg.Handled = true;

            switch (arg.Widget.SubClass)
            {
            case "PunctuationScanner":
            case "NumberScanner":
                arg.Enabled = true;
                break;

            default:
                if (_switchWindowsScanner != null)
                {
                    _switchWindowsScanner.CheckWidgetEnabled(arg);
                }
                if (!arg.Handled)
                {
                    arg.Enabled = false;
                    arg.Handled = true;
                }
                break;
            }
        }
Example #21
0
 /// <summary>
 /// Returns whether the widget associated with a feature
 /// should be enabled or not.
 /// </summary>
 /// <param name="arg">widget info</param>
 public override void CheckWidgetEnabled(CheckEnabledArgs arg)
 {
     // support only if this is a navigation feature
     if (_supportedFeatures.Contains(arg.Widget.SubClass))
     {
         arg.Handled = true;
         arg.Enabled = true;
     }
 }
Example #22
0
 /// <summary>
 /// Invoked to set the 'enabled' state of a widget.  This
 /// will depend on the current context.
 /// </summary>
 /// <param name="arg">contains info about the widget</param>
 public override void CheckWidgetEnabled(CheckEnabledArgs arg)
 {
     checkWidgetEnabled(_supportedFeatures, arg);
 }
Example #23
0
 /// <summary>
 /// Checks which of the widgets should be enabled depending
 /// on the context
 /// </summary>
 /// <param name="arg">widget info</param>
 /// <returns>true on success</returns>
 public bool CheckWidgetEnabled(CheckEnabledArgs arg)
 {
     return(_scannerHelper.CheckWidgetEnabled(arg));
 }
Example #24
0
 public override void CheckWidgetEnabled(CheckEnabledArgs arg)
 {
 }
Example #25
0
        /// <summary>
        /// Invoked to check if a scanner button should be enabled.  Uses context
        /// to determine the 'enabled' state.
        /// </summary>
        /// <param name="arg">info about the scanner button</param>
        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);
            }
        }
Example #26
0
 /// <summary>
 /// Invoked to check if a scanner button should be enabled.  Uses context
 /// to determine the 'enabled' state.
 /// </summary>
 /// <param name="arg">info about the scanner button</param>
 public override void CheckWidgetEnabled(CheckEnabledArgs arg)
 {
     _volumeSettingsScanner.CheckWidgetEnabled(arg);
 }
Example #27
0
 public bool CheckWidgetEnabled(CheckEnabledArgs arg)
 {
     return(true);
 }
Example #28
0
 /// <summary>
 /// Invoked to check if a scanner button should be enabled.  Uses context
 /// to determine the 'enabled' state.
 /// </summary>
 /// <param name="arg">info about the scanner button</param>
 public bool CheckWidgetEnabled(CheckEnabledArgs arg)
 {
     return(_alphabetScannerCommon.CheckWidgetEnabled(arg));
 }
Example #29
0
 /// <summary>
 /// Check to see if the widget should be enabled or not based
 /// on contextual information
 /// </summary>
 /// <param name="supportedFeatures"></param>
 /// <param name="arg"></param>
 protected void checkWidgetEnabled(String[] supportedFeatures, CheckEnabledArgs arg)
 {
     if (supportedFeatures.Contains(arg.Widget.SubClass))
     {
         arg.Handled = true;
         arg.Enabled = true;
     }
 }
Example #30
0
 /// <summary>
 /// Checks if the widget (scanner button) should to be enabled or not. Check
 /// our supported features list.
 /// </summary>
 /// <param name="arg">widget info</param>
 public virtual void CheckWidgetEnabled(CheckEnabledArgs arg)
 {
     if (_supportedFeatures.Contains(arg.Widget.SubClass))
     {
         arg.Handled = true;
         arg.Enabled = true;
     }
 }
Example #31
0
 public override void CheckWidgetEnabled(CheckEnabledArgs arg)
 {
 }
Example #32
0
 /// <summary>
 /// Called to check if the specified widget in arg should
 /// be enabled or not.  This function is called perfiodically
 /// because application context may change any time. Set
 /// the handled property in arg to true if this is handled.
 /// </summary>
 /// <param name="arg">argument</param>
 /// <returns>true on success</returns>
 public virtual bool CheckWidgetEnabled(CheckEnabledArgs arg)
 {
     return(false);
 }