Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Collapse]eXpressApp Framework
 [Expand]Fundamentals
 [Expand]Getting Started
 [Expand]Concepts
 [Expand]Design-Time Features
 [Expand]Functional Testing
 [Expand]Deployment
 [Collapse]Task-Based Help
  [Expand]Business Model Design
  [Expand]Application Model
  [Expand]Actions
  [Expand]Navigation
  [Expand]Views
  [Expand]List Editors
  [Expand]Property Editors
  [Expand]Templates
  [Expand]Filtering
  [Expand]Reporting
  [Expand]Dashboards
  [Collapse]Scheduler and Notifications
    How to: Access the List Editor's Control (Example for Scheduler Control)
    How to: Perform Custom Actions When a Recurring Event's Exceptional Occurrence is Created
    How to: Show Notifications to a Specific User
    How to: Show Various Notifications for Multiple Users
    How to: Use Notifications with a Custom Business Class (Implement ISupportNotifications)
    How to: Use Notifications with the Scheduler Event
  [Expand]Maps
  [Expand]Security
  [Expand]Workflow
  [Expand]Localization
  [Expand]Testing
  [Expand]Miscellaneous UI Customizations
 [Expand]Frequently Asked Questions
 [Expand]API Reference
[Expand]CodeRush
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
[Expand]End-User Documentation

How to: Show Various Notifications for Multiple Users

When you implement notifications in your application, one instance of notification class is created and displayed to each user by default. In the case that one user modifies this notification, for example using the Snooze or Dismiss Action, this notification is modified for all users. Create various notifications to multiple users as described in this topic to allow users use these Actions without collisions.

Note

This example is based on the Entity Framework data model, but you can use the same approach with the eXpress Persistent Objects (XPO) as well.

Assume you have an application with the Security System enabled. The MyNotification class implements the ISupportNotifications interface and exposes the AssignedTo and MyTask properties.

The MyTask property is an object of the custom MyTask type. The MyTask class has the MyNotifications aggregated collection of notifications that is a part of the one-to-many relationship.

Note

If you use the Event class from the Business Class Library with the Scheduler Module instead of the custom ISupportNotifications object, the Scheduler features (for example, the RecurringReminder functionality) are unworkable. To avoid this, you should create a separate Event instance for each user.

Edit the Module.cs (Module.vb) file. In the overridden ModuleBase.Setup method, subscribe to the XafApplication.LoggedOn event. In this event handler, get the NotificationsModule instance and subscribe to the DefaultNotificationsProvider.CustomizeNotificationCollectionCriteria event.

As a result, various notifications display for different users if the AssignedTo value refers to the user or same notification for all users if the AssignedTo value is empty.

Create the Controller which is a WinNotificationsMessageListViewController descendant in a WinForms application or WebNotificationsMessageListViewController in an ASP.NET application if you want to open the corresponding MyTask Detail View when double clicking a notification in the notification window. The example below demonstrates this Controller implementation for the WinForms application.

If you need to delete a notification when a user dismisses it, create a new ObjectViewController<ViewType, ObjectType> as demonstrated below.

How would you rate this topic?​​​​​​​