public bool Equals(AlertKey other) { // compare only on alert category if we have one if (AlertCategory.HasValue) { return(other.AlertCategory == AlertCategory); } return(AlertType == other.AlertType && AlertCategory == other.AlertCategory); }
protected bool TryGetAlertState(AlertKey key, out AlertState alertState) { if (_alerts.TryGetValue(key, out var alertData)) { alertState = alertData.AlertState; return(true); } alertState = default; return(false); }
public bool Equals(GlobalAlert input) { if (input == null) { return(false); } return (( AlertKey == input.AlertKey || (AlertKey != null && AlertKey.Equals(input.AlertKey)) ) && ( AlertHtml == input.AlertHtml || (AlertHtml != null && AlertHtml.Equals(input.AlertHtml)) ) && ( AlertTimestamp == input.AlertTimestamp || (AlertTimestamp != null && AlertTimestamp.Equals(input.AlertTimestamp)) ) && ( AlertLink == input.AlertLink || (AlertLink != null && AlertLink.Equals(input.AlertLink)) ) && ( AlertLevel == input.AlertLevel || (AlertLevel != null && AlertLevel.Equals(input.AlertLevel)) ) && ( AlertType == input.AlertType || (AlertType != null && AlertType.Equals(input.AlertType)) ) && ( StreamInfo == input.StreamInfo || (StreamInfo != null && StreamInfo.Equals(input.StreamInfo)) )); }
public void TestAlertKey() { Assert.That(new AlertKey(AlertType.HumanHealth, null), Is.Not.EqualTo(AlertKey.ForCategory(AlertCategory.Health))); Assert.That((new AlertKey(null, AlertCategory.Health)), Is.EqualTo(AlertKey.ForCategory(AlertCategory.Health))); Assert.That((new AlertKey(AlertType.Buckled, AlertCategory.Health)), Is.EqualTo(AlertKey.ForCategory(AlertCategory.Health))); }
/// <returns>true iff an alert of the indicated key is currently showing</returns> protected bool IsShowingAlert(AlertKey alertKey) { return(_alerts.ContainsKey(alertKey)); }
/// <returns>true iff an alert of the indicated alert category is currently showing</returns> public bool IsShowingAlertCategory(AlertCategory alertCategory) { return(IsShowingAlert(AlertKey.ForCategory(alertCategory))); }