コード例 #1
0
ファイル: AgentBase.cs プロジェクト: angellcq/src
 /// <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>
 protected void checkWidgetEnabled(String[] supportedFeatures, CheckEnabledArgs arg)
 {
     if (supportedFeatures.Contains(arg.Widget.SubClass))
     {
         arg.Handled = true;
         arg.Enabled = true;
     }
 }
コード例 #2
0
ファイル: AgentBase.cs プロジェクト: angellcq/src
 /// <summary>
 /// Invoked to check if a widget should be enabled or not.  This depends
 /// on the context and the agent can decide whether the widget should
 /// be enabled or not.  The widget's subclass field contains the context
 /// and should be used as the clue to set the widget state.  For instance
 /// if the talk window is already empty, disable the "Clear" button
 /// </summary>
 /// <param name="monitorInfo">The control that's in focus</param>
 /// <param name="widget">The widget whose state needs to be enabled or disabled</param>
 /// <returns>true to enable, false to disable</returns>
 public virtual void CheckWidgetEnabled(CheckEnabledArgs arg)
 {
     if (_supportedFeatures.Contains(arg.Widget.SubClass))
     {
         arg.Handled = true;
         arg.Enabled = true;
     }
 }
コード例 #3
0
        /// <summary>
        /// Checks if the widget should be enabled depending 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 "ContextualMenu":
                arg.Enabled = false;
                arg.Handled = true;
                break;

            default:
                arg.Handled = false;
                break;
            }
        }
コード例 #4
0
        /// <summary>
        /// Checks if a widget should be enabled or disabled. This
        /// depends on the context.  This function is invoked for
        /// each widget on the scanner, periodically.
        /// The call is forwarded to the active agent which actually handles
        /// it as it is the one that is intimately aware of the context
        /// </summary>
        /// <param name="arg">widget info</param>
        public void CheckWidgetEnabled(CheckEnabledArgs arg)
        {
            if (_currentAgent != null)
            {
                if (_currentAgent is IFunctionalAgent &&
                    ((FunctionalAgentBase)_currentAgent).IsClosing)
                {
                    Log.Debug("Functional agent is closing. returning");
                    return;
                }

                _currentAgent.CheckWidgetEnabled(arg);
                if (!arg.Handled && _currentAgent.TextControlAgent != null)
                {
                    _currentAgent.TextControlAgent.CheckWidgetEnabled(arg);
                }
            }
        }
コード例 #5
0
ファイル: NewFileAgent.cs プロジェクト: glwu/acat
        /// <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);
        }
コード例 #6
0
ファイル: LectureManagerAgent.cs プロジェクト: nbsrujan/acat
        /// <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())
                {
                    if (_lectureMgrForm.FileLoaded)
                    {
                        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;
                        }
                    }
                }
            }

            if (arg.Widget.SubClass.Equals("SpeakMenu", StringComparison.InvariantCultureIgnoreCase))
            {
                if (isMainFormActive())
                {
                    arg.Enabled = _lectureMgrForm.FileLoaded;
                    arg.Handled = true;
                }
            }
            else
            {
                checkWidgetEnabled(_supportedFeatures, arg);
            }
        }
コード例 #7
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);
 }
コード例 #8
0
ファイル: AgentManager.cs プロジェクト: glwu/acat
        /// <summary>
        /// Checks if a widget should be enabled or disabled. This
        /// depends on the context.  This function is invoked for
        /// each widget on the scanner, periodically.
        /// The call is forwarded to the active agent which actually handles
        /// it as it is the one that is intimately aware of the context
        /// </summary>
        /// <param name="arg">widget info</param>
        public void CheckWidgetEnabled(CheckEnabledArgs arg)
        {
            if (_currentAgent != null)
            {
                if (_currentAgent is IFunctionalAgent &&
                        ((FunctionalAgentBase)_currentAgent).IsClosing)
                {
                    Log.Debug("Functional agent is closing. returning");
                    return;
                }

                _currentAgent.CheckWidgetEnabled(arg);
                if (!arg.Handled && _currentAgent.TextControlAgent != null)
                {
                    _currentAgent.TextControlAgent.CheckWidgetEnabled(arg);
                }
            }
        }
コード例 #9
0
ファイル: ScannerCommon.cs プロジェクト: nbsrujan/acat
        /// <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);
                    }
                }
            }
        }
コード例 #10
0
ファイル: EudoraAgentBase.cs プロジェクト: nbsrujan/acat
 /// <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);
     }
 }
コード例 #11
0
ファイル: AbbreviationsAgent.cs プロジェクト: nbsrujan/acat
        /// <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);
        }
コード例 #12
0
ファイル: UnsupportedAppAgent.cs プロジェクト: nbsrujan/acat
 public override void CheckWidgetEnabled(CheckEnabledArgs arg)
 {
     base.CheckWidgetEnabled(arg);
 }
コード例 #13
0
ファイル: AbbreviationsAgent.cs プロジェクト: glwu/acat
        /// <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 (_abbrForm != null && !Windows.GetVisible(_abbrForm))
                    {
                        arg.Handled = false;
                        return;
                    }

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

                    if (!arg.Handled)
                    {
                        arg.Enabled = false;
                        arg.Handled = true;
                    }
                    break;
            }
        }
