private Image GetStatusImage(UriStatus status) { Image result; switch (status) { case UriStatus.Online: result = Resources.StatusOnline; break; case UriStatus.Unstable: result = Resources.StatusUnstable; break; case UriStatus.InvalidCertificate: result = Resources.StatusSslError; break; case UriStatus.Offline: result = Resources.StatusOffline; break; default: result = Resources.StatusUnknown; break; } return(result); }
public void Remove(UriStatus status) { for (int i = Items.Count - 1; i >= 0; i--) { if (Items[i].Status == status) { Items.RemoveAt(i); } } UrlChanged?.Invoke(null, true); }
public void Add(string url, UriType uriType, UriStatus status) { if (Contains(url)) { return; } var item = new UriItem() { Source = url, Type = uriType, Status = status }; Items.Add(item); UrlChanged?.Invoke(item, true); }
private void UpdateStatus(UriStatusInfo status, HttpStatusCode httpStatus, UriStatus newStatus) { UriStatus previousStatus; previousStatus = status.Status; if (newStatus == UriStatus.Unstable) { if (previousStatus == UriStatus.Offline || (previousStatus == UriStatus.Unstable && status.LastChange + _settings.UnstableInterval < DateTimeOffset.UtcNow)) { newStatus = UriStatus.Offline; } } if (newStatus != previousStatus) { status.LastChange = DateTimeOffset.UtcNow; status.Status = newStatus; status.HttpStatus = httpStatus; this.OnUriStatusChanged(new UriStatusInfoEventArgs(status)); } }
public void UpdateItem(UriItem item, UriStatus status) { item.Status = status; UpdateItem(item); }
public void UpdateItem(int index, UriStatus status) { UpdateItem(Items[index], status); }
public UriStatusInfo(UriStatus UriStatus, HttpStatusCode HttpStatusCode = HttpStatusCode.Unused) { this.UriStatus = UriStatus; this.HttpStatusCode = HttpStatusCode; }