摘要:由于现在社会的不断进步,产生了各种污染的东西导致空气、水资源等等受到了污染,其中危害特别大的就是放射性污染,因此人们的生活环境变得很糟糕,针对这种情况,我们需要时时监测污染来保护人们。本设计结合科研团队项目“基于物联网的高灵敏度放射性污染检测仪”使用观察者模式并利用.NET的委托和事件机制实现数据源发生更新时向订阅者推送数据的功能。为了满足人们的需求,我通过设计了一种软件模块来接收污染的实时情况,让人们能够及时了解身边的环境是否污染,一旦检测到有污染情况通过这个软件模块通知订阅者,从而来更好做好预防污染,进而更好的保护好人们的健康。该软件模式的设计建立在VisualStudio2010开发环境上,运用了C#中的委托与事件功能。43167
毕业论文关键词:观察者模式;.NET框架;VisualStudio2010;C#
Abstract:Now that the progress of society, resulting in a variety of things that cause air pollution, water pollution, etc. have been, which is a special risk of radioactive contamination, and therefore people's living environment has become very bad, for this situation, we We need to constantly monitor the pollution to protect people.The design team combined research project "based on networking with high sensitivity detector of radioactive contamination," the observer mode and use the advantage of .NET delegates and events mechanism to achieve a data source push data updates to subscriber function. In order to meet people's needs, I received through the design of a real-time software modules of pollution, so that people can keep abreast of the environment around whether contamination, upon detection of contamination have to notify subscribers via the software modules to be better preventive pollution, and thus better protect people's health. The software model is designed based on VisualStudio2010 development environment, the use of the C # delegate and event functions.
KeyWords:observer pattern;.NET frame;Visual Studio 2010;C#
目录
1 绪论 1
1.1 课题的目的和意义 1
1.3 本设计的研究内容 3
2 观察者模式 3
2.1 观察者模式简介 3
2.2 观察者模式的认识 4
2.2.1 目标和观察者之间的关系 4
2.2.2单向依赖 4
2.2.3基本的实现说明 4
2.2.4命名建议 5
2.2.5触发通知的时机 5
2.2.6相互观察 5
2.2.7观察者模式的调用顺序示意图 5
2.2.8通知的顺序 6
2.3 推模型和拉模型 6
2.3.1 推模型 6
2.3.2 拉模型 6
2.4 Java中的观察者模式 9
2.5 观察者模式的结构图 11
3 Java及C#中观察者模式的实现原理 12
3.1 J2EE框架中Observer的实现 13
3.1.1 J2EE框架简介 13
3.1.2 Observer模式在J2EE框架中的实现