コード例 #1
0
        private bool TryValidateAll()
        {
            var validated = true;

            var handler = ValidatingAll;

            if (handler != null)
            {
                var args = new ValidatingAllEventArgs(false);

                foreach (ValidatingAllEventHandler subHandler in handler?.GetInvocationList())
                {
                    subHandler(args);

                    if (args.Cancel)
                    {
                        validated = false;
                    }
                }
            }

            return(validated);
        }
コード例 #2
0
 private void OnValidatingAll(ValidatingAllEventArgs e)
 {
     e.Cancel = Validate() == ValidationStatus.Error;
 }