/// <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; } }
/// <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; } }
/// <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; } }
/// <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); } } }
/// <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); }
/// <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); } }
/// <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); }
/// <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); } } } }
/// <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); } }
/// <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); }
public override void CheckWidgetEnabled(CheckEnabledArgs arg) { base.CheckWidgetEnabled(arg); }
/// <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; } }
/// <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; } }
/// <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; } }
/// <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); }
/// <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; } }
/// <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); }
/// <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); }
/// <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; } }
/// <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); } }
/// <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; }
/// <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); } }
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; }
/// <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); }
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> /// Nothing to do here /// </summary> /// <param name="arg"></param> /// <returns></returns> public bool CheckWidgetEnabled(CheckEnabledArgs arg) { return false; }
/// <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; } } }
/// <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; }
/// <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; }