コード例 #14
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 (_fileBrowserScanner != null)
                    {
                        _fileBrowserScanner.CheckWidgetEnabled(arg);
                    }
                    if (!arg.Handled)
                    {
                        arg.Enabled = false;
                        arg.Handled = true;
                    }
                    break;
            }
        }
コード例 #15
0
ファイル: TalkAppAgent.cs プロジェクト: glwu/acat
        /// <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;
            }
        }
コード例 #16
0
ファイル: VolumeSettingsAgent.cs プロジェクト: glwu/acat
 /// <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);
 }
コード例 #17
0
ファイル: OutlookAgentBase.cs プロジェクト: glwu/acat
        /// <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;
            }
        }
コード例 #18
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);
 }
コード例 #19
0
ファイル: YesNoScanner.cs プロジェクト: nbsrujan/acat
 /// <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)
 {
     return _scannerHelper.CheckWidgetEnabled(arg);
 }
コード例 #20
0
ファイル: ACATAgentBase.cs プロジェクト: nbsrujan/acat
        /// <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 = !Context.AppTalkWindowManager.IsTalkWindowEmpty();
                    break;

                case "ContextualMenu":
                case "FileBrowserToggle":
                    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;
            }
        }
コード例 #21
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 (arg.Widget.SubClass == "WindowsStartMenu" &&
         (_osVersion == Windows.WindowsVersion.Win8 || _osVersion == Windows.WindowsVersion.Win10))
     {
         arg.Enabled = false;
         arg.Handled = true;
     }
     else
     {
         checkWidgetEnabled(_supportedFeatures, arg);
     }
 }
コード例 #22
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;
        }
コード例 #23
0
ファイル: UnsupportedAppAgent.cs プロジェクト: glwu/acat
        /// <summary>
        /// Checks if the widget should be enabled depending 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 "ContextualMenu":
                    arg.Enabled = false;
                    arg.Handled = true;
                    break;

                default:
                    arg.Handled = false;
                    break;
            }
        }
コード例 #24
0
ファイル: LaunchAppAgent.cs プロジェクト: nbsrujan/acat
        /// <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 (_launchAppScanner != null)
            {
                switch (arg.Widget.SubClass)
                {
                    case "FileBrowserToggle":
                        arg.Handled = true;
                        arg.Enabled = false;
                        return;

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

                checkWidgetEnabled(_supportedFeatures, arg);
            }
        }
コード例 #25
0
ファイル: ScannerHelper.cs プロジェクト: glwu/acat
        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;
        }
コード例 #26
0
ファイル: AlphabetScannerAbc.cs プロジェクト: glwu/acat
        /// <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);
        }
コード例 #27
0
ファイル: WindowsExplorerAgent.cs プロジェクト: nbsrujan/acat
        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;
            }
        }
コード例 #28
0
ファイル: AgentBase.cs プロジェクト: nbsrujan/acat
 /// <summary>
 /// Invoked to check if a widget should be enabled or not.  This depends
 /// on the context and the agent can decide whether the widget should
 /// be enabled or not.  The widget's subclass field contains the context
 /// and should be used as the clue to set the widget state.  For instance
 /// if the talk window is already empty, disable the "Clear" button
 /// </summary>
 /// <param name="monitorInfo">The control that's in focus</param>
 /// <param name="widget">The widget whose state needs to be enabled or disabled</param>
 /// <returns>true to enable, false to disable</returns>
 public virtual void CheckWidgetEnabled(CheckEnabledArgs arg)
 {
     if (_supportedFeatures.Contains(arg.Widget.SubClass))
     {
         arg.Handled = true;
         arg.Enabled = true;
     }
 }
コード例 #29
0
ファイル: AgentBase.cs プロジェクト: nbsrujan/acat
 /// <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>
 protected void checkWidgetEnabled(String[] supportedFeatures, CheckEnabledArgs arg)
 {
     if (supportedFeatures.Contains(arg.Widget.SubClass))
     {
         arg.Handled = true;
         arg.Enabled = true;
     }
 }
コード例 #30
0
ファイル: AbbreviationsScanner.cs プロジェクト: nbsrujan/acat
 /// <summary>
 /// Nothing to do here
 /// </summary>
 /// <param name="arg"></param>
 /// <returns></returns>
 public bool CheckWidgetEnabled(CheckEnabledArgs arg)
 {
     return false;
 }
コード例 #31
0
ファイル: MSWordTextControlAgent.cs プロジェクト: glwu/acat
 /// <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, "ClearTalkWindowText", true) == 0)
     {
         arg.Handled = true;
         arg.Enabled = false;
     }
     else
     {
         if (_supportedFeatures.Contains(arg.Widget.SubClass))
         {
             arg.Enabled = true;
             arg.Handled = true;
         }
     }
 }
コード例 #32
0
ファイル: LaunchAppScanner.cs プロジェクト: glwu/acat
        /// <summary>
        /// Sets the states of the buttons in the button bar
        /// and in the companion scanner (if any) depending
        /// on the current state.
        /// </summary>
        /// <param name="arg">widget information</param>
        /// <returns>true on success</returns>
        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 = (_appsList != null && _appsList.Any());
                    break;

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

                default:
                    arg.Handled = false;
                    break;
            }

            return false;
        }
コード例 #33
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;
        }