Esempio n. 1
0
        /// <summary>
        ///     Alerts when any unnotified changes are detected any <see cref="CanAlert" /> is true.
        /// </summary>
        /// <param name="object">Object that this instance has been notified by <see cref="NotifyChanges" /></param>
        /// <exception cref="ArgumentNullException"><paramref name="object" /> is <see langword="NULL" /></exception>
        /// <seealso cref="IAlerts" />
        public void AlertUnnotifiedChanges(object @object)
        {
            if (@object == null)
            {
                throw new ArgumentNullException(nameof(@object));
            }
            //get validation results
            var isStateValid = ScanState ? IsStateValid(@object) : true;
            var isCodeValid  = ScanCode ? IsCodeValid(@object) : true;

            //alert
            if (isStateValid && isCodeValid)
            {
                return;
            }
            if (!CanAlert)
            {
                return;
            }
            var message = new InjectionMessage(!isStateValid, !isCodeValid, @object);

            _alerter.Alert(message, AlertChannel);
        }
Esempio n. 2
0
        /// <inheritdoc />
        /// <inheritdoc cref= "DisposableBase.ThrowIfDisposed" />
        /// <exception cref="ArgumentNullException"><paramref name="object" /> is <see langword="NULL" /></exception>
        /// <seealso cref="IAlerts" />
        public void AlertUnnotifiedChanges(object @object)
        {
            if (@object == null)
            {
                throw new ArgumentNullException(nameof(@object));
            }
            this.ThrowIfDisposed();
            // Get validation results
            var isStateValid = !ScanState || IsStateValid(@object);
            var isCodeValid  = !ScanCode || IsCodeValid(@object);

            // Alert
            if (isStateValid && isCodeValid)
            {
                return;
            }
            if (!CanAlert)
            {
                return;
            }
            var message = new InjectionMessage(!isStateValid, !isCodeValid, @object);

            _alerter.Alert(message, AlertChannel);
        }