XAF-通知模块概述 web+win
通知模块概述
1.支持 WinForms和ASP.NET程序.
2.支持调度模块或自定义业务对象.
3.功能:在指定的时间,弹出一个窗口,用户可以查看提醒.也可以取消或推迟.
如需演示项目的源码,可以在留言中留下邮箱!

要使用通知模块,需要使用下面的模块.

第一步:

第二步:

第三步:

Windows Form下面的效果,在底部,出现下图所示的小图标:

在ASP.NET下效果如下:

如何使用自定义类实现通知?
1.假如下面是你的业务类:
[DefaultClassOptions]
public class Task {
[Browsable(false)]
public int Id { get; private set; }
public string Subject { get; set; }
public DateTime DueDate { get; set; }
}
先来实现ISupportNotifications 接口:
[DefaultClassOptions]
public class Task : ISupportNotifications {
// ... #region ISupportNotifications members
private DateTime? alarmTime;
[Browsable(false)]
public DateTime? AlarmTime {
get { return alarmTime; }
set {
alarmTime = value;
if (value == null) {
RemindIn = null;
IsPostponed = false;
}
}
}
[Browsable(false)]
public bool IsPostponed { get; set; }
[Browsable(false), NotMapped]
public string NotificationMessage {
get { return Subject; }
}
public TimeSpan? RemindIn { get; set; }
[Browsable(false), NotMapped]
public object UniqueId {
get { return Id; }
}
#endregion
}
再来实现IXafEntityObject,在保存时设置AlarmTime
[DefaultClassOptions]
public class Task : ISupportNotifications, IXafEntityObject {
// ...
#region IXafEntityObject members
public void OnCreated() { }
public void OnLoaded() { }
public void OnSaving() {
if (RemindIn.HasValue) {
AlarmTime = DueDate - RemindIn.Value;
}
else {
AlarmTime = null;
}
if (AlarmTime == null) {
RemindIn = null;
IsPostponed = false;
}
}
#endregion
}
运行,输入数据:

效果:

