Esempio n. 1
0
        public override bool IsValid()
        {
            bool isValid = base.IsValid();

            OnValidation?.Invoke(isValid);

            return(isValid);
        }
Esempio n. 2
0
 public TValidator RegisterValidator<TViewModel, TValidator>()
     where TValidator : AbstractValidator<TViewModel>
     where TViewModel : ViewModel
 {
     TValidator validator = Activator.CreateInstance<TValidator>();
     PropertyChanged += (o, ev) =>
     {
         var result = validator.Validate((TViewModel)this);
         ValidationResult = result;
         OnValidation?.Invoke(result);
     };
     return validator;
 }
Esempio n. 3
0
        public void UpdateExpiresTime(string?time)
        {
            if (string.IsNullOrEmpty(time))
            {
                _expiresTime = null;
            }
            else
            {
                _expiresTime = DateTime.Parse(time).TimeOfDay;
            }

            ValidateExpiresDateTime();
            OnValidation.Invoke();
        }
Esempio n. 4
0
        public void UpdateExpiresDate(string?date)
        {
            if (string.IsNullOrEmpty(date))
            {
                _expiresDate = null;
            }
            else
            {
                _expiresDate = DateTime.Parse(date);
            }

            ValidateExpiresDateTime();
            OnValidation.Invoke();
        }
Esempio n. 5
0
 /// <summary>
 /// Raises the OnValidation event.
 /// </summary>
 /// <param name="sender">Object which raises the event.</param>
 /// <param name="eventArgs">Arguments for the event.</param>
 protected virtual void RaiseOnValidationEvent(object sender, IDataValidatorEventArgs eventArgs)
 {
     if (sender == null)
     {
         throw new ArgumentNullException("sender");
     }
     if (eventArgs == null)
     {
         throw new ArgumentNullException("eventArgs");
     }
     if (OnValidation != null)
     {
         OnValidation.Invoke(sender, eventArgs);
     }
 }
Esempio n. 6
0
        public void SetExpirationAfterTimespan(TimeSpan timeSpan)
        {
            if (timeSpan != TimeSpan.Zero)
            {
                _expiresDate = DateTime.Now.Add(timeSpan).Date;
                _expiresTime = DateTime.Now.Add(timeSpan).TimeOfDay;
            }
            else
            {
                _expiresDate = null;
                _expiresTime = null;
            }

            ValidateExpiresDateTime();
            OnValidation.Invoke();
        }
Esempio n. 7
0
        public void UpdateHostnameList(List <string> hostnames)
        {
            if (hostnames.Count == 0)
            {
                _newWhitelist.Hostnames = null;
                return;
            }

            _newWhitelist.Hostnames = new List <string>();
            foreach (string hostname in hostnames)
            {
                // if (hostname != "" && ValidateHostname(hostname).Item1 != Validation.ValidationResult.Invalid)
                _newWhitelist.Hostnames.Add(hostname);
            }

            OnValidation.Invoke();
        }
Esempio n. 8
0
        public void UpdateIPList(List <string> ips)
        {
            if (ips.Count == 0)
            {
                _newWhitelist.IPs = null;
                return;
            }

            _newWhitelist.IPs = new List <IPAddress>();
            foreach (string ip in ips)
            {
                // if (ip != "" && ValidateIP(ip).Item1 == Validation.ValidationResult.Valid)
                _newWhitelist.IPs.Add(IPAddress.Parse(ip));
            }

            OnValidation.Invoke();
        }
Esempio n. 9
0
        public void UpdateVendorList(List <string> vendors)
        {
            if (vendors.Count == 0)
            {
                _newWhitelist.Vendors = null;
                return;
            }

            _newWhitelist.Vendors = new List <string>();
            foreach (string vendor in vendors)
            {
                if (vendor != "")
                {
                    _newWhitelist.Vendors.Add(vendor);
                }
            }

            OnValidation.Invoke();
        }
Esempio n. 10
0
        public void UpdateSubnetList(List <string> subnets)
        {
            if (subnets.Count == 0)
            {
                _newWhitelist.Subnets = null;
                return;
            }

            _newWhitelist.Subnets = new List <IPNetwork>();
            foreach (string subnet in subnets)
            {
                if (subnet != "")
                {
                    _newWhitelist.Subnets.Add(IPNetwork.Parse(subnet));
                }
            }

            OnValidation.Invoke();
        }
Esempio n. 11
0
 public void OnPostValidate()
 {
     OnValidation?.Invoke();
 }
Esempio n. 12
0
 public void Validate()
 {
     CacheResults();
     _refreshTrigger.Trigger();
     OnValidation?.Invoke();
 }
Esempio n. 13
0
 private void ValueTB_TextChanged(object sender, EventArgs e)
 {
     AfterTextChangedMethod?.Invoke();
     AfterTextChangedMethod = null;
 }