'宣言 Public Property SnoozeIntervalUnits As SnoozeIntervalUnits
public SnoozeIntervalUnits SnoozeIntervalUnits {get; set;}
Imports Infragistics.Win Imports Infragistics.Win.UltraWinSchedule Private Sub SnoozeReminder() ' If there are no appointments, create one now Dim appointment As Appointment = Nothing If Me.ultraCalendarInfo1.Appointments.Count = 0 Then appointment = Me.ultraCalendarInfo1.Appointments.Add(DateTime.Now.AddMinutes(2.0F), DateTime.Now.AddMinutes(5.0F), "My Appointment") Else ' There is already an appointment, so we will use it appointment = Me.ultraCalendarInfo1.Appointments(0) ' Adjust the start and end time appointment.StartDateTime = DateTime.Now.AddMinutes(1.0F) appointment.EndDateTime = appointment.StartDateTime.AddMinutes(5.0F) End If ' Get the appointment's reminder object Dim reminder As Reminder = appointment.Reminder ' Check the Snoozed property to see if the reminder has already been snoozed If reminder.Snoozed Then ' Get the time at which it was snoozed Dim snoozeTime As DateTime = reminder.SnoozeTime ' Notify the user that the reminder has been snoozed MessageBox.Show("This reminder has already been snoozed at " + snoozeTime.ToString("t") + ". Stop procrastinating!", "SnoozeReminder", MessageBoxButtons.OK) Return Else ' Set the SnoozeIntervalUnits to minutes, since that is the ' unit of time that was specified reminder.SnoozeIntervalUnits = SnoozeIntervalUnits.Minutes ' Snooze the reminder for one minute by setting the ' SnoozeInterval property reminder.SnoozeInterval = 1 ' Call the snooze method reminder.Snooze(reminder.SnoozeIntervalUnits, reminder.SnoozeInterval) End If End Sub
using System.Diagnostics; using Infragistics.Win; using Infragistics.Win.UltraWinSchedule; private void SnoozeReminder() { // If there are no appointments, create one now Appointment appointment = null; if ( this.ultraCalendarInfo1.Appointments.Count == 0 ) appointment = this.ultraCalendarInfo1.Appointments.Add( DateTime.Now.AddMinutes( 2.0F ), DateTime.Now.AddMinutes( 5.0F ), "My Appointment" ); else { // There is already an appointment, so we will use it appointment = this.ultraCalendarInfo1.Appointments[ 0 ]; // Adjust the start and end time appointment.StartDateTime = DateTime.Now.AddMinutes( 1.0F ); appointment.EndDateTime = appointment.StartDateTime.AddMinutes( 5.0F ); } // Get the appointment's reminder object Reminder reminder = appointment.Reminder; // Check the Snoozed property to see if the reminder has already been snoozed if ( reminder.Snoozed ) { // Get the time at which it was snoozed DateTime snoozeTime = reminder.SnoozeTime; // Notify the user that the reminder has been snoozed MessageBox.Show( "This reminder has already been snoozed at " + snoozeTime.ToString("t") + ". Stop procrastinating!", "SnoozeReminder", MessageBoxButtons.OK ); return; } else { // Set the SnoozeIntervalUnits to minutes, since that is the // unit of time that was specified reminder.SnoozeIntervalUnits = SnoozeIntervalUnits.Minutes; // Snooze the reminder for one minute by setting the // SnoozeInterval property reminder.SnoozeInterval = 1; // Call the snooze method reminder.Snooze( reminder.SnoozeIntervalUnits, reminder.SnoozeInterval ); } }