Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinSchedule
Imports System.Diagnostics
Private Sub ultraCalendarInfo1_BeforeDisplayAppointmentDialog(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinSchedule.DisplayAppointmentDialogEventArgs) Handles ultraCalendarInfo1.BeforeDisplayAppointmentDialog
'----------------------------------------------------------------------------------------------------
' 説明
' BeforeDisplayAppointmentDialog
'
' Appointment ダイアログが表示される前に発生します
' キャンセルされる場合、Appointment ダイアログが表示されずに、AfterDisplayAppointmentDialog イベントも発生しません
'
'----------------------------------------------------------------------------------------------------
If Not e.IsExistingAppointment Then
If e.Appointment.StartDateTime < DateTime.Today Then
' AppointmentDialog の表示を回避するには、Cancel プロパティを
' True に設定します
e.Cancel = True
' ユーザーに状態を出力します
Dim info As String = String.Empty
info += "Sorry, but you cannot add new appointments in the past."
MessageBox.Show(info, "BeforeDisplayAppointmentDialog", MessageBoxButtons.OK, MessageBoxIcon.Error)
End If
Else
' ダイアログが既存の予定のために表示する
' 必要があります
' これは定期的な予定インスタンスの場合、
If Not e.Appointment.RecurringAppointmentRoot Is Nothing Then
' Outlook は、シリーズまたはインスタンスを編集する
' かどうかを確認するプロンプトを表示しますUltraCalendarInfo では、
' イベント引数の 'RecurrenceEditType' を設定すると
' 動作を処理できます
'
' 予定はバリアンス (変更したインスタンス) の場合、
' インスタンスの情報を編集します
If e.Appointment.IsVariance Then
e.RecurrenceEditType = RecurrenceEditType.Occurrence
Else 'otherwise, let them edit the series so they don't create variances Then
e.RecurrenceEditType = RecurrenceEditType.Series
End If
End If
End If
End Sub