'Declaration Public Property Appearance As Infragistics.Win.AppearanceBase
public Infragistics.Win.AppearanceBase Appearance {get; set;}
Imports Infragistics.Win Imports Infragistics.Win.Misc Imports Infragistics.Win.UltraWinSchedule Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click ' Handle the 'AlertButtonClicked' event of the UltraDesktopAlert, ' and the 'BeforeDisplayReminderDialog' event of the UltraCalendarInfo. AddHandler Me.desktopAlert.AlertButtonClicked, AddressOf Me.OnAlertButtonClicked AddHandler Me.calendarInfo.BeforeDisplayReminderDialog, AddressOf Me.OnBeforeDisplayReminderDialog ' Add the alert buttons Dim deleteButton As UltraDesktopAlertButton = Me.desktopAlert.AlertButtons.Add("delete") deleteButton.Appearance.Image = New Icon("C:\Icons\delete.ico").ToBitmap() deleteButton.ToolTipText = "Delete this Appointment" Dim snoozeButton As UltraDesktopAlertButton = Me.desktopAlert.AlertButtons.Add("snooze") snoozeButton.Appearance.Image = New Icon("C:\Icons\snooze.ico").ToBitmap() snoozeButton.ToolTipText = "Remind me again later" Dim findButton As UltraDesktopAlertButton = Me.desktopAlert.AlertButtons.Add("find") findButton.Appearance.Image = New Icon("C:\Icons\find.ico").ToBitmap() findButton.ToolTipText = "Search for an Appointment" ' Add an appointment Dim appointment As Appointment = New Appointment(DateTime.Now.AddMinutes(1), DateTime.Now.AddMinutes(31)) appointment.Subject = "Appointment Subject" appointment.Description = "Appointment Description" appointment.Reminder.DisplayInterval = 0 appointment.Reminder.Enabled = True appointment.Tag = ImportanceLevel.High Me.calendarInfo.Appointments.Add(appointment) End Sub Private Sub OnBeforeDisplayReminderDialog(ByVal sender As Object, ByVal e As CancelableAppointmentEventArgs) ' Cancel the event to prevent the default dialog from appearing e.Cancel = True ' Get a reference to the Appointment. Dim appointment As Appointment = e.Appointment ' Create a new instance of the UltraDesktopAlertShowWindowInfo class. Dim showInfo As UltraDesktopAlertShowWindowInfo = New UltraDesktopAlertShowWindowInfo() ' Set the Data property of the UltraDesktopAlertShowWindowInfo instance ' to reference the Appointment. showInfo.Data = appointment ' Set the Caption to the appointment's Subject, and set the ' Text to the appointment's Description. We will use the FooterText ' to display a link to the Options dialog. showInfo.Caption = String.Format("<a>{0}</a>", appointment.Subject) showInfo.Text = String.Format("<a>{0}</a>", appointment.Description) showInfo.FooterText = "<a>Options...</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\Calendar.ico").ToBitmap() showInfo.Sound = "C:\windows\media\notify.wav" ' If the appointment's importance level is set to high, use the ' VisibleAlertButtons collection of the UltraDesktopAlertShowWindowInfo ' class to conditionally remove the "delete" button. If Not appointment.Tag Is Nothing AndAlso appointment.Tag.GetType() Is GetType(ImportanceLevel) Then Dim importance As ImportanceLevel = CType(appointment.Tag, ImportanceLevel) If importance = ImportanceLevel.High Then ' First, populate the VisibleAlertButtons collection with all ' visible members of the UltraDesktopAlert's AlertButtons collection. ' Note that this is only necessary if we are altering the contents ' of the VisibleAlertButtons collection. showInfo.VisibleAlertButtons.InitializeFrom(Me.desktopAlert) ' Next, use the Remove method to prevent the delete button from appearing showInfo.VisibleAlertButtons.Remove(Me.desktopAlert.AlertButtons("delete")) End If End If ' Call the Show method to display the desktop alert Me.desktopAlert.Show(showInfo) End Sub Private Sub OnAlertButtonClicked(ByVal sender As Object, ByVal e As AlertButtonClickedEventArgs) ' Extract the appointment by upcasting the contents of the ' Data property of the UltraDesktopAlertWindowInfo instance ' that gets passed to the event. Dim appointment As Appointment = CType(e.WindowInfo.Data, Appointment) If appointment Is Nothing Then Return Dim calendarInfo As UltraCalendarInfo = appointment.CalendarInfo Select Case e.Button.Key Case "delete" ' If the delete button was clicked, remove the appointment ' from the Appointments collection. calendarInfo.Appointments.Remove(appointment) e.CloseWindow = True Case "snooze" ' If the snooze button was clicked, snooze the appointment ' for five minutes. appointment.Reminder.Snooze(SnoozeIntervalUnits.Minutes, 5) Case "find" Me.ShowSearchDialog() End Select End Sub
using Infragistics.Win; using Infragistics.Win.Misc; using Infragistics.Win.UltraWinSchedule; using System.Diagnostics; private void Button1_Click(object sender, EventArgs e) { // Handle the 'AlertButtonClicked' event of the UltraDesktopAlert, // and the 'BeforeDisplayReminderDialog' event of the UltraCalendarInfo. this.desktopAlert.AlertButtonClicked += new AlertButtonClickedHandler( this.OnAlertButtonClicked ); this.calendarInfo.BeforeDisplayReminderDialog += new CancelableAppointmentEventHandler(this.OnBeforeDisplayReminderDialog); // Add the alert buttons UltraDesktopAlertButton deleteButton = this.desktopAlert.AlertButtons.Add( "delete" ); deleteButton.Appearance.Image = new Icon( @"C:\Icons\delete.ico" ).ToBitmap(); deleteButton.ToolTipText = "Delete this Appointment"; UltraDesktopAlertButton snoozeButton = this.desktopAlert.AlertButtons.Add( "snooze" ); snoozeButton.Appearance.Image = new Icon( @"C:\Icons\snooze.ico" ).ToBitmap(); snoozeButton.ToolTipText = "Remind me again later"; UltraDesktopAlertButton findButton = this.desktopAlert.AlertButtons.Add( "find" ); findButton.Appearance.Image = new Icon( @"C:\Icons\find.ico" ).ToBitmap(); findButton.ToolTipText = "Search for an Appointment"; // Add an appointment Appointment appointment = new Appointment( DateTime.Now.AddMinutes(1), DateTime.Now.AddMinutes(31) ); appointment.Subject = "Appointment Subject"; appointment.Description = "Appointment Description"; appointment.Reminder.DisplayInterval = 0; appointment.Reminder.Enabled = true; appointment.Tag = ImportanceLevel.High; this.calendarInfo.Appointments.Add( appointment ); } private void OnBeforeDisplayReminderDialog(object sender, CancelableAppointmentEventArgs e) { // Cancel the event to prevent the default dialog from appearing e.Cancel = true; // Get a reference to the Appointment. Appointment appointment = e.Appointment; // Create a new instance of the UltraDesktopAlertShowWindowInfo class. UltraDesktopAlertShowWindowInfo showInfo = new UltraDesktopAlertShowWindowInfo(); // Set the Data property of the UltraDesktopAlertShowWindowInfo instance // to reference the Appointment. showInfo.Data = appointment; // Set the Caption to the appointment's Subject, and set the // Text to the appointment's Description. We will use the FooterText // to display a link to the Options dialog. showInfo.Caption = string.Format( "<a><span style=\"font-weight:bold_x003B_\">{0}</span></a>", appointment.Subject ); showInfo.Text = string.Format( "<a>{0}</a>", appointment.Description ); showInfo.FooterText = "<a>Options...</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\Calendar.ico" ).ToBitmap(); showInfo.Sound = @"C:\windows\media\notify.wav"; // If the appointment's importance level is set to high, use the // VisibleAlertButtons collection of the UltraDesktopAlertShowWindowInfo // class to conditionally remove the "delete" button. ImportanceLevel importance = appointment.Tag is ImportanceLevel ? (ImportanceLevel)appointment.Tag : ImportanceLevel.Undefined; if ( importance == ImportanceLevel.High ) { // First, populate the VisibleAlertButtons collection with all // visible members of the UltraDesktopAlert's AlertButtons collection. // Note that this is only necessary if we are altering the contents // of the VisibleAlertButtons collection. showInfo.VisibleAlertButtons.InitializeFrom( this.desktopAlert ); // Next, use the Remove method to prevent the delete button from appearing showInfo.VisibleAlertButtons.Remove( this.desktopAlert.AlertButtons["delete"] ); } // Call the Show method to display the desktop alert this.desktopAlert.Show( showInfo ); } // Handles the 'AlertButtonClicked' event. private void OnAlertButtonClicked( object sender, AlertButtonClickedEventArgs e ) { // Extract the appointment by upcasting the contents of the // Data property of the UltraDesktopAlertWindowInfo instance // that gets passed to the event. Appointment appointment = e.WindowInfo.Data as Appointment; if ( appointment == null ) return; UltraCalendarInfo calendarInfo = appointment.CalendarInfo; switch ( e.Button.Key ) { // If the delete button was clicked, remove the appointment // from the Appointments collection. case "delete": { calendarInfo.Appointments.Remove( appointment ); e.CloseWindow = true; } break; // If the snooze button was clicked, snooze the appointment // for five minutes. case "snooze": { appointment.Reminder.Snooze( SnoozeIntervalUnits.Minutes, 5 ); } break; // If the find button was clicked, launch the search dialog. case "find": { this.ShowSearchDialog(); } break; } }
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