/// <summary> /// Helper to update validator match state as needed for the given string /// and event handler return codes. /// /// This effectively asks permission from event handlers to proceed with the /// change, updates d_validatorMatchState and returns an appropriate bool. /// </summary> /// <param name="str"></param> /// <returns></returns> protected bool HandleValidityChangeForString(string str) { var newState = GetStringMatchState(str); if (newState == _validatorMatchState) { return(_previousValidityChangeResponse); } var args = new RegexMatchStateEventArgs(this, newState); OnTextValidityChanged(args); var response = (args.handled != 0); if (response) { _validatorMatchState = newState; _previousValidityChangeResponse = true; } return(response); }
/// <summary> /// Handler called when something has caused the validity state of the /// current text to change. /// </summary> /// <param name="e"></param> protected virtual void OnTextValidityChanged(RegexMatchStateEventArgs e) { FireEvent(EventTextValidityChanged, e, EventNamespace); }