コード例 #1
0
 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);
 }
コード例 #2
0
 /// <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);
 }