public bool Contains(Alert alert) { return items.Contains(alert); }
/// <summary> /// Push alert window to queue. /// </summary> /// <param name="alert"></param> private void PushAlert(Alert alert) { if (alerts.Count >= AlertsMaxCount) { for (int i = 0; i < alerts.Count - AlertsMaxCount + 1; i++) { Alert firstAlert = alerts[i]; if (!hiddenAlerts.Contains(firstAlert)) { firstAlert.Invoke(new MethodInvoker(delegate() { firstAlert.Hide(delegate(Alert al) { alerts.Remove(al); }); })); hiddenAlerts.Add(firstAlert); } } } alerts.Add(alert); }
public void Add(Alert alert) { if (items.Count > MaxCount) { Alert first = items.First.Value; first.Invoke(new CloseAlertDelegate(CloseAlert), first); first.Close(); items.RemoveFirst(); } items.AddLast(alert); }
/// <summary> /// Display window alert <paramref name="alert"/> on the screen. /// </summary> public void ShowAlert(Alert alert) { Rectangle workingRect = Screen.PrimaryScreen.WorkingArea; switch (AlertAlignment) { case AlertAlignment.BottomRight: alert.Show(workingRect.Bottom - (alert.Height + VGap), workingRect.Right - (alert.Width + HGap)); break; case AlertAlignment.BottomLeft: alert.Show(workingRect.Bottom - (alert.Height + VGap), workingRect.Left + HGap); break; case AlertAlignment.TopLeft: alert.Show(workingRect.Top + VGap, workingRect.Left + HGap); break; case AlertAlignment.TopRight: alert.Show(workingRect.Top + VGap, workingRect.Right - (alert.Width + HGap)); break; } }