/// <summary> /// This code gets called when the EditQuery button is clicked on the associated PopupResults form /// </summary> public void ExitingQueryResultsCallBack( ExitingQueryResultsParms p) { if (p.ExitType == ExitingQueryResultsType.EditQuery) { try // close the results popup { p.Qrc.ParentForm.Dispose(); } catch (Exception ex) { string msg = ex.Message; } this.Visible = true; return; } //else if (p.ExitType == ExitingQueryResultsType.ClosingWindow) // if results closed then close this as well // try // { // this.Dispose(); // return; // } // catch (Exception ex) { string msg = ex.Message; } else // just make us visible again { this.Visible = true; return; } }
static void CallCustomExitingQueryResultsCallback(object arg) { object[] args = arg as object[]; ExitingQueryResultsDelegate callback = args[0] as ExitingQueryResultsDelegate; ExitingQueryResultsParms p = args[1] as ExitingQueryResultsParms; callback(p); }
/// <summary> /// Look for a parent QueryResultsControl and see if the EditQueryButtonClicked method is defined and call it if so /// </summary> /// <param name="ctl"></param> /// <returns></returns> public static bool TryCallCustomExitingQueryResultsCallback( Control ctl, ExitingQueryResultsType exitType) { QueryResultsControl qrc; ExitingQueryResultsDelegate callback = GetCustomExitingQueryResultsCallback(ctl, out qrc, true); if (callback == null) { return(false); } ExitingQueryResultsParms p = new ExitingQueryResultsParms(); p.Qrc = qrc; p.ExitType = exitType; object[] arg = new object[] { callback, p }; DelayedCallback.Schedule(CallCustomExitingQueryResultsCallback, arg); // call after return from this event return(true); }