/// <summary> /// The interpreter invoked a "close" command. Close /// the scanner /// </summary> /// <param name="sender">event sender</param> /// <param name="e">event args</param> private void Interpreter_EvtCloseNotify(object sender, InterpreterEventArgs e) { ScannerForm.Invoke(new MethodInvoker(delegate { Log.Debug("Calling close for " + ScannerForm.Name); ScannerForm.Close(); })); }
/// <summary> /// The stop command was interpreted. /// </summary> /// <param name="sender">event sender</param> /// <param name="e">event arg</param> private void AppInterpreter_EvtStop(object sender, InterpreterEventArgs e) { Interrupt(); }
/// <summary> /// Event handler to transition to the specified animation. /// The interpreter triggers this event on the "transition" verb /// </summary> /// <param name="sender">event sender</param> /// <param name="e">Argument list</param> private void AppInterpreter_EvtTransitionNotify(object sender, InterpreterEventArgs e) { Log.Debug(); List<String> resolvedArgs = ResolveArgs(e.Args); if (resolvedArgs.Count > 0) { String targetAnimation = resolvedArgs[0]; Log.Debug(targetAnimation); Transition(targetAnimation); } }
/// <summary> /// Event handler to select the specified widget. /// The interpreter triggers this event on the "select" verb /// </summary> /// <param name="sender">event sender</param> /// <param name="e">Argument list</param> private void AppInterpreter_EvtSelectNotify(object sender, InterpreterEventArgs e) { List<String> resolvedArgs = ResolveArgs(e.Args); if (resolvedArgs.Count > 0) { var widgetName = e.Args[0]; SetSelectedWidget(widgetName); } }
/// <summary> /// Event handler to highlight/unhighlight the specified widget. /// This event is triggered by the Interpreter on the "highlightSelected" verb /// </summary> /// <param name="sender">event sender</param> /// <param name="e">Argument list</param> private void AppInterpreter_EvtHighlightSelectedNotify(object sender, InterpreterEventArgs e) { if (e.Args.Count == 0) { return; } bool onOff = false; List<String> resolvedArgs = ResolveArgs(e.Args); if (e.Args.Count > 1) { // translate argument from "true" "false" to a boolean onOff = ResolveBool(e.Args[1]); } String widgetName = resolvedArgs[0]; Log.Debug("_currentPanel " + _currentPanel.Name + " widgetname: " + widgetName); var widget = _currentPanel.Finder.FindChild(widgetName); if (widget != null) { if (onOff) { widget.SelectedHighlightOn(); } else { widget.SelectedHighlightOff(); } } }
/// <summary> /// Event handler to highlight/unhighlight the specified widget. /// This event is triggered by the Interpreter on the "highlight" verb /// </summary> /// <param name="sender">event sender</param> /// <param name="e">Argument list</param> private void AppInterpreter_EvtHighlightNotify(object sender, InterpreterEventArgs e) { if (e.Args.Count == 0) { return; } bool onOff = false; List<String> resolvedArgs = ResolveArgs(e.Args); if (e.Args.Count > 1) { // translate argument from "true" "false" to a boolean onOff = ResolveBool(e.Args[1]); } var widgetName = resolvedArgs[0]; var widget = _currentPanel.Finder.FindChild(widgetName); if (widget != null) { // turn off everything except the one we want Widget parent = widget.Parent; foreach (Widget child in parent.Children) { child.HighlightOff(); } if (onOff) { widget.HighlightOn(); } } }
/// <summary> /// Event triggered to play a beep sound /// </summary> /// <param name="sender">event sender</param> /// <param name="e">Argument list</param> private void AppInterpreter_EvtBeep(object sender, InterpreterEventArgs e) { playDefaultBeep(); }
/// <summary> /// Event handler to actuate this widget. /// The interpreter triggers this event on the "actuate" verb /// </summary> /// <param name="sender">event sender</param> /// <param name="e">Argument list</param> private void AppInterpreter_EvtActuateNotify(object sender, InterpreterEventArgs e) { List<String> resolvedArgs = ResolveArgs(e.Args); if (resolvedArgs.Count > 0) { String widgetName = resolvedArgs[0]; // get the widget object var widget = _currentPanel.Finder.FindChild(widgetName); if (widget != null) { Log.Debug("Actuate. widgetname: " + widget.Name + " Text: " + widget.GetText()); widget.Actuate(); } else { Log.Debug("Did not actuate. Could not find widget " + widgetName); } } }