Inheritance: INotifyPropertyChanged
Exemple #1
0
 internal void AddNotification(Notification notification)
 {
     notification.Manager = this;
     lock (Notifications)
     {
         /*
         switch (notification.Flag)
         {
             case "ReceiveFileRequest":
                 BlitsMeClientAppContext.CurrentAppContext.UIManager.ReceiveNotificationChat(notification.Message,notification.Flag);
                 break;
             case "RDPRequest":
                 BlitsMeClientAppContext.CurrentAppContext.UIManager.ReceiveNotificationChat(notification.Message, notification.Flag);
                 break;
             case "":
                 Notifications.Add(notification);
                 break;
         }
          */
         Notifications.Add(notification);
     }
     if (_removerTimer.Enabled == false)
     {
         _removerTimer.Start();
     }
 }
Exemple #2
0
 internal void DeleteNotification(Notification notification)
 {
     lock (Notifications)
     {
         if (Notifications.Contains(notification))
         {
             if (notification.Message == "TerminateRDP")
             {
                 //BlitsMeClientAppContext.CurrentAppContext.UIManager.StopRemoteConnection();
             }
             if (Notifications.Remove(notification))
             {
                 Logger.Debug("Successfully removed notification [" + notification.ToString() + "]");
             }
             else
             {
                 Logger.Warn("Failed to remove notication [" + notification.ToString() + "]");
             }
             if (Notifications.Count == 0)
             {
                 _removerTimer.Stop();
             }
         } else
         {
             Logger.Warn("Cannot remote notification " + notification + ", it doesn't exist.");
         }
     }
 }
Exemple #3
0
        private void RemoveAfterTimeoutRunner(object sender, ElapsedEventArgs e)
        {
            long nowTime = DateTime.Now.Ticks;
            Notification[] localNotifications;
            lock (Notifications)
            {
                localNotifications = new Notification[Notifications.Count];
                Notifications.CopyTo(localNotifications, 0);
            }

            foreach (Notification notification in localNotifications)
            {
                if (notification.DeleteTimeout > 0)
                {
                    TimeSpan elapsed = new TimeSpan(nowTime - notification.NotifyTime);
                    if (elapsed.TotalSeconds > notification.DeleteTimeout)
                    {
                        this.DeleteNotification(notification);
                    }
                }
            }
        }
Exemple #4
0
 internal DeleteNotificationCommand(NotificationManager manager, Notification notification)
 {
     this._notificationManager = manager;
     this._notification = notification;
 }