public void ClearMessages() { Notifications.Clear(); DeviceAlerts.Clear(); Warnings.Clear(); Errors.Clear(); CheckForMessages(); }
void CheckForMessages_GUI() { if (Notifications.ToList().FindAll(x => x.Shown == true).Count > 0 || DeviceAlerts.ToList().FindAll(x => x.Shown == true).Count > 0 || Warnings.ToList().FindAll(x => x.Shown == true).Count > 0 || Errors.ToList().FindAll(x => x.Shown == true).Count > 0) { NoMessages = false; } else { NoMessages = true; } if (Notifications.ToList().FindAll(x => x.Shown == true).Count > 0) { NoNotifications = false; } else { NoNotifications = true; } if (DeviceAlerts.ToList().FindAll(x => x.Shown == true).Count > 0) { NoDeviceAlerts = false; } else { NoDeviceAlerts = true; } if (Warnings.ToList().FindAll(x => x.Shown == true).Count > 0) { NoWarnings = false; } else { NoWarnings = true; } if (Errors.ToList().FindAll(x => x.Shown == true).Count > 0) { NoErrors = false; } else { NoErrors = true; } foreach (Message msg in Notifications.ToList().FindAll(x => x.Shown == false)) { Notifications.Remove(msg); } // Get Unread Message Count mw.NotificationsCount = Notifications.ToList().Count(x => x.Read == false); mw.NotificationsCount += DeviceAlerts.ToList().Count(x => x.Read == false); mw.NotificationsCount += Warnings.ToList().Count(x => x.Read == false); mw.NotificationsCount += Errors.ToList().Count(x => x.Read == false); }