Scheduler for WPF Tutorials > Creating a Multi-User Schedule > Step 3 of 4: Adding the Code to your Application |
In this step you will add the code for your application.
Visual Basic |
Copy Code
|
---|---|
Imports C1.WPF.Schedule Imports C1.C1Schedule Imports System.ComponentModel Imports System.Collections.Specialized |
C# |
Copy Code
|
---|---|
using C1.WPF.Schedule; using System.Collections.Specialized; using C1.C1Schedule; |
Visual Basic |
Copy Code
|
---|---|
#Region "** fields" Private appointmentsTableAdapter As MultiUser.NwindDataSetTableAdapters.AppointmentsTableAdapter = New NwindDataSetTableAdapters.AppointmentsTableAdapter() Private employeesTableAdapter As MultiUser.NwindDataSetTableAdapters.EmployeesTableAdapter = New NwindDataSetTableAdapters.EmployeesTableAdapter() Private customersTableAdapter As MultiUser.NwindDataSetTableAdapters.CustomersTableAdapter = New NwindDataSetTableAdapters.CustomersTableAdapter() Private dataSet As New NwindDataSet() #End Region |
C# |
Copy Code
|
---|---|
#region ** fields private MultiUserCS2.NwindDataSetTableAdapters.AppointmentsTableAdapter appointmentsTableAdapter = new NwindDataSetTableAdapters.AppointmentsTableAdapter(); private MultiUserCS2.NwindDataSetTableAdapters.EmployeesTableAdapter employeesTableAdapter = new NwindDataSetTableAdapters.EmployeesTableAdapter(); private MultiUserCS2.NwindDataSetTableAdapters.CustomersTableAdapter customersTableAdapter = new NwindDataSetTableAdapters.CustomersTableAdapter(); private NwindDataSet dataSet = new NwindDataSet(); #endregion |
Visual Basic |
Copy Code
|
---|---|
AddHandler Scheduler.ReminderFire, AddressOf scheduler_ReminderFire AddHandler Scheduler.GroupItems.CollectionChanged, AddressOf GroupItems_CollectionChanged ' get data from the data base Me.employeesTableAdapter.Fill(dataSet.Employees) Me.customersTableAdapter.Fill(dataSet.Customers) Me.appointmentsTableAdapter.Fill(dataSet.Appointments) |
C# |
Copy Code
|
---|---|
Scheduler.ReminderFire += new EventHandler<ReminderActionEventArgs>(scheduler_ReminderFire); Scheduler.GroupItems.CollectionChanged += new NotifyCollectionChangedEventHandler(GroupItems_CollectionChanged); // get data from the data base this.employeesTableAdapter.Fill(dataSet.Employees); this.customersTableAdapter.Fill(dataSet.Customers); this.appointmentsTableAdapter.Fill(dataSet.Appointments); |
Visual Basic |
Copy Code
|
---|---|
Dim storage As AppointmentStorage = Scheduler.DataStorage.AppointmentStorage storage.Mappings.AppointmentProperties.MappingName = "Properties" storage.Mappings.Body.MappingName = "Description" storage.Mappings.End.MappingName = "End" storage.Mappings.IdMapping.MappingName = "AppointmentId" storage.Mappings.Location.MappingName = "Location" storage.Mappings.Start.MappingName = "Start" storage.Mappings.Subject.MappingName = "Subject" storage.Mappings.OwnerIndexMapping.MappingName = "Owner" storage.DataSource = dataSet.Appointments |
C# |
Copy Code
|
---|---|
AppointmentStorage storage = Scheduler.DataStorage.AppointmentStorage; storage.Mappings.AppointmentProperties.MappingName = "Properties"; storage.Mappings.Body.MappingName = "Description"; storage.Mappings.End.MappingName = "End"; storage.Mappings.IdMapping.MappingName = "AppointmentId"; storage.Mappings.Location.MappingName = "Location"; storage.Mappings.Start.MappingName = "Start"; storage.Mappings.Subject.MappingName = "Subject"; storage.Mappings.OwnerIndexMapping.MappingName = "Owner"; storage.DataSource = dataSet.Appointments; |
Visual Basic |
Copy Code
|
---|---|
Dim ownerStorage As ContactStorage = Scheduler.DataStorage.OwnerStorage AddHandler(CType(ownerStorage.Contacts, INotifyCollectionChanged)).CollectionChanged, AddressOf Owners_CollectionChanged ownerStorage.Mappings.IndexMapping.MappingName = "EmployeeId" ownerStorage.Mappings.TextMapping.MappingName = "FirstName" ownerStorage.DataSource = dataSet.Employees |
C# |
Copy Code
|
---|---|
ContactStorage ownerStorage = Scheduler.DataStorage.OwnerStorage; ((INotifyCollectionChanged)ownerStorage.Contacts).CollectionChanged += new NotifyCollectionChangedEventHandler(Owners_CollectionChanged); ownerStorage.Mappings.IndexMapping.MappingName = "EmployeeId"; ownerStorage.Mappings.TextMapping.MappingName = "FirstName"; ownerStorage.DataSource = dataSet.Employees; |
Visual Basic |
Copy Code
|
---|---|
Dim cntStorage As ContactStorage = Scheduler.DataStorage.ContactStorage AddHandler(CType(cntStorage.Contacts, INotifyCollectionChanged)).CollectionChanged, AddressOf Contacts_CollectionChanged cntStorage.Mappings.IdMapping.MappingName = "CustomerId" cntStorage.Mappings.TextMapping.MappingName = "CompanyName" cntStorage.DataSource = dataSet.Customers btnDay.IsChecked = True AddHandler Scheduler.StyleChanged, AddressOf Scheduler_StyleChanged |
C# |
Copy Code
|
---|---|
// set mappings and DataSource for the ContactStorage ContactStorage cntStorage = Scheduler.DataStorage.ContactStorage; ((INotifyCollectionChanged)cntStorage.Contacts).CollectionChanged += new NotifyCollectionChangedEventHandler(Contacts_CollectionChanged); cntStorage.Mappings.IdMapping.MappingName = "CustomerId"; cntStorage.Mappings.TextMapping.MappingName = "CompanyName"; cntStorage.DataSource = dataSet.Customers; btnDay.IsChecked = true; Scheduler.StyleChanged += new System.EventHandler<RoutedEventArgs>(Scheduler_StyleChanged); |