Esempio n. 1
0
        private void HandleTimerCallback(object state)
        {
            TimerNotificationInfo info  = (TimerNotificationInfo)state;
            TimerNotification     notif = new TimerNotification(info.Type, this, -1, info.Message, info.UserData, info.NotifificationId);

            SendNotification(notif);
            if (info.NbOccurences == 0)
            {
                _notifications.Remove(info.NotifificationId);
            }
        }
Esempio n. 2
0
 public int AddNotification4(string type, string message, object userData, DateTime date, TimeSpan period, long nbOccurences, bool fixedRate)
 {
     int notifId;
      TimerNotificationInfo info;
      lock (_notifications)
      {
     notifId = _currentNotificationId;
     info = new TimerNotificationInfo(notifId, type, message, userData, date, period, nbOccurences,
                                                            fixedRate, HandleTimerCallback, CheckSendPastNotifications);
     _currentNotificationId++;
     _notifications[notifId] = info;
      }
      if (_isActive)
      {
     info.Start();
      }
      return notifId;
 }
Esempio n. 3
0
        public int AddNotification4(string type, string message, object userData, DateTime date, TimeSpan period, long nbOccurences, bool fixedRate)
        {
            int notifId;
            TimerNotificationInfo info;

            lock (_notifications)
            {
                notifId = _currentNotificationId;
                info    = new TimerNotificationInfo(notifId, type, message, userData, date, period, nbOccurences,
                                                    fixedRate, HandleTimerCallback, CheckSendPastNotifications);
                _currentNotificationId++;
                _notifications[notifId] = info;
            }
            if (_isActive)
            {
                info.Start();
            }
            return(notifId);
        }