如何让为指定的用户指定通知?
[DefaultClassOptions]
public class Task : ISupportNotifications, IXafEntityObject {
// ...
public virtual Employee AssignedTo { get; set; }
}
下面是员工对象,下面是EF的例子,xpo区别的也不大:
using System.ComponentModel;
using DevExpress.Persistent.Base;
// ...
[DefaultClassOptions, DefaultProperty("UserName")]
public class Employee : DevExpress.Persistent.BaseImpl.EF.User {
public Employee() {
Tasks = new List<Task>();
}
public virtual IList<Task> Tasks { get; set; }
}
using DevExpress.Data.Filtering;
using DevExpress.ExpressApp.Notifications;
using DevExpress.Persistent.Base.General;
// ...
public override void Setup(XafApplication application) {
base.Setup(application);
application.LoggedOn += new EventHandler<LogonEventArgs>(application_LoggedOn);
}
void application_LoggedOn(object sender, LogonEventArgs e) {
NotificationsModule notificationsModule = Application.Modules.FindModule<NotificationsModule>();
DefaultNotificationsProvider notificationsProvider = notificationsModule.DefaultNotificationsProvider;
notificationsProvider.CustomizeNotificationCollectionCriteria += notificationsProvider_CustomizeNotificationCollectionCriteria;
}
void notificationsProvider_CustomizeNotificationCollectionCriteria(
object sender, CustomizeCollectionCriteriaEventArgs e) {
if (e.Type == typeof(Task)) {
e.Criteria = CriteriaOperator.Parse("AssignedTo is null || AssignedTo.Id == CurrentUserId()");
//可以看到,这里有个过滤条件,即,通知时,使用什么条件进行过滤.
}
}
如果使用调度模块,则可以使用下面的代码:
using DevExpress.ExpressApp.Scheduler;
// ...
void application_LoggedOn(object sender, LogonEventArgs e) {
SchedulerModuleBase schedulerModule = Application.Modules.FindModule<SchedulerModuleBase>();
NotificationsProvider notificationsProvider = schedulerModule.NotificationsProvider;
notificationsProvider.CustomizeNotificationCollectionCriteria += notificationsProvider_CustomizeNotificationCollectionCriteria;
}
默认情况下,通知刷新间隔是 5 分钟。出于测试目的,可以减少此时间间隔。
双击WIN应用程序项目的 WinApplication.cs(vb) 文件,在模块部分的模块设计器中选择NotificationsModule。在属性窗口中,将 NotificationsModule.NotificationsRefreshInterval 设置为 10 秒。
同样的,在WEB项目的WebApplication.cs(vb) 文件中也需要做这个。
如需演示项目的源码,可以在留言中留下邮箱!
XAF-通知模块概述 web+win的更多相关文章
- XAF-BI.Dashboard模块概述 web/win
Dashboard模块介绍了在ASP.NET XAF 和 WinForms 应用程序中简单的集成 DevExpress Dashboard控件的方法. 其实不仅仅是控件,利用了现有的XAF数据模型,这 ...
- openstack七大模块概述
前言 OpenStack主要由七部分组成,分别是Identify, Image, Network, Compute, Block Storage, Object Storage, Dashboard, ...
- 使用nodejs的http模块创建web服务器
使用nodejs的http模块创建web服务器 laiqun@msn.cn Contents 1. web服务器基础知识 2. Node.js的Web 服务器 3. 代码实现 1. web服务器基础知 ...
- spark概念、编程模型和模块概述
http://blog.csdn.net/pipisorry/article/details/50931274 spark基本概念 Spark一种与 Hadoop 相似的通用的集群计算框架,通过将大量 ...
- Java开源生鲜电商平台-通知模块设计与架构(源码可下载)
Java开源生鲜电商平台-通知模块设计与架构(源码可下载) 说明:对于一个生鲜的B2B平台而言,通知对于我们实际的运营而言来讲分为三种方式: 1. 消息推送:(采用极光推送) ...
- eclipse中创建多模块maven web项目
本文讲述在eclipse中创建分模块maven web项目. 暂时将一个项目分为controller:service:dao以及父类模块四部分. 1.创建父类模块. 创建一个简单的maven proj ...
- 用 requests 模块从 Web 下载文件
用 requests 模块从 Web 下载文件 requests 模块让你很容易从 Web 下载文件,不必担心一些复杂的问题,诸如网络错误.连接问题和数据压缩.requests 模块不是 Python ...
- [HeadFrist-HTMLCSS学习笔记]第三章构建模块:Web页面建设
[HeadFrist-HTMLCSS学习笔记]第三章构建模块:Web页面建设 敲黑板!! <q>元素添加短引用,<blockquote>添加长引用 在段落里添加引用就使用< ...
- IIS7 404 模块 IIS Web Core 通知 MapRequestHandler 处理程序 StaticFile 错误代码 0x80070002
<system.webServer> <!--添加--> <modules runAllManagedModulesForAllRequests="true&q ...
随机推荐
- VS2008 + WDK 配置 及其编译错误
VS2008 + SP1 + Win7 X64 1. 安装WDK,并配置系统环境变量:WDKROOT-D:\WinDDK\7600.16385.1 2. 启动VS2005,在菜单栏“工具”-“选项”内 ...
- 理解InnoDB的事务隔离级别
隔离是ACID(Atomicity,Consistency,Isolation,Durability)的重要部分,它保证事务以一种可靠的方式运行.隔离确保同时运行的事务并不相互干扰.隔离确保数据一致性 ...
- [Mysql] "Too many connections"
刚刚在项目中遇到mysql数据库连接不够的问题,查了一点资料,记录下.异常信息主要为:Data source rejected establishment of connection, message ...
- c++ 调用dl里的导出类
来源:http://blog.csdn.net/yysdsyl/article/details/2626033 动态dll的类导出:CPPDll2->test.h #pragma once // ...
- ThinkPHP5.0学习1 — 命名空间
定义命名空间:namespace sp1: 访问命名空间:\sp1\somefunction(); 非限定名称访问方式 //访问当前命名空间内容:somefunction(); 限定名称访问方 ...
- 从C#到TypeScript - Proxy
总目录 从C#到TypeScript - 类型 从C#到TypeScript - 高级类型 从C#到TypeScript - 变量 从C#到TypeScript - 接口 从C#到TypeScript ...
- Material Design学习-----TextInputLayout
TextInputLayout是为EditText提供了一种新的实现和交互方式.在传统的EditText中存在一个hint属性,是说在editext中没有内容时,默认的提示信息.当想edittext中 ...
- Struts2学习第二天——动态方法调用
method属性 在前面的例子里,Action默认使用execute()方法来处理请求.但是,如果有多个不同的请求需要同一个Action进行不同处理,怎么办?在Struts.xml文件中,需要指定Ac ...
- 兜转数年,老跳成了卖过软件开过店写过APP的电脑老师
老跳(因为性格太跳,被大家公认的外号),87年生,湖南人,上篇中老赵的大学下铺兄弟. 2008年大学毕业两人一同去的广州,住在求职公寓里找工作. 老赵找工作找了半个月,老跳却在到广州的第二天就开始上班 ...
- Python2.7 xlwt安装 No module named future.builtins
遇到的坑 事情是这样的,因为项目要使用Python配合软件集成时的自动化,以前遗留的Python代码已经out of date啦,只能亲自update,所以必须搭建Python环境,使用2.7版本(我 ...