| Infragistics.Win.Misc Namespace > UltraDesktopAlert Class : HasOpenWindows Property |
Returns whether there are any desktop alert windows currently open for this UltraDesktopAlert instance.
[Visual Basic]
Public ReadOnly Property HasOpenWindows As Boolean[C#]
public bool HasOpenWindows {get;}The following code sample demonstrates how the properties of the UltraDesktopAlert component can be used to customize the appearance and behavior of all desktop alert windows displayed by the component:
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.
[Visual Basic]
Imports Infragistics.Win
Imports Infragistics.Win.Misc
Private Sub button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button2.Click
' Make sure there are no desktop alert windows currently
' open before proceeding
If (Me.desktopAlert.HasOpenWindows) Then Return
' Set the Opacity property to 90% opacity, to make the
' desktop alert window a little more noticable than it is with
' the default (80% opacity).
Me.desktopAlert.Opacity = 0.9F
' Use the animation related properties to make the desktop alert
' window appear to fade into view, as well as scroll from the left
' edge of the screen towards the right. Use an animation speed of
' medium so the scrolling does not appear sluggish.
Me.desktopAlert.AnimationSpeed = AnimationSpeed.Medium
Me.desktopAlert.AnimationStyleShow = AnimationStyle.FadeAndScroll
Me.desktopAlert.AnimationStyleAutoClose = AnimationStyle.FadeAndScroll
Me.desktopAlert.AnimationScrollDirectionShow = AnimationScrollDirection.LeftToRight
Me.desktopAlert.AnimationScrollDirectionAutoClose = AnimationScrollDirection.RightToLeft
' Disallow moving the desktop alert window, and prevent
' multiple alerts from appearing.
Me.desktopAlert.AllowMove = DefaultableBoolean.False
Me.desktopAlert.MultipleWindowDisplayStyle = MultipleWindowDisplayStyle.None
' Set AutoClose to true, and set AutoCloseDelay to a relatively
' high value so that the end user has enough time to notice the alert.
Me.desktopAlert.AutoClose = DefaultableBoolean.True
Me.desktopAlert.AutoCloseDelay = 30000
' Make the main image appear a bit larger than the default size,
' and the button images appear smaller.
Me.desktopAlert.ImageSize = New Size(48, 48)
Me.desktopAlert.ButtonImageSize = New Size(12, 12)
' Use the button appearances and the ButtonStyle property to
' change the visual appearance of the buttons.
Me.desktopAlert.ButtonStyle = UIElementButtonStyle.PopupSoftBorderless
Dim office2007Colors As Office2007ColorTable = Office2007ColorTable.Colors
Dim normalButtonAppearance As New Infragistics.Win.Appearance()
normalButtonAppearance.BackColor = office2007Colors.ToolbarGradientLight
normalButtonAppearance.BackColor2 = office2007Colors.ToolbarGradientDark
normalButtonAppearance.BackGradientStyle = GradientStyle.GlassTop37Bright
' Note that the ForeColor of the button appearances is used to render
' the dropdown button's arrow indicator and the close button's "x".
normalButtonAppearance.ForeColor = office2007Colors.ToolbarUnderline
Dim hotTrackButtonAppearance As New Infragistics.Win.Appearance()
hotTrackButtonAppearance.BackColor = office2007Colors.HighlightPressedGradientLight
hotTrackButtonAppearance.BackColor2 = office2007Colors.HighlightPressedGradientDark
hotTrackButtonAppearance.BackGradientStyle = GradientStyle.GlassBottom37Bright
Dim pressedButtonAppearance As New Infragistics.Win.Appearance()
pressedButtonAppearance.BackColor = office2007Colors.HighlightPressedGradientDark
pressedButtonAppearance.BackColor2 = office2007Colors.HighlightPressedGradientLight
pressedButtonAppearance.BackGradientStyle = GradientStyle.GlassTop37Bright
Me.desktopAlert.ButtonAppearance = normalButtonAppearance
Me.desktopAlert.ButtonHotTrackAppearance = hotTrackButtonAppearance
Me.desktopAlert.ButtonPressedAppearance = pressedButtonAppearance
' Make the dropdown button visible, and hook the DropDownButtonClicked
' event so we can handle clicks on the button. Also, handle the
' DesktopAlertClosing event so we can keep the window open when the
' ContextMenu is visible
Me.desktopAlert.DropDownButtonVisible = DefaultableBoolean.True
AddHandler Me.desktopAlert.DropDownButtonClicked, AddressOf Me.OnDropDownButtonClicked
AddHandler Me.desktopAlert.DesktopAlertClosing, AddressOf Me.OnDesktopAlertClosing
' Create a ContextMenu which we will display when the dropdown
' button is clicked.
Me._contextMenu.MenuItems.Add(New MenuItem("Cut", AddressOf Me.OnMenuItemClick))
Me._contextMenu.MenuItems.Add(New MenuItem("Copy", AddressOf Me.OnMenuItemClick))
Me._contextMenu.MenuItems.Add(New MenuItem("Paste", AddressOf Me.OnMenuItemClick))
' Add some alert buttons, which appear alongside the bottom edge
' of the desktop alert window. Hook the AlertButtonClicked event
' so we can handle clicks on the buttons.
Dim closeButton As UltraDesktopAlertButton = Me.desktopAlert.AlertButtons.Add("close")
closeButton.Appearance.Image = New Icon("C:\Icons\Close.ico").ToBitmap()
closeButton.ToolTipText = "Close the application"
Dim viewButton As UltraDesktopAlertButton = Me.desktopAlert.AlertButtons.Add("view")
viewButton.Appearance.Image = New Icon("C:\Icons\View.ico").ToBitmap()
viewButton.ToolTipText = "Refresh the view"
AddHandler Me.desktopAlert.AlertButtonClicked, AddressOf Me.OnAlertButtonClicked
End Sub
[C#]
using Infragistics.Win;
using Infragistics.Win.Misc;
using System.Diagnostics;
private void button2_Click(object sender, EventArgs e)
{
// Make sure there are no desktop alert windows currently
// open before proceeding
if ( this.desktopAlert.HasOpenWindows )
return;
// Set the Opacity property to 90% opacity, to make the
// desktop alert window a little more noticable than it is with
// the default (80% opacity).
this.desktopAlert.Opacity = .9f;
// Use the animation related properties to make the desktop alert
// window appear to fade into view, as well as scroll from the left
// edge of the screen towards the right. Use an animation speed of
// medium so the scrolling does not appear sluggish.
this.desktopAlert.AnimationSpeed = AnimationSpeed.Medium;
this.desktopAlert.AnimationStyleShow = AnimationStyle.FadeAndScroll;
this.desktopAlert.AnimationStyleAutoClose = AnimationStyle.FadeAndScroll;
this.desktopAlert.AnimationScrollDirectionShow = AnimationScrollDirection.LeftToRight;
this.desktopAlert.AnimationScrollDirectionAutoClose = AnimationScrollDirection.RightToLeft;
// Disallow moving the desktop alert window, and prevent
// multiple alerts from appearing.
this.desktopAlert.AllowMove = DefaultableBoolean.False;
this.desktopAlert.MultipleWindowDisplayStyle = MultipleWindowDisplayStyle.None;
// Set AutoClose to true, and set AutoCloseDelay to a relatively
// high value so that the end user has enough time to notice the alert.
this.desktopAlert.AutoClose = DefaultableBoolean.True;
this.desktopAlert.AutoCloseDelay = 30000;
// Make the main image appear a bit larger than the default size,
// and the button images appear smaller.
this.desktopAlert.ImageSize = new Size( 48, 48 );
this.desktopAlert.ButtonImageSize = new Size( 12, 12 );
// Use the button appearances and the ButtonStyle property to
// change the visual appearance of the buttons.
this.desktopAlert.ButtonStyle = UIElementButtonStyle.PopupSoftBorderless;
Office2007ColorTable office2007Colors = Office2007ColorTable.Colors;
Infragistics.Win.Appearance normalButtonAppearance = new Infragistics.Win.Appearance();
normalButtonAppearance.BackColor = office2007Colors.ToolbarGradientLight;
normalButtonAppearance.BackColor2 = office2007Colors.ToolbarGradientDark;
normalButtonAppearance.BackGradientStyle = GradientStyle.GlassTop37Bright;
// Note that the ForeColor of the button appearances is used to render
// the dropdown button's arrow indicator and the close button's "x".
normalButtonAppearance.ForeColor = office2007Colors.ToolbarUnderline;
Infragistics.Win.Appearance hotTrackButtonAppearance = new Infragistics.Win.Appearance();
hotTrackButtonAppearance.BackColor = office2007Colors.HighlightPressedGradientLight;
hotTrackButtonAppearance.BackColor2 = office2007Colors.HighlightPressedGradientDark;
hotTrackButtonAppearance.BackGradientStyle = GradientStyle.GlassBottom37Bright;
Infragistics.Win.Appearance pressedButtonAppearance = new Infragistics.Win.Appearance();
pressedButtonAppearance.BackColor = office2007Colors.HighlightPressedGradientDark;
pressedButtonAppearance.BackColor2 = office2007Colors.HighlightPressedGradientLight;
pressedButtonAppearance.BackGradientStyle = GradientStyle.GlassTop37Bright;
this.desktopAlert.ButtonAppearance = normalButtonAppearance;
this.desktopAlert.ButtonHotTrackAppearance = hotTrackButtonAppearance;
this.desktopAlert.ButtonPressedAppearance = pressedButtonAppearance;
// Make the dropdown button visible, and hook the DropDownButtonClicked
// event so we can handle clicks on the button. Also, handle the
// DesktopAlertClosing event so we can keep the window open when the
// ContextMenu is visible
this.desktopAlert.DropDownButtonVisible = DefaultableBoolean.True;
this.desktopAlert.DropDownButtonClicked += new DropDownButtonClickedHandler(this.OnDropDownButtonClicked);
this.desktopAlert.DesktopAlertClosing += new DesktopAlertClosingHandler(this.OnDesktopAlertClosing);
// Create a ContextMenu which we will display when the dropdown
// button is clicked.
EventHandler clickHandler = new EventHandler( this.OnMenuItemClick );
this.contextMenu.MenuItems.Add( new MenuItem( "Cut", clickHandler ) );
this.contextMenu.MenuItems.Add( new MenuItem( "Copy", clickHandler ) );
this.contextMenu.MenuItems.Add( new MenuItem( "Paste", clickHandler ) );
// Add some alert buttons, which appear alongside the bottom edge
// of the desktop alert window. Hook the AlertButtonClicked event
// so we can handle clicks on the buttons.
UltraDesktopAlertButton closeButton = this.desktopAlert.AlertButtons.Add( "close" );
closeButton.Appearance.Image = new Icon( @"C:\Icons\Close.ico" ).ToBitmap();
closeButton.ToolTipText = "Close the application";
UltraDesktopAlertButton viewButton = this.desktopAlert.AlertButtons.Add( "view" );
viewButton.Appearance.Image = new Icon( @"C:\Icons\View.ico" ).ToBitmap();
viewButton.ToolTipText = "Refresh the view";
this.desktopAlert.AlertButtonClicked += new AlertButtonClickedHandler(this.OnAlertButtonClicked);
}