Version

Setting the CurrentUser and how it affects control behavior

XamScheduleDataManager exposes two properties relating to the current user of the application – CurrentUser and CurrentUserId. When either property is set, the other property is automatically synchronized to the appropriate value, so setting the CurrentUser property to a Resource will set the CurrentUserId to the Id of that Resource. Similarly, setting the CurrentUserId will set the CurrentUser to the Resource from the data manager’s ResourceItems that has that value as its Id. In typical scenarios, the developer should set the CurrentUserId property. In this way, the CurrentUser can be automatically updated whenever the ResourceItems collection has been populated.

In XAML:

<ig:XamScheduleDataManager
    DataConnector="{Binding ElementName=scheduleDataConnector}"
    CurrentUserId="own1">

The CurrentUser affects several areas of the xamSchedule product including reminders, working hour information and the calendars that are displayed.

Reminders

The xamScheduleDataManager will only track and trigger reminders for activities where the OwningResourceId matches the CurrentUserId of the data manager. In this way, a user may view the calendars of other users but only receive notification for reminders for their own activities.

Note, since the activities entity objects (e.g., Appointment) are provided by the DataConnector, their state is not affected by the xamScheduleDataManager’s state. Therefore the ReminderEnabled of the activity will reflect the state of the underlying data; it just indicates if a reminder is active and not whether it would be displayed by the xamScheduleDataManager. Since the ReminderEnabled state is independent of the CurrentUser, the ActivityPresenter (which is the base class for the element used to represent the various activity entity classes) exposes a ReminderVisibility property which considers the ReminderEnabled state as well as the CurrentUser.

Calendars Displayed

The calendars that are displayed by a schedule view are based upon a resolution process. This process first considers the CalendarGroupsOverride of the view control. If that collection has 1 or more CalendarGroup instances, then that will determine which calendars are displayed by the view. If that collection is empty, the CalendarGroups of the associated DataManager is considered. Again, if that collection has 1 or more CalendarGroup instances, then that will determine which calendars are displayed in the view. Both of these collections are empty by default, though. The last part of the resolution process involves the CurrentUser. When no CalendarGroup instances have been provided, the view control will display the PrimaryCalendar of the CurrentUser.

Working Hours/Days

The information displayed by the view controls can be affected by the working hour information. For a xamScheduleView or xamDayView, when the WeekDisplayMode has been set to WorkWeek only the days that are resolved as working days are included in the VisibleDates. Similarly, when its ShowWorkingHoursOnly has been set to True, only timeslots that intersect with the working hours are included in the display. The source of the working hour information is based upon the WorkingHoursSource property which defaults to CurrentUser. Note, for xamDayView when ShowWorkingHoursOnly is set to True, the timeslots displayed are based on the union of the working hour times, so some non-working hour timeslots may be displayed when displaying multiple days where the working hour information differs amongst the days.

The xamMonthView exposes a ShowingWorkingDaysOfWeekOnly property, which when set to True will only include days of the week that contain working hours. The source of the working day information is based upon the WorkingDaysSource property, which defaults to CurrentUser.

First Day of Week

When resolving the first day of the week, the FirstDayOfWeek of the CurrentUser is first considered. If that is not set, then the FirstDayOfWeek of the data manager’s Settings is considered. The resolved first day of week affects the dates displayed by controls displaying weeks (e.g., xamScheduleView/xamDayView when WeekDisplayMode is set, and xamMonthView). It also affects keyboard navigation relating to the first/last day of the week, such as pressing Home/End in xamMonthView or pressing Alt-Home/End in xamScheduleView/xamDayView.