Version

DesktopAlertClosed Event

Occurs immediately after a desktop alert window has been closed.
Syntax
'Declaration
 
Public Event DesktopAlertClosed As DesktopAlertClosedHandler
public event DesktopAlertClosedHandler DesktopAlertClosed
Event Data

The event handler receives an argument of type DesktopAlertClosedEventArgs containing data related to this event. The following DesktopAlertClosedEventArgs properties provide information specific to this event.

PropertyDescription
WindowInfo (Inherited from Infragistics.Win.Misc.DesktopAlertEventArgsBase)Returns a reference to the UltraDesktopAlertWindowInfo instance for which the event was fired.
Example
The following code sample demonstrates how the DesktopAlertClosed event can be used in conjunction with the ScreenLocation property of the UltraDesktopAlertShowWindowInfo class to show desktop alert windows at the same location as the last one that was shown.

For an overview of how to handle events in Visual Basic or Visual C#, see Event Handlers in Visual Basic and Visual C#. For specific information and code examples illustrating how to consume events in your application, see Consuming Events in the .NET Framework Developer's Guide.

Imports Infragistics.Win
Imports Infragistics.Win.Misc

    Private Function ShowWindow(ByVal screenLocation As Point) As UltraDesktopAlertWindowInfo

        '  Create a new instance of the UltraDesktopAlertShowWindowInfo class.
        Dim showInfo As UltraDesktopAlertShowWindowInfo = New UltraDesktopAlertShowWindowInfo()

        '  Set the key to uniquely identify this desktop alert window
        showInfo.Key = "myWindow"

        '  Set the Caption, Text, and FooterText properties using formatting
        '  characters that are recognized by the FormattedTextUIElement.
        showInfo.Caption = "<span style=""font-weight:bold_x003B_"">Caption</span> is bolded<br/>"
        showInfo.Text = "<span style=""text-decoration:underline_x003B_"">Line one of the Text is underlined</span><br/><span style=""font-style:italic_x003B_"">Line two is italicized</span><br/>"
        showInfo.FooterText = "<a href=""www.infragistics.com"">Click to visit the Infragistics website</a>"

        '  Use the ScreenPosition property to make the desktop alert
        '  window appear at the top left corner of the screen
        showInfo.ScreenPosition = ScreenPosition.TopLeft

        '  Set the image that is displayed in the desktop alert window's
        '  client area, and the sound that is played as the window appears.
        showInfo.Image = New Icon("C:\Icons\DesktopAlert.ico").ToBitmap()
        showInfo.Sound = "C:\windows\media\notify.wav"

        '  If the screenLocation is valid, use it, Note that we have to set the
        '  ScreenPosition to 'Manual' to use the ScreenLocation property.
        If screenLocation.X >= 0 Then
            showInfo.ScreenLocation = screenLocation
            showInfo.ScreenPosition = ScreenPosition.Manual
        End If

        '   Show the window
        Return Me.desktopAlert.Show(showInfo)
    End Function

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Me.desktopAlert.AllowMove = DefaultableBoolean.True
        AddHandler Me.desktopAlert.DesktopAlertClosed, AddressOf Me.OnDesktopAlertClosed
        Dim windowInfo As UltraDesktopAlertWindowInfo = Me.ShowWindow()
        Me.lastLocation = windowInfo.Bounds.Location
    End Sub

    Private Sub OnDesktopAlertClosed(ByVal sender As Object, ByVal e As DesktopAlertClosedEventArgs)

        Me.lastLocation = e.WindowInfo.Bounds.Location

    End Sub
using Infragistics.Win;
using Infragistics.Win.Misc;
using System.Diagnostics;

    private UltraDesktopAlertWindowInfo ShowWindow( Point screenLocation )
    {
        //  Create a new instance of the UltraDesktopAlertShowWindowInfo class.
        UltraDesktopAlertShowWindowInfo showInfo = new UltraDesktopAlertShowWindowInfo();

        //  Set the key to uniquely identify this desktop alert window
        showInfo.Key = "myWindow";

        //  Set the Caption, Text, and FooterText properties using formatting
        //  characters that are recognized by the FormattedTextUIElement.
        showInfo.Caption = "<span style=\"font-weight:bold_x003B_\">Caption</span> is bolded<br/>";
        showInfo.Text = "<span style=\"text-decoration:underline_x003B_\">Line one of the Text is underlined</span><br/><span style=\"font-style:italic_x003B_\">Line two is italicized</span><br/>";
        showInfo.FooterText = "<a href=\"www.infragistics.com\">Click to visit the Infragistics website</a>";

        //  Set the image that is displayed in the desktop alert window's
        //  client area, and the sound that is played as the window appears.
        showInfo.Image = new Icon( @"C:\Icons\DesktopAlert.ico" ).ToBitmap();
        showInfo.Sound = @"C:\windows\media\notify.wav";

        //  If the screenLocation is valid, use it, Note that we have to set the
        //  ScreenPosition to 'Manual' to use the ScreenLocation property.
        if ( screenLocation.X >= 0 )
        {
            showInfo.ScreenLocation = screenLocation;
            showInfo.ScreenPosition = ScreenPosition.Manual;
        }
        else
            showInfo.ScreenPosition = ScreenPosition.TopLeft;

        //  Call the Show method to display the desktop alert
        return this.desktopAlert.Show( showInfo );
    }

    private void button1_Click(object sender, EventArgs e)
    {
        this.desktopAlert.AllowMove = DefaultableBoolean.True;
        this.desktopAlert.DesktopAlertClosed += new DesktopAlertClosedHandler(this.OnDesktopAlertClosed);
        UltraDesktopAlertWindowInfo windowInfo = this.ShowWindow();
        this.lastLocation = windowInfo.Bounds.Location;
    }

    private void OnDesktopAlertClosed( object sender, DesktopAlertClosedEventArgs e )
    {
        this.lastLocation = e.WindowInfo.Bounds.Location;
    }
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also