Quantcast
Channel: Telerik Forums RSS
Viewing all articles
Browse latest Browse all 94857

Can't keep reference to desktop alert

$
0
0
Hi Martin,

Thank you for writing. 

I tested your scenario with a list and a dictionary and I am able to access the already displayed alerts and hide them. Please check my example below: 
public partial class Form1 : Form
{
    private IDictionary<int, RadDesktopAlert> alerts;
 
    public Form1()
    {
        InitializeComponent();
        this.alerts = new Dictionary<int, RadDesktopAlert>();
    }
 
    private void btnAddAlert_Click(object sender, EventArgs e)
    {
        RadDesktopAlert alert = new RadDesktopAlert();
        alert.AutoClose = false;
        alert.CaptionText = "New Alert";
        alert.ContentText = "Some text";
        alert.Show();
 
        alerts[this.alerts.Count] = alert;
    }
 
    private void btnFindAlert_Click(object sender, EventArgs e)
    {
        int id;
        bool isInteger = int.TryParse(this.tbId.Text, out id);
        if (isInteger)
        {
             if (alerts.ContainsKey(id))
             {
                 alerts[id].Hide();
                 alerts.Remove(id);
             }
        }
    }
}

As to the DesktopAlertManager, it is basically responsible for setting the position of each alert when it is being created. Just before an alert is shown it gets registered by the alert manager and its coordinates are calculated depending on the screen settings and the other alerts which are already shown.

I hope this helps. Should you have further questions please do not hesitate to write back.

Regards,
Hristo Merdjanov
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items

Viewing all articles
Browse latest Browse all 94857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>