/// <summary> /// Run Query & return any error message /// </summary> /// <param name="query"></param> /// <param name="queryDest"></param> /// <param name="outputFormContext"></param> /// <param name="browseExistingResults">If true browse existing results</param> /// <param name="suppressNoDataMessage"></param> /// <returns>Command command or an error message</command></returns> public static string RunQuery( Query query, OutputDest outputDest, OutputFormContext outputFormContext, ExitingQueryResultsDelegate exitingQueryResultsCallBack = null, bool browseExistingResults = false, bool suppressNoDataMessage = false ) { ResultsFormat rf = new ResultsFormat(); rf.OutputDestination = outputDest; rf.OutputFormContext = outputFormContext; rf.CustomExitingQueryResultsCallback = exitingQueryResultsCallBack; rf.SuppressNoDataMessage = suppressNoDataMessage; string response = RunQuery2(query, rf, browseExistingResults); query.UseResultKeys = false; // turn off use of keys if (response != "" && !response.ToLower().StartsWith("command") && !suppressNoDataMessage) { MessageBoxMx.Show( response, UmlautMobius.String, MessageBoxButtons.OK, MessageBoxIcon.Information); response = "Command EditQuery"; } return(response); }
/// <summary> /// Check if CustomExitingQueryResultsCallback is defined /// </summary> /// <param name="ctl"></param> /// <returns></returns> public static bool IsCustomExitingQueryResultsCallbackDefined( Control ctl) { QueryResultsControl qrc; ExitingQueryResultsDelegate callback = GetCustomExitingQueryResultsCallback(ctl, out qrc); return(callback != null); }
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> /// Get any CustomExitingQueryResultsCallback associated with the supplied control /// </summary> /// <param name="qrcContainingCtl"></param> /// <returns></returns> public static ExitingQueryResultsDelegate GetCustomExitingQueryResultsCallback( Control qrcContainingCtl, out QueryResultsControl qrc, bool clearValueAfterGetting = false) { QueryManager qm; if (!TryGetQrcAndQm(qrcContainingCtl, out qrc, out qm)) { return(null); } ExitingQueryResultsDelegate callback = qm?.ResultsFormat?.CustomExitingQueryResultsCallback; // get any callback ref if (clearValueAfterGetting && callback != null) // clear call back so not called agin { qm.ResultsFormat.CustomExitingQueryResultsCallback = null; } return(callback); }
/// <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); }