'宣言 Public Class AppointmentsSubsetCollection Inherits Infragistics.Shared.SubObjectsCollectionBase
public class AppointmentsSubsetCollection : Infragistics.Shared.SubObjectsCollectionBase
Imports System.Diagnostics Imports Infragistics.Win Imports Infragistics.Win.UltraWinSchedule Private Sub Button17_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button17.Click ' Iterate thru the UltraDayView's VisibleDayCollection and display information ' about each day in the output window. Debug.WriteLine("Visible days list (" + Me.UltraDayView1.VisibleDays.Count.ToString() + " total visible days)") Debug.IndentLevel += 1 Dim visibleDay As VisibleDay For Each visibleDay In Me.UltraDayView1.VisibleDays Debug.WriteLine("Info for VisibleDay: " + visibleDay.Date.ToShortDateString() + " --------------") Debug.IndentLevel += 1 Debug.WriteLine("Day of the week: " + visibleDay.Day.DayOfWeek.DayOfTheWeek.ToString()) ' Display a list of appointments for this visible day (if any) Dim appointmentsStartTime As New DateTime(visibleDay.Date.Year, visibleDay.Date.Month, visibleDay.Date.Day, 0, 0, 0) Dim appointmentsEndTime As New DateTime(visibleDay.Date.Year, visibleDay.Date.Month, visibleDay.Date.Day, 23, 59, 0) Dim visibleDayAppointments As AppointmentsSubsetCollection = visibleDay.GetAppointments(appointmentsStartTime, appointmentsEndTime) If (visibleDayAppointments.Count > 0) Then Debug.WriteLine("Appointments for the day -----------------------") Debug.IndentLevel += 1 Dim appointment As Appointment For Each appointment In visibleDayAppointments Debug.WriteLine("Appointment '" + appointment.Subject + "' (" + appointment.StartDateTime.ToString("M/d/yyyy hh:mm tt") + "-" + appointment.EndDateTime.ToString("M/d/yyyy hh:mm tt") + ")") Next Debug.IndentLevel -= 1 Debug.WriteLine("End of Appointments for the day") End If Debug.IndentLevel -= 1 Next Debug.IndentLevel -= 1 Debug.WriteLine("End of visible days list") End Sub
using System.Diagnostics; using Infragistics.Win; using Infragistics.Win.UltraWinSchedule; private void button17_Click(object sender, System.EventArgs e) { // Iterate thru the UltraDayView's VisibleDayCollection and display information // about each day in the output window. Debug.WriteLine("Visible days list (" + this.ultraDayView1.VisibleDays.Count.ToString() + " total visible days)"); Debug.IndentLevel++; foreach(VisibleDay visibleDay in this.ultraDayView1.VisibleDays) { Debug.WriteLine("Info for VisibleDay: " + visibleDay.Date.ToShortDateString() + " --------------"); Debug.IndentLevel++; Debug.WriteLine("Day of the week: " + visibleDay.Day.DayOfWeek.DayOfTheWeek.ToString()); // Display a list of appointments for this visible day (if any) DateTime appointmentsStartTime = new DateTime(visibleDay.Date.Year, visibleDay.Date.Month, visibleDay.Date.Day, 0, 0, 0); DateTime appointmentsEndTime = new DateTime(visibleDay.Date.Year, visibleDay.Date.Month, visibleDay.Date.Day, 23, 59, 0); AppointmentsSubsetCollection visibleDayAppointments = visibleDay.GetAppointments(appointmentsStartTime, appointmentsEndTime); if (visibleDayAppointments.Count > 0) { Debug.WriteLine("Appointments for the day -----------------------"); Debug.IndentLevel++; foreach(Appointment appointment in visibleDayAppointments) { Debug.WriteLine("Appointment '" + appointment.Subject + "' (" + appointment.StartDateTime.ToString("M/d/yyyy hh:mm tt") + "-" + appointment.EndDateTime.ToString("M/d/yyyy hh:mm tt") + ")"); } Debug.IndentLevel--; Debug.WriteLine("End of Appointments for the day"); } Debug.IndentLevel--; } Debug.IndentLevel--; Debug.WriteLine("End of visible days list"); }