Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinSchedule
Imports System.Diagnostics
Private Sub ultraCalendarInfo1_ValidateAppointment(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinSchedule.ValidateAppointmentEventArgs) Handles ultraCalendarInfo1.ValidateAppointment
'----------------------------------------------------------------------------------------------------
' 説明
' ValidateAppointment
'
' Appointment オブジェクトが Appointment ダイアログで変更されたときに発生します
'
'----------------------------------------------------------------------------------------------------
' SaveChanges プロパティは、条件付きの変更を
' 予定で許可するために使用できます
If (Not e.Appointment.Tag Is Nothing) Then
Dim userID As String = e.Appointment.Tag
' ユーザーが管理者ではない場合、変更は保存されません
If (userID.ToLower() <> "admin") Then
MessageBox.Show("You must have administrator rights to modify this Appointment.", "ValidateAppointment", MessageBoxButtons.OK, MessageBoxIcon.Error)
e.SaveChanges = False
Return
End If
End If
' CloseDialog プロパティを使用すると、Appointment オブジェクトの
' 状態が特定の条件を満たすまでダイアログは
' 開かれたままです
If (e.Appointment.Description Is Nothing Or e.Appointment.Description.Length = 0) Then
MessageBox.Show("You must enter a Description for this Appointment.", "ValidateAppointment", MessageBoxButtons.OK, MessageBoxIcon.Error)
e.CloseDialog = False
Return
End If
' OriginalAppointment プロパティを使用すると、予定オブジェクトに
' 加えられた変更を決定します
Dim info As String = String.Empty
If (e.OriginalAppointment.StartDateTime <> e.Appointment.StartDateTime) Then
info += "The appointment's StartDateTime has changed." + vbCrLf
End If
If (e.OriginalAppointment.EndDateTime <> e.Appointment.EndDateTime) Then
info += "The appointment's EndDateTime has changed." + vbCrLf
End If
If (e.OriginalAppointment.Subject <> e.Appointment.Subject) Then
info += "The appointment's Subject has changed." + vbCrLf
End If
If (e.OriginalAppointment.Location <> e.Appointment.Location) Then
info += "The appointment's Location has changed." + vbCrLf
End If
If (e.OriginalAppointment.Description <> e.Appointment.Description) Then
info += "The appointment's Description has changed." + vbCrLf
End If
' 重要なプロパティが変更された場合、エンド ユーザーに通知します
If (info.Length > 0) Then
MessageBox.Show(info, "ValidateAppointment", MessageBoxButtons.OK)
End If
End Sub