protected void ValidateProcParametersMatchFail(string errorMessage, StatusImage imgToUpdate, Action<bool> setValidStatus) { this.Dispatcher.Invoke((Action)(() => { imgToUpdate.Source = BadBMP; imgToUpdate.ErrorMessage = errorMessage; imgToUpdate.MouseUp += new System.Windows.Input.MouseButtonEventHandler(displayErrorMessage); })); setValidStatus(false); }
protected void ValidateProcParametersMatchCurrentContext(string procName, StatusImage imgToUpdate, Action<bool> setValidStatus) { try { var newProcParams = SQL.Queries.GetStoredProcParameters(CurrentContext.Server, CurrentContext.Database, procName); if (!CurrentContext.ParameterValues.ParametersMatch(newProcParams)) throw new SpecificException(SpecificException.ProcParametersDontMatch); setValidStatus(true); this.Dispatcher.Invoke((Action)(() => { imgToUpdate.Source = GoodBMP; imgToUpdate.MouseUp -= new System.Windows.Input.MouseButtonEventHandler(displayErrorMessage); })); } catch (SpecificException ex) { if (ex.Message.OneOf(SpecificException.ProcParametersDontMatch, SpecificException.ProcedureNotFound)) ValidateProcParametersMatchFail(ex.Message, imgToUpdate, setValidStatus); else throw; } }