Hi I want to show only upto 3 desktop alerts at any given time.  Some alerts have autoclose options while others do not.  As such before displaying an alert, I need to check how many are open.  I tried using the desktopalertmanager but running into null exception errors
This is similar to the code sample on your reference pages so not sure what I am doing wrong here...
http://www.telerik.com/help/winforms/telerik.wincontrols.ui-telerik.wincontrols.ui.desktopalertmanager-getregisteredalerts.html
                                Dim
 iDesktopAlertManager As DesktopAlertManager
Dim value As IEnumerator(Of RadDesktopAlert)
value = iDesktopAlertManager.GetRegisteredAlerts()
I stepped though the code and the iDesktopAlertManager is nothing which causes a null exception error. I am not fully aware of the DesktopAlertManager.
This is similar to the code sample on your reference pages so not sure what I am doing wrong here...
http://www.telerik.com/help/winforms/telerik.wincontrols.ui-telerik.wincontrols.ui.desktopalertmanager-getregisteredalerts.html
5 Answers, 1 is accepted
0
                                Accepted
                                                    Richard Slade
                                                    
                                            
    Top achievements
    
            
                
                Rank 2
            
    
                                                
                                                answered on 18 Jan 2011, 11:58 PM
                                            
                                        Hello John, 
Please can you try this in a new project. It's just a form and a RadButton
Hope that helps
Richard
                                        Please can you try this in a new project. It's just a form and a RadButton
Private m_Alerts As New List(Of Telerik.WinControls.UI.RadDesktopAlert) Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End SubPrivate Sub Alert_Closed(ByVal Sender As Object, ByVal e As EventArgs)     m_Alerts.Remove(CType(Sender, Telerik.WinControls.UI.RadDesktopAlert)) End SubPrivate Sub ButtonGenerateAlert_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonGenerateAlert.Click     If m_Alerts.Count < 3 Then        Dim alert As New Telerik.WinControls.UI.RadDesktopAlert()         alert.CaptionText = "Alert Header"        alert.ContentText = "Alert Context"        m_Alerts.Add(alert)         alert.Show()         AddHandler alert.Closed, AddressOf Alert_Closed     End IfEnd SubHope that helps
Richard
0
                                
                                                    Richard Slade
                                                    
                                            
    Top achievements
    
            
                
                Rank 2
            
    
                                                
                                                answered on 20 Jan 2011, 10:11 AM
                                            
                                        Hello, 
Did this help? If so please remember to mark as answer. If you need morre assistance just let me know.
Regards,
Richard
                                        Did this help? If so please remember to mark as answer. If you need morre assistance just let me know.
Regards,
Richard
0
                                Hello John,
Here is the proper way to use the DesktopAlertManager to get the count of the shown alerts:
 
Richard's approach could also do the required task.
I hope this was helpful. Should you have any further questions, do not hesitate to ask.
Greetings,
Ivan Todorov
the Telerik team
                                        Here is the proper way to use the DesktopAlertManager to get the count of the shown alerts:
Public Function GetAlertCount() As Integer    Dim count As Integer = 0    Dim alerts As IEnumerator(Of RadDesktopAlert) = DesktopAlertManager.Instance.GetRegisteredAlerts()    While alerts.MoveNext()        count += 1    End While    Return countEnd FunctionRichard's approach could also do the required task.
I hope this was helpful. Should you have any further questions, do not hesitate to ask.
Greetings,
Ivan Todorov
the Telerik team
0
                                
                                                    John
                                                    
                                            
    Top achievements
    
            
                
                Rank 1
            
    
                                                
                                                answered on 25 Jan 2011, 05:15 PM
                                            
                                        I will try this option and update with my findings.
                                        0
                                Hi John,
Please let us know if this worked for you, when you try it. I will be glad to assist you if you need further help, so do not hesitate to write back.
Greetings,
                                        Please let us know if this worked for you, when you try it. I will be glad to assist you if you need further help, so do not hesitate to write back.
Greetings,
Ivan Todorov
the Telerik team