组合界面应用程序块.ppt

上传人:本田雅阁 文档编号:3452059 上传时间:2019-08-26 格式:PPT 页数:35 大小:3.02MB
返回 下载 相关 举报
组合界面应用程序块.ppt_第1页
第1页 / 共35页
组合界面应用程序块.ppt_第2页
第2页 / 共35页
组合界面应用程序块.ppt_第3页
第3页 / 共35页
组合界面应用程序块.ppt_第4页
第4页 / 共35页
组合界面应用程序块.ppt_第5页
第5页 / 共35页
点击查看更多>>
资源描述

《组合界面应用程序块.ppt》由会员分享,可在线阅读,更多相关《组合界面应用程序块.ppt(35页珍藏版)》请在三一文库上搜索。

1、组合型智能客户端应用 With Composite Application Block,曹严明 .NET架构顾问 微软(中国),日程,组合型应用的应用场景 Composite App Block 体系架构概述 Composite App Block 主要概念 Demo,JPMC 网上银行,集成 投资信息,集成 分析工具,集成 新闻及提醒,集成 股票数据,Citibank 信息发布门户,Thomson 金融数据门户,Dell 客服集成桌面,Commonwealth Bank of Australia 柜员系统,Commonwealth Bank of Australia 柜员系统,Client

2、tier,Commonwealth 柜员系统体系结构,Data storage,Private Services,SmartPart,Active Directory,Local Cache,Agent,Security,Instrumentation,Oracle,Configuration,Authn,Orchestration,Private service n,Private service,Authz,Config,Legacy systems,Mainframe n,WS Proxy,IFW Service n,SOFA,Service Helpers,Data Integrati

3、on,SOFA,Mainframe,IFW Service,Data centre,Branch site,Smart Client,Smart Card,Local AD,SOFA Farm,HIS Farm,AD Farm,BizTalk Farm,Mainframe,Other Application Servers, Oracle,Every Service authorized against AD,Commonwealth 柜员系统部署方案,日程,组合型应用的应用场景 Composite App Block 体系架构概述 Composite App Block 主要概念 Demo,

4、Billing,Inventory,CRM,Smart Client Module,组合型 解决方案,将不同的功能模块组合成解决方案 运行环境提供基础服务 降低开发成本 灵活方便,什么是组合型智能客户端应用?,Smart Client Module,Smart Client Module,Composite UI App Block 的来由,UIP1 PAG,UIP2 PAG,CAB PAG,CCF,Thomson,Dell,CAB,微软其他部门,客户解决方案,PAG,Other field frameworks,Composite UI Application Block 创建企业级智能客户

5、端,对系统设计团队的价值:质量与一致性 提供一个针对企业级智能客户端应用的公共开发体系结构 提供一个一致的和可预测的方法来开发、包装、发布基础组件,以便强制企业应用的体系结构标准 对开发团队的价值:生产力 提供一个开发环境能很好的隐藏复杂度和提高生产力 通过高度抽象和关注点的分离,开发人员能够关注于业务逻辑 提高基础框架代码的复用 商务目标: 提高最终用户的生产力和业务工作的敏捷性 公司可以以更敏捷的方式推出新的和升级的功能 界面使最终用户更快的、更准确的完成工作任务,避免通过 Alt-Tab, Copy-Paste 的方式作应用间的数据交换 一致的界面降低了培训费用,主要困难,将完全不同的组

6、件组合成一个完整的应用 将Shell部分与应用逻辑部分分离开来 可扩展性使您能使用自己的设计模式和开发方法,Shell,Composite App Block 概述,Module,UI Element Mgr,View,UI Element Mgr,View,Element,Element,Work Item Shared State Shared Events,CAB 体系结构,Shell,Host,User Interface Elements,SmartPart Managers & Base Classes,Hosted Control,Layout,MDI,StatusStrip U

7、I Element,MenuStrip UI Element,ToolStrip UI Element,Services,CatalogReader,Loader,Authentication,Logging?,Main Form,Initializer,Authorization?,Biz Logic 开发,Infrastructure 开发,Shell 开发,A Work Item,设计组合型应用 应用逻辑,将 views (SmartPart)设计为独立于 controllers 的单元 共享模块状态 共享基础服务 封装用例 重用 降低模块间的依赖性 尽量使用 events, servi

8、ces, and interfaces,SmartPart A,Controller A,SmartPart B,Controller B,A Work Item,设计组合型应用 界面逻辑,SmartParts 是控件 Workspaces 在一个可视框架中显示它们 Shell 开发人员开发 Workspaces. 控件跟 Workspaces 无关 界面元素可以用共同的方法添加 以免业务逻辑开发人员把业务逻辑跟特定的界面风格紧耦合 可以集中控制用例改变界面的方式和时间 Commands 连接了可操作界面元素集和一个业务逻辑callback,View A,Controller A,View B

9、,Controller B,Shell,UI Elem Mgr 1,UI Elem Mgr 2,Element1,Element2,UI Init,Command,Command,Windows Workspace,Tab Workspace,应用启动次序: 1 of 2 初始化 Shell, Host, 和初始服务,Shell 启动 Shell 给 HostFactory 提供基本的启动设置 HostFactory 根据这些设置创建 Authentication, CatalogReader, Initializer 和 Loader 服务的实例 HostFactory 创建 Host 并把

10、这些服务添加给 Host,Host,Shell,Host Factory,Bootstrap Config Data,Loader,1,2,3,Authentication,Initializer,4,5,CatalogReader,应用启动次序: 2 of 2 初始化 Host 并加载 Modules,Shell 调用 Host.Initialize(), 这个由 Initializer 服务实现 Host 调用 Authentication 服务, 该服务负责在当前应用程序域中建立 principal CatalogReader 服务以 Solution Profile 返回基本模块设置。

