/// <summary> /// Key press event handler /// </summary> /// <param name="sender">event sender</param> /// <param name="e">event args</param> private void _keyboardActuator_EvtKeyPress(object sender, KeyPressEventArgs e) { if (EvtDone != null) { int c = e.KeyChar; if (c == 27) { EvtDone.BeginInvoke(null, null); } } }
/// <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> /// Confirm and close the scanner /// </summary> private void close() { if (EvtDone != null) { EvtDone.BeginInvoke(false, null, null); } else { if (DialogUtils.ConfirmScanner(PanelManager.Instance.GetCurrentForm(), R.GetString("CloseQ"))) { Windows.CloseForm(this); } } }
/// <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> /// Key press event handler /// </summary> /// <param name="sender">event sender</param> /// <param name="e">event args</param> private void textBoxFileName_KeyPress(object sender, KeyPressEventArgs e) { if (EvtDone == null) { return; } int c = e.KeyChar; if (c == 13) { if (ValidNameSpecified()) { EvtDone.BeginInvoke(true, null, null); } } else if (c == 27) { EvtDone.BeginInvoke(false, null, null); } }