/// <summary> /// Raises the <see cref="UriChecking" /> event. /// </summary> /// <param name="e">The <see cref="UriEventArgs" /> instance containing the event data.</param> protected virtual void OnUriChecking(UriEventArgs e) { EventHandler <UriEventArgs> handler; handler = (EventHandler <UriEventArgs>) this.Events[_eventUriChecking]; handler?.Invoke(this, e); }
public async Task CheckUri(UriInfo uriInfo) { Uri uri; UriEventArgs args; UriStatus newStatus; Exception error; HttpStatusCode httpStatus; uri = uriInfo.Uri; if (!_settings.Statuses.TryGetValue(uri, out UriStatusInfo status)) { status = new UriStatusInfo { LastChange = DateTimeOffset.UtcNow, Status = UriStatus.Unknown, Uri = uri }; _settings.Statuses.Add(status); } args = new UriEventArgs(uri); this.OnUriChecking(args); (newStatus, httpStatus, error) = await this.GetUriStatus(uriInfo).ConfigureAwait(false); if (error != null) { this.OnUriException(new UriExceptionEventArgs(uri, error)); } this.UpdateStatus(status, httpStatus, newStatus); this.OnUriChecked(args); }