11、CatalogReader 服务封装了如何选择正确的 Solution Profile 以加载正确的 SmartParts Loader 被调用并赋予 Solution Profile,开始以正确的次序加载 modules (带有依赖性的属性) Loader 调用 module 的入口类的 AddServices() 方法,让 module 注册自己的服务然后调用 Start() 方法,Host,Shell,Loader,1,Authentication,CatalogReader,MyModule,IPrincipal,2,Host Initialization,Solution Profi

12、le,3,4,IModule,Load Assembly,Load IModule,ServiceXYZ,5,- AddServices - Start,Initializer,Components, Services & Containers,CAB所有的部分都是围绕着 containers, components and services 这三个概念构建的 采用这个体系结构,你可以对 CAB 的功能进行任意的扩展 Components 是包含一些逻辑的对象。比如,Windows Controls, controllers 带有业务逻辑和服务代理 Services 是被应用中许多 compo

13、nents 调用的对象。比如security services, tracing services, eventing services Containers 是 components 和 services 的集合。Container 管理其中的 components 的生命周期。. Component 可以向container 请求一个 service。Containers 可以包含其他的 containers。,ApplicationHost,Default Work Item,Component1,Component2,Component3,Component4,Component5,添

14、加和定位服务 使用 Service Locator 和 Injection 模式,Adding Services CAB Foundation Services Module-added services Programmatically Declaratively Acquiring Services Find in upstream containers Programmatically Declaratively,ApplicationHost,A Work Item,Module Loader,Module,Service(typeof(IMyService) public class

15、 MyService : IMyService ,View,Controller,public class MyComponent ServiceDependency IMyService myService; ,日程,组合型应用的应用场景 Composite App Block 体系架构概述 Composite App Block 主要概念 Demo,Shell,UI Elements: 你可以改变的 shell 中的共享元素 菜单条,状态条,splash screens, etc Workspaces: 能够显示和隐藏控件的对象 Tabbed, Zoned / “Portal”, MDI,

16、 Windows, Decked Commands: 可以映射到多个界面元素的“行动” 比如 “显示客户明细” 命令有工具条项和菜单项 UI Elements,Shell 开发人员,创建 Shell 应用程序 添加 UI Element Managers 注册 Workspaces,Part 开发人员,创建控件 (SmartParts) 定义 Commands 映射 UI Elements 到 Commands 显示 Controls 在 Workspaces 里,Workspaces,Workspaces 可以一致的显示多个控件 Shell 开发人员创建定制的 workspaces 以提供:

17、 控件周围相似的框架和修饰 共享的布局和定位 眩目的切换 Activation UIs (tabs, Alt-Tab keystrokes, etc) 提供: Tabbed Workspace Windows Workspace Decked Workspace SmartPart 开发人员可以创建独立于 Workspace 的 Parts,Tabbed Workspace,A Smart Part,Your Work Item,Windows Workspace,Splat Workspace,aWorkspace.Show(mySmartPart);,View A,Work Item St

18、ate,WorkItems,WorkItem 代表一个用例 包含在 Workspace 之中 服务 Service Agents 并加载状态(同步或异步) 创建其他组件 (比如 Views)。CAB 创建 Controllers。 组件共享 WorkItem State 并可以通过它控制用例的生命周期,Your Work Item,Run (IWorkspace ws),Service Agent,Service Agent,Controller A,Event Broker Publisher-Subscriber,Publishers,Subscribers,1,*,.NET Event

19、with Attribute,.NET method with attribute,EventSubscription(“topic:/Customer/Changed”, ThreadOption.Background) Public void CustomerChanged(object sender, CustArgs args) /go call some web services or something long-running ,EventPublication(“topic:/Customer/Changed”) event EventHandler CustomerIdCha

20、nged; /fire like a normal .NET event CustomerIdChanged(this, new CustArgs() );,EventSubscription(“topic:/Customer/Changed”) Public void CustomerChanged(object sender, CustArgs args) MessageBox.Show(args.CustomerId,“new customer!”); ,Publishers 和 Subscribers 对以下达成一致: 主题 (由 URI 决定) 消息 (如果需要一个特定的 Event

21、Args) 范畴 (全局事件还是局部事件),Subscribers 被调用时有对该线程的控制 Background (For long-running work) UI Thread (to update UI controls on appropriate thread) Publisher (on same thread as publisher),A Work Item,共享 WorkItem State,弱类型的 (use as a dictionary) 或是强类型的 (wrap an item with get/set) 取决于您希望的耦合度要多少 调用 State: 动态编程访问

22、,或者通过 IoC attributes,public void SomeMethod() Customer currentCust = (Customer)Context.State”Customer”; ,public class ControllerX : Component ( private Customer cust; State(“Customer”) public Customer set cust = value; ),View X,Controller X,Work Item State,状态保持 (State Persistence),提供一个简单的服务的方式来存储和加载

23、 WorkItem state 本质上是对 WorkItem(是一个application controller)使用了 memento 模式,采用一个 State 对象,并提供一个 service,这个 service 作为这个 State 对象的repository。 提供的实现包括: SQL Isolated File File Optional DPAPI 加密,public interface IStatePersistenceService void Save(State state); State Load(Guid id); void Remove(Guid id); ,/your WorkItem ServiceDependency public IStatePersistenceService persistence; public void SomeMethod() persistence.Save(this.State); ,Demo,CAB 设计中所采用的几种模式,资源,加入 CAB 社区并下载代码: http:/ 动手实验 MSDN CAB Whitepaper http:/ MSDN CAB Webcast http:/

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 其他


经营许可证编号:宁ICP备18001539号-1