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);
        }
Beispiel #2
0
        protected bool TryGetAlertState(AlertKey key, out AlertState alertState)
        {
            if (_alerts.TryGetValue(key, out var alertData))
            {
                alertState = alertData.AlertState;
                return(true);
            }

            alertState = default;
            return(false);
        }
Beispiel #3
0
        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)));
 }
Beispiel #5
0
 /// <returns>true iff an alert of the indicated key is currently showing</returns>
 protected bool IsShowingAlert(AlertKey alertKey)
 {
     return(_alerts.ContainsKey(alertKey));
 }
Beispiel #6
0
 /// <returns>true iff an alert of the indicated alert category is currently showing</returns>
 public bool IsShowingAlertCategory(AlertCategory alertCategory)
 {
     return(IsShowingAlert(AlertKey.ForCategory(alertCategory)));
 }