xamSchedule を弄ってみる(その2)

前日のエントリに引き続き 「xamSchedule」 ネタです。本日は以下の記事の VB 化を試みました。


参考記事: Silverlight/WPFでデータバインディングを利用しOutlookライクなスケジュールを構築する その3 WCF サービス 接続編


VisualBasicSilverlight アプリケーションプロジェクトを新規作成する以外は記事とやることは変わりませんが、XamScheduleWCFService サービスのみ以下のようにコードを書き換えてます。

' XamScheduleWCFService.svc.vb
Imports System.ServiceModel
Imports System.ServiceModel.Activation
Imports Infragistics.Services.Schedules
Imports Infragistics.Controls.Schedules.Services

<AspNetCompatibilityRequirements(RequirementsMode:=AspNetCompatibilityRequirementsMode.Allowed)>
Public Class XamScheduleWCFService
    Inherits WcfListConnectorServiceSingle

    Private entities As xamSchedule_SampleEntities

    Public Sub New()
        entities = New xamSchedule_SampleEntities()

        ' リソースの設定
        Me.ResourceItemsSource = entities.Resources
        Me.ResourcePropertyMappings =
                    New ResourcePropertyMappingCollection()
        Me.ResourcePropertyMappings.UseDefaultMappings = True

        ' リソースカレンダーの設定
        Me.ResourceCalendarItemsSource = entities.ResourceCalendars
        Me.ResourceCalendarPropertyMappings =
                New ResourceCalendarPropertyMappingCollection()
        Me.ResourceCalendarPropertyMappings.UseDefaultMappings = True

        ' 予定の設定
        Me.AppointmentItemsSource = entities.Appointments
        Me.AppointmentPropertyMappings =
                New AppointmentPropertyMappingCollection()
        Me.AppointmentPropertyMappings.UseDefaultMappings = True
    End Sub
End Class


以下、実行結果です。Appointments テーブルのレコードを変更し予定を二件にしてみました。あと Subject の使い方が少し判ってきたのでフィールド追加してますが、それはまた次回ということで。