public override bool IsValid() { bool isValid = base.IsValid(); OnValidation?.Invoke(isValid); return(isValid); }
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; }
public void UpdateExpiresTime(string?time) { if (string.IsNullOrEmpty(time)) { _expiresTime = null; } else { _expiresTime = DateTime.Parse(time).TimeOfDay; } ValidateExpiresDateTime(); OnValidation.Invoke(); }
public void UpdateExpiresDate(string?date) { if (string.IsNullOrEmpty(date)) { _expiresDate = null; } else { _expiresDate = DateTime.Parse(date); } ValidateExpiresDateTime(); OnValidation.Invoke(); }
/// <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); } }
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(); }
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(); }
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(); }
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(); }
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(); }
public void OnPostValidate() { OnValidation?.Invoke(); }
public void Validate() { CacheResults(); _refreshTrigger.Trigger(); OnValidation?.Invoke(); }
private void NameTB_TextChanged(object sender, EventArgs e) { AfterTextChangedMethod?.Invoke(); AfterTextChangedMethod = null; }