
| Key: |
RAD-34
|
| Type: |
Improvement
|
| Status: |
Closed
|
| Resolution: |
Fixed
|
| Priority: |
Major
|
| Assignee: |
Unassigned
|
| Reporter: |
Mojito Sorbet
|
| Votes: |
0
|
| Watchers: |
1
|
|
If you were logged in you would be able to see more operations.
|
|
|
|
I can tell when a Notification arrives through the global Notification.OnNotificationDisplayed event. But there is no corresponding event when the Notification is closed, for example if the user uses the keyboard or mouse to deal with it. I need to clean up my Speech context for the notification when it goes away, by whatever means.
|
|
Description
|
I can tell when a Notification arrives through the global Notification.OnNotificationDisplayed event. But there is no corresponding event when the Notification is closed, for example if the user uses the keyboard or mouse to deal with it. I need to clean up my Speech context for the notification when it goes away, by whatever means. |
Show » |
|
Here is an example use:
=========================================================================================================
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using Radegast;
namespace CogbotRadegastPluginModule
{
public class CogbotNotificationListener
{
private CogbotNotificationListener _cogbotNotification;
private List<NotificationEventArgs> LookingAt = new List<NotificationEventArgs>();
public CogbotNotificationListener()
{ _cogbotNotification = this; Notification.OnNotificationDisplayed += Test_OnNotificationOpened; }private void Test_OnNotificationItemClicked(object sender, EventArgs e, NotificationEventArgs notice)
{ WriteLine("Not sure you heard that we tracking " + notice.Text); }{
lock (_cogbotNotification)
{
notice.OnNotificationClicked -= Test_OnNotificationItemClicked;
lock (LookingAt) if (!LookingAt.Contains(notice))
Button button = sender as Button;
{ WriteLine("You expected a button but got: " + sender + " for " + notice.Text); return; }if (button == null)
WriteLine("You clicked: " + button.Text + " on Dialog" + notice.Text);
}
}
static void WriteLine(string s)
{ Console.WriteLine(s); }private void Test_OnNotificationClosing(object sender, NotificationEventArgs e)
{ WriteLine("You can no longer see the Notifation: " + e.Text); e.OnNotificationClosed -= Test_OnNotificationClosing; lock (LookingAt) LookingAt.Remove(e); }{
lock (_cogbotNotification)
}
private void Test_OnNotificationOpened(object sender, NotificationEventArgs e)
{ lock (LookingAt) LookingAt.Add(e); WriteLine("Hooked up " + e.Text); // Hook me up e.OnNotificationClicked += Test_OnNotificationItemClicked; e.OnNotificationClosed += Test_OnNotificationClosing; }{
lock (_cogbotNotification)
}
}
}