通知模块概述

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的更多相关文章

  1. XAF-BI.Dashboard模块概述 web/win

    Dashboard模块介绍了在ASP.NET XAF 和 WinForms 应用程序中简单的集成 DevExpress Dashboard控件的方法. 其实不仅仅是控件,利用了现有的XAF数据模型,这 ...

  2. openstack七大模块概述

    前言 OpenStack主要由七部分组成,分别是Identify, Image, Network, Compute, Block Storage, Object Storage, Dashboard, ...

  3. 使用nodejs的http模块创建web服务器

    使用nodejs的http模块创建web服务器 laiqun@msn.cn Contents 1. web服务器基础知识 2. Node.js的Web 服务器 3. 代码实现 1. web服务器基础知 ...

  4. spark概念、编程模型和模块概述

    http://blog.csdn.net/pipisorry/article/details/50931274 spark基本概念 Spark一种与 Hadoop 相似的通用的集群计算框架,通过将大量 ...

  5. Java开源生鲜电商平台-通知模块设计与架构(源码可下载)

    Java开源生鲜电商平台-通知模块设计与架构(源码可下载) 说明:对于一个生鲜的B2B平台而言,通知对于我们实际的运营而言来讲分为三种方式:           1. 消息推送:(采用极光推送)   ...

  6. eclipse中创建多模块maven web项目

    本文讲述在eclipse中创建分模块maven web项目. 暂时将一个项目分为controller:service:dao以及父类模块四部分. 1.创建父类模块. 创建一个简单的maven proj ...

  7. 用 requests 模块从 Web 下载文件

    用 requests 模块从 Web 下载文件 requests 模块让你很容易从 Web 下载文件,不必担心一些复杂的问题,诸如网络错误.连接问题和数据压缩.requests 模块不是 Python ...

  8. [HeadFrist-HTMLCSS学习笔记]第三章构建模块:Web页面建设

    [HeadFrist-HTMLCSS学习笔记]第三章构建模块:Web页面建设 敲黑板!! <q>元素添加短引用,<blockquote>添加长引用 在段落里添加引用就使用< ...

  9. IIS7 404 模块 IIS Web Core 通知 MapRequestHandler 处理程序 StaticFile 错误代码 0x80070002

    <system.webServer> <!--添加--> <modules runAllManagedModulesForAllRequests="true&q ...

随机推荐

  1. 对Unity注入技术最简单的理解和应用

    Unity注入技术,我决定最大的作用在于一个项目,尤其是WEB项目在更远其中一个类时,不需要重新生成,直接通过WEBCONFIG文件的修改就可以更改对应关系和功能,实验步骤如下: 1:新建一个接口IS ...

  2. web移动端Fixed在Input获取焦点时ios下产生的BUG及处理

    1.现象 可以看到下面两张图,图1搜索框为fixed固定在顶部,滚动没有任何问题. 图2当光标进入搜索框时,ios自作聪明的把光标定位到中间,并且fixed属性被自动修改成了absolute.此时注意 ...

  3. 关于OpenGL和DX学习的取舍

    大家多知道左右就肯定要与显卡打交道.两大图形图像IPA.OpenGL(图形),DX(图形,声音,键盘控制,网络) OpenGL的兴起可能取决于苹果公司的适用,吸引看大部分开发者适用,它有跨平台的有点. ...

  4. Markdown 标记语言简介

    简介 做为一种标记语言,广泛应用在写作领域,markdown语法编写的文本,经过特殊的软件进行展示: 目的:相对html,markdown提高文本的可读可写性 兼容:兼容html 自动转换特殊字符:& ...

  5. Matlab将三维变量分割为多个二维变量的方法

    最近在处理 Matlab 中的三维矩阵的时候,遇到了一个问题: 假如m 为 5*5*5的矩阵,如果以第三个维度为基础,分割为5个不同的矩阵 m1,m2,m3,m4,应该如何解决? 解决方法:eval函 ...

  6. 规范 : loading display & ui-view loading

    angular 没有compile 完成的接口,最像的接口是$viewContentLoaded(router ui),但是一开始会开始跑,因为有ui-view 暂时解决方法是在body的loadin ...

  7. 每天一个Linux命令(06)--rmdir命令

    终于忙完了公司的事,可以安静的充充电了. 今天学习一下Linux中命令:rmdir 命令,rmdir是常用的命令,该命令的功能是删除空目录,一个目录被删除之前必须是空的.(注意,rm -r dir 命 ...

  8. php调用API支付接口(使用第三方接口,调用的天工接口。)

    首先访问  https://charging.teegon.com/  注册账号, 找到开发配置   记下client_id和client_secret. 点击 天工开放平台 点击天工收银 点击  S ...

  9. 第22篇 js中的this指针的用法

    前面把js的相关知识总结了下,今天把js中的上下文的this,对于强类型语言,this的用法非常的单一,因为他们没有js特有的动态绑定. 首先看下面代码: function funcA() { thi ...

  10. org.hibernate.AnnotationException: mappedBy reference an unknown target entity property: com.entity.annotations.House.district in

    org.hibernate.AnnotationException: mappedBy reference an unknown target entity property: com.entity. ...