Notification Module Overview
1. Support WinForms and ASP.
2. Support scheduling module or custom business object.
3. Function: At a specified time, a window pops up and the user can view the reminder. can also be canceled or postponed.
If you want to demonstrate the project's source code, you can leave the mailbox in the message!
To use the notification module, you need to use the following module.
The first step:
Step Two:
Step Three:
The effect below Windows form, at the bottom, appears with the small icon shown:
Under ASP, the effect is as follows:
How do I implement notifications using custom classes?
1. If the following is your business class:
[defaultclassoptions] public class Task {[browsable ( false )] public int Id {get ; private set ;} public string Subject {get ; set ;} public DateTime duedate {get ; set ;}}
First to implement the Isupportnotifications interface:
[Defaultclassoptions] Public classtask:isupportnotifications {// ... #regionIsupportnotifications MembersPrivateDatetime?AlarmTime; [Browsable (false)] PublicDatetime?AlarmTime {Get{returnAlarmTime;} Set{alarmtime=value; if(Value = =NULL) {Remindin=NULL; ispostponed=false; }}} [Browsable (false)] Public BOOLispostponed {Get;Set; } [Browsable (false), notmapped] Public stringNotificationmessage {Get{returnSubject;} } PublicTimeSpan? Remindin {Get;Set; } [Browsable (false), notmapped] Public ObjectUniqueId {Get{returnId;} } #endregion}
To implement Ixafentityobject, set AlarmTime on save
[Defaultclassoptions] Public classtask:isupportnotifications, Ixafentityobject {// ... #regionIxafentityobject Members Public voidoncreated () {} Public voidOnLoaded () {} Public voidonsaving () {if(remindin.hasvalue) {AlarmTime= DueDate-Remindin.value; } Else{alarmtime=NULL; } if(AlarmTime = =NULL) {Remindin=NULL; ispostponed=false; } } #endregion}
Run, enter data:
Effect:
How do I let you specify a notification for a specified user?
[Defaultclassoptions] Public class task:isupportnotifications, Ixafentityobject { //public Virtual getset;}}
Here is the Employee object, the following is the EF example, xpo difference is not very big:
usingSystem.ComponentModel;usingDevExpress.Persistent.Base;// ... [Defaultclassoptions, Defaultproperty ("UserName")] Public classEmployee:DevExpress.Persistent.BaseImpl.EF.User { PublicEmployee () {Tasks=NewList<task>(); } Public VirtualIlist<task> Tasks {Get;Set; }}
usingDevExpress.Data.Filtering;usingDevExpress.ExpressApp.Notifications;usingDevExpress.Persistent.Base.General;// ... Public Override voidSetup (xafapplication application) {Base. Setup (application); Application. LoggedOn+=NewEventhandler<logoneventargs>(Application_loggedon);}voidApplication_loggedon (Objectsender, Logoneventargs e) {Notificationsmodule Notificationsmodule= application.modules.findmodule<notificationsmodule>(); Defaultnotificationsprovider Notificationsprovider=Notificationsmodule.defaultnotificationsprovider; Notificationsprovider.customizenotificationcollectioncriteria+=Notificationsprovider_customizenotificationcollectioncriteria;}voidNotificationsprovider_customizenotificationcollectioncriteria (Objectsender, Customizecollectioncriteriaeventargs e) { if(E.type = =typeof(Task)) {E.criteria= Criteriaoperator.parse ("AssignedTo is null | | Assignedto.id = = Currentuserid ()");
//You can see that there is a filtering condition, that is, what conditions are used to filter when the notification is made. }}
If you use a dispatch module, you can use the following code:
using DevExpress.ExpressApp.Scheduler; // void Application_loggedon (object sender, Logoneventargs e) { = Application.modules.findmodule<schedulermodulebase>(); = Schedulermodule.notificationsprovider; + = Notificationsprovider_customizenotificationcollectioncriteria;}
Default, Notification refresh interval 5 minutes for test , can reduced this time interval
Double clickWINApplicationProjectOfWinApplication.cs (VB)File,InModulePartOfModuleDesignerInChoosenotificationsmodule properties window , set 10 seconds
Similarly, This is required in the WebApplication.cs (VB) file of the Web project .
If you want to demonstrate the project's source code, you can leave the mailbox in the message!
xaf-Notification Module Overview Web+win