public void SwizzleResultsDialog() { callbacks.Clear(); ExperimentsResultDialog dlg = ExperimentsResultDialog.Instance; //Swizzle the callbacks foreach (ExperimentResultDialogPage page in dlg.pages) { //Save the originals. DialogCallbacks dialogCallbacks = new DialogCallbacks(); dialogCallbacks.originalTransmitCallback = page.OnTransmitData; dialogCallbacks.originalDiscardCallback = page.OnDiscardData; dialogCallbacks.originalProcessCallback = page.OnSendToLab; dialogCallbacks.originalKeepCallback = page.OnKeepData; callbacks.Add(page, dialogCallbacks); //Now add our own callbacks page.OnTransmitData = swizzleTransmit; page.OnDiscardData = swizzleDiscard; page.OnSendToLab = swizzleProcess; page.OnKeepData = swizzleKeep; } }