/// <summary> /// Handles actuation of a widget /// </summary> /// <param name="widget">widget actuated</param> /// <param name="handled">true if handled</param> private void handleWidgetSelection(Widget widget, ref bool handled) { // the user actuated an abbreviation in the list if (widget.UserData is Abbreviation) { handleEditAbbreviation((Abbreviation)widget.UserData); handled = true; } else { handled = true; switch (widget.Value) { case "@Quit": if (EvtDone != null) { EvtDone.BeginInvoke(false, null, null); } break; case "@AbbrListSort": switchSortOrder(); break; case "@AbbrListNextPage": gotoNextPage(); break; case "@AbbrListPrevPage": gotoPreviousPage(); break; case "@AbbrListClearFilter": ClearFilter(); break; case "@AbbrListSearch": if (EvtShowScanner != null) { EvtShowScanner.BeginInvoke(null, null, null, null); } break; case "@AbbrListAdd": handleAddNewAbbreviation(); break; default: handled = false; break; } } }
/// <summary> /// Handles actuation of a widget /// </summary> /// <param name="widget">widget actuated</param> /// <param name="handled">true if handled</param> private void handleWidgetSelection(Widget widget, ref bool handled) { // the user actuated an phrase in the list if (widget.UserData is Phrase) { Phrase phrase = (Phrase)widget.UserData; TTSManager.Instance.ActiveEngine.Stop(); int bookmark; TTSManager.Instance.ActiveEngine.SpeakAsync(phrase.Text, out bookmark); handled = true; } else { handled = true; switch (widget.Value) { case "@CmdGoBack": close(); break; case "@PhraseListSort": switchSortOrder(); break; case "@CmdNextPage": gotoNextPage(); break; case "@CmdPrevPage": gotoPreviousPage(); break; case "@PhraseListClearFilter": ClearFilter(); break; case "@PhraseListSearch": if (EvtShowScanner != null) { EvtShowScanner.BeginInvoke(null, null, null, null); } break; default: handled = false; break; } } }
/// <summary> /// Handle actuation of a widget - navigate, select file /// etc depending on what the widget represents /// </summary> /// <param name="widget">widget to actuate</param> /// <param name="handled">true if handled</param> private void handleWidgetSelection(Widget widget, ref bool handled) { if (widget.UserData is FileInfo) { onFileSelected((FileInfo)widget.UserData); handled = true; } else { handled = true; switch (widget.Value) { case "@Quit": if (EvtDone != null) { EvtDone.BeginInvoke(false, null, null); } break; case "@FileListSort": switchSortOrder(); break; case "@FileListNextPage": gotoNextPage(); break; case "@FileListPrevPage": gotoPreviousPage(); break; case "@FileListClearFilter": ClearFilter(); break; case "@FileListSearch": if (EvtShowScanner != null) { EvtShowScanner.BeginInvoke(null, null, null, null); } break; default: handled = false; break; } } }
/// <summary> /// Perform the operation - page through the list, /// activate a window etc /// </summary> /// <param name="itemTag">Meta data about seleted item</param> private void handleWidgetSelection(Widget widget, ref bool handled) { if (widget.UserData is EnumWindows.WindowInfo) { handleWindowSelect((EnumWindows.WindowInfo)widget.UserData); handled = true; } else { switch (widget.Value) { case "@Quit": if (EvtDone != null) { EvtDone.BeginInvoke(null, null); } break; case "@WindowListSort": switchSortOrder(); break; case "@CmdNextPage": gotoNextPage(); break; case "@CmdPrevPage": gotoPreviousPage(); break; case "@WindowListSearch": if (EvtShowScanner != null) { EvtShowScanner.BeginInvoke(null, null, null, null); } break; case "@WindowListClearFilter": ClearFilter(); break; default: handled = false; break; } } }
/// <summary> /// Handle the selection - navigate, launch app etc /// </summary> /// <param name="widget">Widget selected</param> /// <param name="handled">was this handled</param> private void handleWidgetSelection(Widget widget, ref bool handled) { if (widget.UserData is AppInfo) { handleAppSelect((AppInfo)widget.UserData); handled = true; } else { handled = true; switch (widget.Value) { case "@CmdGoBack": close(); break; case "@AppListSort": switchSortOrder(); break; case "@CmdNextPage": gotoNextPage(); break; case "@CmdPrevPage": gotoPreviousPage(); break; case "@AppListSearch": if (EvtShowScanner != null) { EvtShowScanner.BeginInvoke(null, null, null, null); } break; case "@AppListClearFilter": ClearFilter(); break; default: handled = false; break; } } }