public NotificationListener(NotificationQueue _nq) { queue = _nq; queue.Busy = false; queue.Added += new NotificationAddedEventHandler(DeliverNotification /*NotifyNew*/); queue.Over += new NotificationEndedEventHandler(DeliverNext /*NextNotification*/); }
//private void NextNotification(object sender, EventArgs e) //{ // if (queue.Count > 0) // { // NotifyNew(new object(), new EventArgs(), queue.First()); // } //} //private void NotifyNew(object sender, EventArgs e, NotificationInfo ni) //{ // if (!queue.Busy) // { // queue.SetBusy(); // N.Dispatcher.Invoke(() => // { // N.NotificationHolder.Children.Clear(); // N.Show(); // }); // N.Dispatcher.Invoke(new Action(() => // { // var sn = new StandardNotification(); // sn.Margin = new System.Windows.Thickness(-200, 0, 0, 0); // sn.txt.Text = ni.Content; // sn.glowColor = ni.Color; // N.NotificationHolder.Children.Add(sn); // N.ShowInTaskbar = false; // ImageBrush imgB = new ImageBrush(); // try // { // string val = ""; // imagesDictionary.TryGetValue(ni.Image, out val); // imgB.ImageSource = new BitmapImage(new Uri("pack://application:,,,/resources/notifier_images/" + val + ".png", UriKind.RelativeOrAbsolute)); // } // catch (Exception ex) // { // imgB.ImageSource = new BitmapImage(new Uri("pack://application:,,,/resources/notifier_images/default.png", UriKind.RelativeOrAbsolute)); // Console.WriteLine(ex.ToString()); // } // sn.icon.Fill = imgB; // N.Pop(ni); // })); // } //} public void Detach() { // Detach the event and delete the list queue.Added -= new NotificationAddedEventHandler(DeliverNotification); queue = null; }